diff --git a/composer.json b/composer.json index f94f379..0e8b497 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,9 @@ "rector/rector": "~2.0.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.57", "phpunit/phpunit": "^9.5", - "symplify/easy-coding-standard": "~11.2", - "friendsofphp/php-cs-fixer": "^3.57" + "symplify/easy-coding-standard": "~11.2" }, "conflict": { "rector/rector": "<2.0" diff --git a/composer.lock b/composer.lock index ae9cb3f..d5e4601 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0e041a16868da63dd3a01fb97bdffe27", + "content-hash": "ad9dbda06af89dde113d2067ddbdc904", "packages": [ { "name": "phpstan/phpstan", - "version": "2.0.3", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4" + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46b4d3529b12178112d9008337beda0cc2a1a6b4", - "reference": "46b4d3529b12178112d9008337beda0cc2a1a6b4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7d08f569e582ade182a375c366cbd896eccadd3a", + "reference": "7d08f569e582ade182a375c366cbd896eccadd3a", "shasum": "" }, "require": { @@ -62,25 +62,25 @@ "type": "github" } ], - "time": "2024-11-28T22:19:37+00:00" + "time": "2025-01-21T14:54:06+00:00" }, { "name": "rector/rector", - "version": "2.0.3", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "3f27091368bd935dbbaa8387099792fb20f65f68" + "reference": "e70d681f6a0c361a63e6825897cd97746436f015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/3f27091368bd935dbbaa8387099792fb20f65f68", - "reference": "3f27091368bd935dbbaa8387099792fb20f65f68", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e70d681f6a0c361a63e6825897cd97746436f015", + "reference": "e70d681f6a0c361a63e6825897cd97746436f015", "shasum": "" }, "require": { "php": "^7.4|^8.0", - "phpstan/phpstan": "^2.0.1" + "phpstan/phpstan": "^2.1.1" }, "conflict": { "rector/rector-doctrine": "*", @@ -113,7 +113,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.0.3" + "source": "https://github.com/rectorphp/rector/tree/2.0.7" }, "funding": [ { @@ -121,7 +121,7 @@ "type": "github" } ], - "time": "2024-12-12T15:22:19+00:00" + "time": "2025-01-19T09:41:28+00:00" } ], "packages-dev": [ @@ -216,13 +216,13 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - }, "phpstan": { "includes": [ "extension.neon" ] + }, + "branch-alias": { + "dev-main": "3.x-dev" } }, "autoload": { @@ -595,16 +595,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.65.0", + "version": "v3.68.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" + "reference": "b9db2b2ea3cdba7201067acee46f984ef2397cff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", - "reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/b9db2b2ea3cdba7201067acee46f984ef2397cff", + "reference": "b9db2b2ea3cdba7201067acee46f984ef2397cff", "shasum": "" }, "require": { @@ -621,17 +621,17 @@ "react/promise": "^2.0 || ^3.0", "react/socket": "^1.0", "react/stream": "^1.0", - "sebastian/diff": "^4.0 || ^5.0 || ^6.0", - "symfony/console": "^5.4 || ^6.0 || ^7.0", - "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", - "symfony/finder": "^5.4 || ^6.0 || ^7.0", - "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", - "symfony/polyfill-mbstring": "^1.28", - "symfony/polyfill-php80": "^1.28", - "symfony/polyfill-php81": "^1.28", - "symfony/process": "^5.4 || ^6.0 || ^7.0", - "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + "sebastian/diff": "^4.0 || ^5.1 || ^6.0", + "symfony/console": "^5.4 || ^6.4 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.4 || ^7.0", + "symfony/finder": "^5.4 || ^6.4 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.4 || ^7.0", + "symfony/polyfill-mbstring": "^1.31", + "symfony/polyfill-php80": "^1.31", + "symfony/polyfill-php81": "^1.31", + "symfony/process": "^5.4 || ^6.4 || ^7.2", + "symfony/stopwatch": "^5.4 || ^6.4 || ^7.0" }, "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.4", @@ -643,9 +643,9 @@ "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", - "phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3", - "symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8", - "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6" + "phpunit/phpunit": "^9.6.22 || ^10.5.40 || ^11.5.2", + "symfony/var-dumper": "^5.4.48 || ^6.4.15 || ^7.2.0", + "symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.2.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -686,7 +686,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.68.1" }, "funding": [ { @@ -694,7 +694,7 @@ "type": "github" } ], - "time": "2024-11-25T00:39:24+00:00" + "time": "2025-01-17T09:20:36+00:00" }, { "name": "myclabs/deep-copy", @@ -758,16 +758,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -810,9 +810,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "phar-io/manifest", @@ -1581,33 +1581,33 @@ }, { "name": "react/child-process", - "version": "v0.6.5", + "version": "v0.6.6", "source": { "type": "git", "url": "https://github.com/reactphp/child-process.git", - "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", - "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159", + "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", "react/event-loop": "^1.2", - "react/stream": "^1.2" + "react/stream": "^1.4" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", - "react/socket": "^1.8", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/socket": "^1.16", "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" }, "type": "library", "autoload": { "psr-4": { - "React\\ChildProcess\\": "src" + "React\\ChildProcess\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1644,19 +1644,15 @@ ], "support": { "issues": "https://github.com/reactphp/child-process/issues", - "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + "source": "https://github.com/reactphp/child-process/tree/v0.6.6" }, "funding": [ { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" + "url": "https://opencollective.com/reactphp", + "type": "open_collective" } ], - "time": "2022-09-16T13:41:56+00:00" + "time": "2025-01-01T16:37:48+00:00" }, { "name": "react/dns", @@ -3002,16 +2998,16 @@ }, { "name": "symfony/console", - "version": "v6.4.15", + "version": "v6.4.17", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd" + "reference": "799445db3f15768ecc382ac5699e6da0520a0a04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", - "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", + "url": "https://api.github.com/repos/symfony/console/zipball/799445db3f15768ecc382ac5699e6da0520a0a04", + "reference": "799445db3f15768ecc382ac5699e6da0520a0a04", "shasum": "" }, "require": { @@ -3076,7 +3072,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.15" + "source": "https://github.com/symfony/console/tree/v6.4.17" }, "funding": [ { @@ -3092,7 +3088,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:19:14+00:00" + "time": "2024-12-07T12:07:30+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3113,12 +3109,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3261,12 +3257,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3385,16 +3381,16 @@ }, { "name": "symfony/finder", - "version": "v6.4.13", + "version": "v6.4.17", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958" + "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/daea9eca0b08d0ed1dc9ab702a46128fd1be4958", - "reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958", + "url": "https://api.github.com/repos/symfony/finder/zipball/1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", + "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", "shasum": "" }, "require": { @@ -3429,7 +3425,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.13" + "source": "https://github.com/symfony/finder/tree/v6.4.17" }, "funding": [ { @@ -3445,7 +3441,7 @@ "type": "tidelift" } ], - "time": "2024-10-01T08:30:56+00:00" + "time": "2024-12-29T13:51:37+00:00" }, { "name": "symfony/options-resolver", @@ -4073,12 +4069,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -4391,15 +4387,15 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^8.1" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.1.99" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/config/shopware-6.6.0.php b/config/shopware-6.6.0.php index 49b7263..5232fe0 100644 --- a/config/shopware-6.6.0.php +++ b/config/shopware-6.6.0.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Frosh\Rector\Rule\v67\AddEntityNameToEntityExtension; use Rector\Config\RectorConfig; use Rector\Set\ValueObject\LevelSetList; use Rector\Symfony\Set\SymfonySetList; @@ -16,6 +17,10 @@ LevelSetList::UP_TO_PHP_82, ]); + $rectorConfig->ruleWithConfiguration(AddEntityNameToEntityExtension::class, [ + 'backwardsCompatible' => true, + ]); + $rectorConfig->importNames(); $rectorConfig->importShortClasses(false); }; diff --git a/config/shopware-6.7.0.php b/config/shopware-6.7.0.php index f2ae465..32e7019 100644 --- a/config/shopware-6.7.0.php +++ b/config/shopware-6.7.0.php @@ -2,8 +2,16 @@ declare(strict_types=1); +use Frosh\Rector\Rule\v67\AddEntityNameToEntityExtension; use Rector\Config\RectorConfig; return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/v6.7/renaming.php'); + + $rectorConfig->ruleWithConfiguration(AddEntityNameToEntityExtension::class, [ + 'backwardsCompatible' => false, + ]); + + $rectorConfig->importNames(); + $rectorConfig->importShortClasses(false); }; diff --git a/config/v6.5/flysystem-v3.php b/config/v6.5/flysystem-v3.php index 9b9b49b..73491eb 100644 --- a/config/v6.5/flysystem-v3.php +++ b/config/v6.5/flysystem-v3.php @@ -15,9 +15,9 @@ $rectorConfig->ruleWithConfiguration( RenameClassRector::class, [ - 'League\\Flysystem\\FilesystemInterface' => 'League\\Flysystem\\FilesystemOperator', - 'League\\Flysystem\\AdapterInterface' => 'League\\Flysystem\\FilesystemAdapter', - 'League\\Flysystem\\Memory\\MemoryAdapter' => 'League\\Flysystem\\InMemory\\InMemoryFilesystemAdapter', + 'League\Flysystem\FilesystemInterface' => 'League\Flysystem\FilesystemOperator', + 'League\Flysystem\AdapterInterface' => 'League\Flysystem\FilesystemAdapter', + 'League\Flysystem\Memory\MemoryAdapter' => 'League\Flysystem\InMemory\InMemoryFilesystemAdapter', ], ); @@ -25,10 +25,10 @@ $classConstRenaming = []; $filesystemClasses = [ - 'League\\Flysystem\\FilesystemOperator', - 'League\\Flysystem\\Filesystem', - 'League\\Flysystem\\FilesystemInterface', - 'League\\Flysystem\\FilesystemAdapter', + 'League\Flysystem\FilesystemOperator', + 'League\Flysystem\Filesystem', + 'League\Flysystem\FilesystemInterface', + 'League\Flysystem\FilesystemAdapter', ]; foreach ($filesystemClasses as $class) { $methodRenaming += [ @@ -49,8 +49,8 @@ new MethodCallRename($class, 'getVisibility', 'visibility'), ]; - $classConstRenaming[] = new RenameClassAndConstFetch($class, 'VISIBILITY_PUBLIC', 'League\\Flysystem\\Visibility', 'PUBLIC'); - $classConstRenaming[] = new RenameClassAndConstFetch($class, 'VISIBILITY_PRIVATE', 'League\\Flysystem\\Visibility', 'PRIVATE'); + $classConstRenaming[] = new RenameClassAndConstFetch($class, 'VISIBILITY_PUBLIC', 'League\Flysystem\Visibility', 'PUBLIC'); + $classConstRenaming[] = new RenameClassAndConstFetch($class, 'VISIBILITY_PRIVATE', 'League\Flysystem\Visibility', 'PRIVATE'); } $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, $methodRenaming); diff --git a/config/v6.5/renaming.php b/config/v6.5/renaming.php index 2de3924..a83e9f8 100644 --- a/config/v6.5/renaming.php +++ b/config/v6.5/renaming.php @@ -26,7 +26,7 @@ $rectorConfig->ruleWithConfiguration( RenameMethodRector::class, [ - new MethodCallRename('Shopware\\Core\\Framework\\Adapter\\Twig\\EntityTemplateLoader', 'clearInternalCache', 'reset'), + new MethodCallRename('Shopware\Core\Framework\Adapter\Twig\EntityTemplateLoader', 'clearInternalCache', 'reset'), new MethodCallRename('Shopware\Core\Content\ImportExport\Processing\Mapping\Mapping', 'getDefault', 'getDefaultValue'), new MethodCallRename('Shopware\Core\Content\ImportExport\Processing\Mapping\Mapping', 'getMappedDefault', 'getDefaultValue'), ], @@ -35,33 +35,33 @@ $rectorConfig->ruleWithConfiguration( RenameClassRector::class, [ - 'Shopware\\Core\\Framework\\Adapter\\Asset\\ThemeAssetPackage' => 'Shopware\\Storefront\\Theme\\ThemeAssetPackage', - 'Maltyxx\\ImagesGenerator\\ImagesGeneratorProvider' => 'bheller\\ImagesGenerator\\ImagesGeneratorProvider', - 'Shopware\\Core\\Framework\\Event\\BusinessEventInterface' => 'Shopware\\Core\\Framework\\Event\\FlowEventAware', - 'Shopware\\Core\\Framework\\Event\\MailActionInterface' => 'Shopware\\Core\\Framework\\Event\\MailAware', - 'Shopware\\Core\\Framework\\Log\\LogAwareBusinessEventInterface' => 'Shopware\\Core\\Framework\\Log\\LogAware', - 'Shopware\\Storefront\\Event\\ProductExportContentTypeEvent' => 'Shopware\\Core\\Content\\ProductExport\\Event\\ProductExportContentTypeEvent', - 'Shopware\\Storefront\\Page\\Product\\Review\\MatrixElement' => 'Shopware\\Core\\Content\\Product\\SalesChannel\\Review\\MatrixElement', - 'Shopware\\Storefront\\Page\\Product\\Review\\RatingMatrix' => 'Shopware\\Core\\Content\\Product\\SalesChannel\\Review\\RatingMatrix', - 'Shopware\\Storefront\\Page\\Address\\Listing\\AddressListingCriteriaEvent' => 'Shopware\\Core\\Checkout\\Customer\\Event\\AddressListingCriteriaEvent', - 'Shopware\\Administration\\Service\\AdminOrderCartService' => 'Shopware\\Core\\Checkout\\Cart\\ApiOrderCartService', - 'Shopware\\Core\\System\\User\\Service\\UserProvisioner' => 'Shopware\\Core\\Maintenance\\User\\Service\\UserProvisioner', - 'Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepositoryInterface' => 'Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository', - 'Shopware\\Core\\System\\SalesChannel\\Entity\\SalesChannelRepositoryInterface' => 'Shopware\\Core\\System\\SalesChannel\\Entity\\SalesChannelRepository', + 'Shopware\Core\Framework\Adapter\Asset\ThemeAssetPackage' => 'Shopware\Storefront\Theme\ThemeAssetPackage', + 'Maltyxx\ImagesGenerator\ImagesGeneratorProvider' => 'bheller\ImagesGenerator\ImagesGeneratorProvider', + 'Shopware\Core\Framework\Event\BusinessEventInterface' => 'Shopware\Core\Framework\Event\FlowEventAware', + 'Shopware\Core\Framework\Event\MailActionInterface' => 'Shopware\Core\Framework\Event\MailAware', + 'Shopware\Core\Framework\Log\LogAwareBusinessEventInterface' => 'Shopware\Core\Framework\Log\LogAware', + 'Shopware\Storefront\Event\ProductExportContentTypeEvent' => 'Shopware\Core\Content\ProductExport\Event\ProductExportContentTypeEvent', + 'Shopware\Storefront\Page\Product\Review\MatrixElement' => 'Shopware\Core\Content\Product\SalesChannel\Review\MatrixElement', + 'Shopware\Storefront\Page\Product\Review\RatingMatrix' => 'Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix', + 'Shopware\Storefront\Page\Address\Listing\AddressListingCriteriaEvent' => 'Shopware\Core\Checkout\Customer\Event\AddressListingCriteriaEvent', + 'Shopware\Administration\Service\AdminOrderCartService' => 'Shopware\Core\Checkout\Cart\ApiOrderCartService', + 'Shopware\Core\System\User\Service\UserProvisioner' => 'Shopware\Core\Maintenance\User\Service\UserProvisioner', + 'Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface' => 'Shopware\Core\Framework\DataAbstractionLayer\EntityRepository', + 'Shopware\Core\System\SalesChannel\Entity\SalesChannelRepositoryInterface' => 'Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository', ], ); $rectorConfig->ruleWithConfiguration( RemoveMethodCallParamRector::class, [ - new RemoveMethodCallParam('Shopware\\Core\\Checkout\\Cart\\Tax\\Struct\\CalculatedTaxCollection', 'merge', 1), + new RemoveMethodCallParam('Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTaxCollection', 'merge', 1), ], ); $rectorConfig->ruleWithConfiguration( RemoveArgumentFromClassConstructRector::class, [ - new RemoveArgumentFromClassConstruct('Shopware\\Core\\Checkout\\Customer\\Exception\\DuplicateWishlistProductException', 0), + new RemoveArgumentFromClassConstruct('Shopware\Core\Checkout\Customer\Exception\DuplicateWishlistProductException', 0), new RemoveArgumentFromClassConstruct('Shopware\Core\Content\Newsletter\Exception\LanguageOfNewsletterDeleteException', 0), new RemoveArgumentFromClassConstruct('Shopware\Core\Content\Product\Events\ProductIndexerEvent', 1), new RemoveArgumentFromClassConstruct('Shopware\Core\Content\Product\Events\ProductIndexerEvent', 2), diff --git a/config/v6.5/typehints.php b/config/v6.5/typehints.php index 2f7d7c9..c88b7de 100644 --- a/config/v6.5/typehints.php +++ b/config/v6.5/typehints.php @@ -32,17 +32,17 @@ new AddParamTypeDeclaration('Shopware\Core\Content\LandingPage\DataAbstractionLayer\LandingPageIndexer', 'iterate', 0, new ArrayType(new StringType(), new StringType())), new AddParamTypeDeclaration('Shopware\Core\Content\ProductStream\DataAbstractionLayer\ProductStreamIndexer', 'iterate', 0, new ArrayType(new StringType(), new StringType())), new AddParamTypeDeclaration('Shopware\Core\Content\Rule\DataAbstractionLayer\RuleIndexer', 'iterate', 0, new ArrayType(new StringType(), new StringType())), - new AddParamTypeDeclaration('Shopware\\Storefront\\Page\\Product\\Review\\ReviewLoaderResult', 'setMatrix', 0, new ObjectType('Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix')), + new AddParamTypeDeclaration('Shopware\Storefront\Page\Product\Review\ReviewLoaderResult', 'setMatrix', 0, new ObjectType('Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix')), ], ); $rectorConfig->ruleWithConfiguration( AddReturnTypeDeclarationRector::class, [ - new AddReturnTypeDeclaration('Shopware\\Core\\Framework\\Adapter\\Twig\\TemplateIterator', 'getIterator', new ObjectType('Traversable')), + new AddReturnTypeDeclaration('Shopware\Core\Framework\Adapter\Twig\TemplateIterator', 'getIterator', new ObjectType('Traversable')), new AddReturnTypeDeclaration('Shopware\Core\Content\Cms\DataResolver\CriteriaCollection', 'getIterator', new ObjectType('Traversable')), - new AddReturnTypeDeclaration('Shopware\\Core\\Checkout\\Cart\\CartBehavior', 'hasPermission', new BooleanType()), - new AddReturnTypeDeclaration('Shopware\\Storefront\\Page\\Product\\Review\\ReviewLoaderResult', 'getMatrix', new ObjectType('Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix')), + new AddReturnTypeDeclaration('Shopware\Core\Checkout\Cart\CartBehavior', 'hasPermission', new BooleanType()), + new AddReturnTypeDeclaration('Shopware\Storefront\Page\Product\Review\ReviewLoaderResult', 'getMatrix', new ObjectType('Shopware\Core\Content\Product\SalesChannel\Review\RatingMatrix')), ], ); diff --git a/config/v6.6/renaming.php b/config/v6.6/renaming.php index c00f503..fee0e74 100644 --- a/config/v6.6/renaming.php +++ b/config/v6.6/renaming.php @@ -32,19 +32,19 @@ $rectorConfig->ruleWithConfiguration( RenameClassRector::class, [ - 'Shopware\\Core\\Framework\\DataAbstractionLayer\\Event\\BeforeDeleteEvent' => 'Shopware\\Core\\Framework\\DataAbstractionLayer\\Event\\EntityDeleteEvent', + 'Shopware\Core\Framework\DataAbstractionLayer\Event\BeforeDeleteEvent' => 'Shopware\Core\Framework\DataAbstractionLayer\Event\EntityDeleteEvent', ], ); $rectorConfig->ruleWithConfiguration( RenameClassConstFetchRector::class, [ - new RenameClassAndConstFetch('Shopware\\Core\\Checkout\\Cart', 'CHECKOUT_ORDER_PLACED', 'Shopware\\Core\\Framework\\Event\\BusinessEvents', 'CHECKOUT_ORDER_PLACED'), - new RenameClassAndConstFetch('Shopware\\Elasticsearch\\Product\\ElasticsearchProductDefinition', 'KEYWORD_FIELD', 'Shopware\\Elasticsearch\\Framework\\AbstractElasticsearchDefinition', 'KEYWORD_FIELD'), - new RenameClassAndConstFetch('Shopware\\Elasticsearch\\Product\\ElasticsearchProductDefinition', 'BOOLEAN_FIELD', 'Shopware\\Elasticsearch\\Framework\\AbstractElasticsearchDefinition', 'BOOLEAN_FIELD'), - new RenameClassAndConstFetch('Shopware\\Elasticsearch\\Product\\ElasticsearchProductDefinition', 'FLOAT_FIELD', 'Shopware\\Elasticsearch\\Framework\\AbstractElasticsearchDefinition', 'FLOAT_FIELD'), - new RenameClassAndConstFetch('Shopware\\Elasticsearch\\Product\\ElasticsearchProductDefinition', 'INT_FIELD', 'Shopware\\Elasticsearch\\Framework\\AbstractElasticsearchDefinition', 'INT_FIELD'), - new RenameClassAndConstFetch('Shopware\\Elasticsearch\\Product\\ElasticsearchProductDefinition', 'SEARCH_FIELD', 'Shopware\\Elasticsearch\\Framework\\AbstractElasticsearchDefinition', 'SEARCH_FIELD'), + new RenameClassAndConstFetch('Shopware\Core\Checkout\Cart', 'CHECKOUT_ORDER_PLACED', 'Shopware\Core\Framework\Event\BusinessEvents', 'CHECKOUT_ORDER_PLACED'), + new RenameClassAndConstFetch('Shopware\Elasticsearch\Product\ElasticsearchProductDefinition', 'KEYWORD_FIELD', 'Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition', 'KEYWORD_FIELD'), + new RenameClassAndConstFetch('Shopware\Elasticsearch\Product\ElasticsearchProductDefinition', 'BOOLEAN_FIELD', 'Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition', 'BOOLEAN_FIELD'), + new RenameClassAndConstFetch('Shopware\Elasticsearch\Product\ElasticsearchProductDefinition', 'FLOAT_FIELD', 'Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition', 'FLOAT_FIELD'), + new RenameClassAndConstFetch('Shopware\Elasticsearch\Product\ElasticsearchProductDefinition', 'INT_FIELD', 'Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition', 'INT_FIELD'), + new RenameClassAndConstFetch('Shopware\Elasticsearch\Product\ElasticsearchProductDefinition', 'SEARCH_FIELD', 'Shopware\Elasticsearch\Framework\AbstractElasticsearchDefinition', 'SEARCH_FIELD'), ], ); }; diff --git a/config/v6.7/renaming.php b/config/v6.7/renaming.php index 92b3201..4281723 100644 --- a/config/v6.7/renaming.php +++ b/config/v6.7/renaming.php @@ -12,16 +12,16 @@ $rectorConfig->ruleWithConfiguration( RenameClassConstFetchRector::class, [ - new RenameClassAndConstFetch('Shopware\\Core\\Content\\MailTemplate\\Subscriber\\MailSendSubscriberConfig', 'MAIL_CONFIG_EXTENSION', 'Shopware\\Core\\Content\\Flow\\Dispatching\\Action\\SendMailAction', 'MAIL_CONFIG_EXTENSION'), - new RenameClassAndConstFetch('Shopware\\Core\\Content\\MailTemplate\\Subscriber\\MailSendSubscriberConfig', 'ACTION_NAME', 'Shopware\\Core\\Content\\Flow\\Dispatching\\Action\\SendMailAction', 'ACTION_NAME'), + new RenameClassAndConstFetch('Shopware\Core\Content\MailTemplate\Subscriber\MailSendSubscriberConfig', 'MAIL_CONFIG_EXTENSION', 'Shopware\Core\Content\Flow\Dispatching\Action\SendMailAction', 'MAIL_CONFIG_EXTENSION'), + new RenameClassAndConstFetch('Shopware\Core\Content\MailTemplate\Subscriber\MailSendSubscriberConfig', 'ACTION_NAME', 'Shopware\Core\Content\Flow\Dispatching\Action\SendMailAction', 'ACTION_NAME'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'STATE_LOGGED_IN', 'Shopware\\Core\\Framework\\Adapter\\Cache\\CacheStateSubscriber', 'STATE_LOGGED_IN'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'STATE_CART_FILLED', 'Shopware\\Core\\Framework\\Adapter\\Cache\\CacheStateSubscriber', 'STATE_CART_FILLED'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'STATE_LOGGED_IN', 'Shopware\Core\Framework\Adapter\Cache\CacheStateSubscriber', 'STATE_LOGGED_IN'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'STATE_CART_FILLED', 'Shopware\Core\Framework\Adapter\Cache\CacheStateSubscriber', 'STATE_CART_FILLED'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'CURRENCY_COOKIE', 'Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\HttpCacheKeyGenerator', 'CURRENCY_COOKIE'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'CONTEXT_CACHE_COOKIE', 'Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\HttpCacheKeyGenerator', 'CONTEXT_CACHE_COOKIE'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'SYSTEM_STATE_COOKIE', 'Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\HttpCacheKeyGenerator', 'SYSTEM_STATE_COOKIE'), - new RenameClassAndConstFetch('Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\CacheResponseSubscriber', 'INVALIDATION_STATES_HEADER', 'Shopware\\Core\\Framework\\Adapter\\Cache\\Http\\HttpCacheKeyGenerator', 'INVALIDATION_STATES_HEADER'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'CURRENCY_COOKIE', 'Shopware\Core\Framework\Adapter\Cache\Http\HttpCacheKeyGenerator', 'CURRENCY_COOKIE'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'CONTEXT_CACHE_COOKIE', 'Shopware\Core\Framework\Adapter\Cache\Http\HttpCacheKeyGenerator', 'CONTEXT_CACHE_COOKIE'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'SYSTEM_STATE_COOKIE', 'Shopware\Core\Framework\Adapter\Cache\Http\HttpCacheKeyGenerator', 'SYSTEM_STATE_COOKIE'), + new RenameClassAndConstFetch('Shopware\Core\Framework\Adapter\Cache\Http\CacheResponseSubscriber', 'INVALIDATION_STATES_HEADER', 'Shopware\Core\Framework\Adapter\Cache\Http\HttpCacheKeyGenerator', 'INVALIDATION_STATES_HEADER'), ], ); }; diff --git a/src/Rule/v65/AddBanAllToReverseProxyRector.php b/src/Rule/v65/AddBanAllToReverseProxyRector.php index 74e5404..38829fb 100644 --- a/src/Rule/v65/AddBanAllToReverseProxyRector.php +++ b/src/Rule/v65/AddBanAllToReverseProxyRector.php @@ -51,7 +51,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node) { - if (!$this->isObjectType($node, new ObjectType('Shopware\\Storefront\\Framework\\Cache\\ReverseProxy\\AbstractReverseProxyGateway'))) { + if (!$this->isObjectType($node, new ObjectType('Shopware\Storefront\Framework\Cache\ReverseProxy\AbstractReverseProxyGateway'))) { return null; } diff --git a/src/Rule/v67/AddEntityNameToEntityExtension.php b/src/Rule/v67/AddEntityNameToEntityExtension.php new file mode 100644 index 0000000..4eefd3c --- /dev/null +++ b/src/Rule/v67/AddEntityNameToEntityExtension.php @@ -0,0 +1,109 @@ +isObjectType($node, new ObjectType('Shopware\Core\Framework\DataAbstractionLayer\EntityExtension'))) { + return null; + } + + $foundGetEntityName = false; + $targetDefinitionClass = null; + + /** @var Node\Stmt\ClassMethod $stmt */ + foreach ($node->stmts as $stmt) { + if ((string) $stmt->name === 'getEntityName') { + $foundGetEntityName = true; + } + + if ((string) $stmt->name === 'getDefinitionClass') { + foreach ($stmt->stmts as $methodStmts) { + if ($methodStmts instanceof Node\Stmt\Return_) { + if ($methodStmts->expr instanceof Node\Expr\ClassConstFetch) { + $targetDefinitionClass = clone $methodStmts->expr; + $targetDefinitionClass->name = new Node\Identifier('ENTITY_NAME'); + } + } + } + } + } + + if (!$this->backwardsCompatible) { + // remove getDefinitionClass method + $node->stmts = array_filter($node->stmts, function ($stmt) { + return (string) $stmt->name !== 'getDefinitionClass'; + }); + } + + if (!$foundGetEntityName) { + $classMethod = new Node\Stmt\ClassMethod('getEntityName'); + $classMethod->returnType = new Node\Name('string'); + $classMethod->flags = Modifiers::PUBLIC; + + if ($targetDefinitionClass) { + $classMethod->stmts[] = new Node\Stmt\Return_($targetDefinitionClass); + } else { + $classMethod->stmts[] = new Node\Stmt\Return_(new Node\Scalar\String_('COULD NOT FIND ENTITY NAME')); + } + + $node->stmts[] = $classMethod; + } + + return null; + } + + public function configure(array $configuration): void + { + $this->backwardsCompatible = $configuration['backwardsCompatible'] ?? true; + } +} diff --git a/stubs/Shopware/Core/Framework/DataAbstractionLayer/EntityExtension.php b/stubs/Shopware/Core/Framework/DataAbstractionLayer/EntityExtension.php new file mode 100644 index 0000000..82baa98 --- /dev/null +++ b/stubs/Shopware/Core/Framework/DataAbstractionLayer/EntityExtension.php @@ -0,0 +1,8 @@ +add(new StringField('name', 'name')); + } + + public function getDefinitionClass(): string + { + return ProductDefinition::class; + } +} +?> +----- +add(new StringField('name', 'name')); + } + + public function getDefinitionClass(): string + { + return ProductDefinition::class; + } + public function getEntityName(): string + { + return ProductDefinition::ENTITY_NAME; + } +} +?> diff --git a/tests/Rector/v67/AddEntityNameToEntityExtension/config/configured_rule.php b/tests/Rector/v67/AddEntityNameToEntityExtension/config/configured_rule.php new file mode 100644 index 0000000..078225e --- /dev/null +++ b/tests/Rector/v67/AddEntityNameToEntityExtension/config/configured_rule.php @@ -0,0 +1,11 @@ +import(__DIR__ . '/../../../../../config/config_test.php'); + $rectorConfig->rule(AddEntityNameToEntityExtension::class); +};