diff --git a/.github/workflows/create_zip.yml b/.github/workflows/create_zip.yml index b83d575bd..fad4b231f 100644 --- a/.github/workflows/create_zip.yml +++ b/.github/workflows/create_zip.yml @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 32f780890..f5fa89172 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -97,4 +99,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ env.MODULE_NAME }} - path: ./ \ No newline at end of file + path: ./ diff --git a/composer.json b/composer.json index 9e6cbf27d..5a8ebc0b2 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/scoper.inc.php b/scoper.inc.php new file mode 100644 index 000000000..938c53096 --- /dev/null +++ b/scoper.inc.php @@ -0,0 +1,47 @@ + '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', + ]), + ], +]; diff --git a/src/ServiceProvider/BaseServiceProvider.php b/src/ServiceProvider/BaseServiceProvider.php index 2fd5701bf..d933c5f8f 100644 --- a/src/ServiceProvider/BaseServiceProvider.php +++ b/src/ServiceProvider/BaseServiceProvider.php @@ -14,7 +14,6 @@ namespace Mollie\ServiceProvider; -use League\Container\Container; use Mollie; use Mollie\Adapter\ConfigurationAdapter; use Mollie\Adapter\Context; @@ -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; diff --git a/src/ServiceProvider/LeagueServiceContainerProvider.php b/src/ServiceProvider/LeagueServiceContainerProvider.php index d5486fe82..a3a0997d7 100644 --- a/src/ServiceProvider/LeagueServiceContainerProvider.php +++ b/src/ServiceProvider/LeagueServiceContainerProvider.php @@ -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; diff --git a/src/ServiceProvider/PrestashopContainer.php b/src/ServiceProvider/PrestashopContainer.php index 8f13e4f13..73ea8929b 100644 --- a/src/ServiceProvider/PrestashopContainer.php +++ b/src/ServiceProvider/PrestashopContainer.php @@ -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_')) { diff --git a/subscription/Install/AttributeInstaller.php b/subscription/Install/AttributeInstaller.php index 4fdd6c64b..e3252571f 100644 --- a/subscription/Install/AttributeInstaller.php +++ b/subscription/Install/AttributeInstaller.php @@ -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_')) {