Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIPRES-489 php-scoper implementation for vendor namespaces #1002

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/create_zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ jobs:
- name: Build module ZIP
run: |
composer install --no-dev --optimize-autoloader --classmap-authoritative
composer global require humbug/php-scoper --no-progress --no-interaction
~/.composer/vendor/bin/php-scoper add-prefix && cp -r build/vendor/* vendor/
composer dump-autoload --no-dev --optimize --classmap-authoritative
cp .github/.htaccess vendor/.htaccess
rm -rf .git .docker .editorconfig .github tests .php-cs-fixer.php Makefile cypress .docker cypress.config.js cypress.env.json docker-compose*.yml .gitignore bin codeception.yml package-lock.json package.json .php_cs.dist .php-cs-fixer.dist .php-cs-fixer.dist.php
rm -rf .git .docker .editorconfig .github tests .php-cs-fixer.php Makefile cypress .docker cypress.config.js cypress.env.json docker-compose*.yml .gitignore bin codeception.yml package-lock.json package.json .php_cs.dist .php-cs-fixer.dist .php-cs-fixer.dist.php php-scoper.inc.php
mv .env.dist .env
mkdir ${{ env.MODULE_NAME }}
rsync -Rr ./ ./${{ env.MODULE_NAME }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ jobs:
- name: Build module ZIP
run: |
composer install --no-dev --optimize-autoloader --classmap-authoritative
composer global require humbug/php-scoper --no-progress --no-interaction
~/.composer/vendor/bin/php-scoper add-prefix && cp -r build/vendor/* vendor/
composer dump-autoload --no-dev --optimize --classmap-authoritative
rm -rf .git .github tests .php-cs-fixer.php Makefile cypress* docker-compose*.yml package.json package-lock.json .docker
rm -rf .git .github tests .php-cs-fixer.php Makefile cypress* docker-compose*.yml package.json package-lock.json .docker php-scoper.inc.php
mkdir ${{ env.MODULE_NAME }}
rsync -Rr ./ ./${{ env.MODULE_NAME }}
shopt -s extglob
Expand All @@ -97,4 +99,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ env.MODULE_NAME }}
path: ./
path: ./
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"psr-4": {
"Mollie\\": "src/",
"Mollie\\Subscription\\": "subscription/",
"Mollie\\Shared\\": "shared/"
"Mollie\\Shared\\": "shared/",
"Mollie\\Vendor\\Psr\\Container\\": "vendor\/psr\/container\/src\/",
"Mollie\\Vendor\\League\\Container\\": "vendor\/league\/container\/src\/"
},
"classmap": [
"mollie.php",
Expand Down
47 changes: 47 additions & 0 deletions scoper.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

use Isolated\Symfony\Component\Finder\Finder;

return [
// The prefix configuration. If a non null value will be used, a random prefix will be generated.
'prefix' => 'Mollie\\Vendor',

// By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
// directory. You can however define which files should be scoped by defining a collection of Finders in the
// following configuration key.
//
// For more see: https://github.com/humbug/php-scoper#finders-and-paths
'finders' => [
Finder::create()
->files()
->ignoreVCS(true)
->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/')
->exclude([
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
'console',
])
->in('vendor/league'),
Finder::create()
->files()
->ignoreVCS(true)
->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/')
->exclude([
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
'console',
])
->in('vendor/psr'),
Finder::create()->append([
'composer.json',
]),
],
];
2 changes: 1 addition & 1 deletion src/ServiceProvider/BaseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

namespace Mollie\ServiceProvider;

use League\Container\Container;
use Mollie;
use Mollie\Adapter\ConfigurationAdapter;
use Mollie\Adapter\Context;
Expand Down Expand Up @@ -142,6 +141,7 @@
use Mollie\Utility\Decoder\DecoderInterface;
use Mollie\Utility\Decoder\JsonDecoder;
use Mollie\Utility\NumberIdempotencyProvider;
use Mollie\Vendor\League\Container\Container;
use Mollie\Verification\PaymentType\CanBeRegularPaymentType;
use Mollie\Verification\PaymentType\PaymentTypeVerificationInterface;
use Mollie\Verification\Shipment\CanSendShipment;
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceProvider/LeagueServiceContainerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

namespace Mollie\ServiceProvider;

use League\Container\Container;
use League\Container\ReflectionContainer;
use Mollie\Vendor\League\Container\Container;
use Mollie\Vendor\League\Container\ReflectionContainer;

if (!defined('_PS_VERSION_')) {
exit;
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider/PrestashopContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

namespace Mollie\ServiceProvider;

use Mollie\Vendor\Psr\Container\ContainerInterface as PsrContainerInterface;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use Psr\Container\ContainerInterface as PsrContainerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

if (!defined('_PS_VERSION_')) {
Expand Down
2 changes: 1 addition & 1 deletion subscription/Install/AttributeInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
use Mollie\Logger\PrestaLoggerInterface;
use Mollie\Subscription\Config\Config;
use Mollie\Subscription\Repository\LanguageRepository;
use Mollie\Vendor\Psr\Log\LogLevel;
use PrestaShopDatabaseException;
use PrestaShopException;
use Psr\Log\LogLevel;
use Validate;

if (!defined('_PS_VERSION_')) {
Expand Down
Loading