From 4f42274ab777272562e43c6bfb62a1aa03f8c78c Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 22 Sep 2023 09:56:10 +0000 Subject: [PATCH] Updated Rector to commit 85a407a1b75939448a0ee6d539ebe86538252e52 https://github.com/rectorphp/rector-src/commit/85a407a1b75939448a0ee6d539ebe86538252e52 Deprecate BinarySwitchToIfElseRector as opinionated to allow more suitable match() refactoring (#5064) --- config/set/coding-style.php | 3 +- .../Switch_/BinarySwitchToIfElseRector.php | 65 +------------------ src/Application/VersionResolver.php | 4 +- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +-- vendor/composer/autoload_static.php | 8 +-- vendor/composer/installed.json | 8 +-- vendor/composer/installed.php | 2 +- .../src/GeneratedConfig.php | 2 +- .../Rector/Class_/MakeCommandLazyRector.php | 36 ++++++---- 10 files changed, 46 insertions(+), 94 deletions(-) diff --git a/config/set/coding-style.php b/config/set/coding-style.php index f625ae8b30f..37ad7a61b54 100644 --- a/config/set/coding-style.php +++ b/config/set/coding-style.php @@ -28,7 +28,6 @@ use Rector\CodingStyle\Rector\Property\SplitGroupedPropertiesRector; use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector; use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector; -use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector; use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector; use Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector; use Rector\Config\RectorConfig; @@ -37,5 +36,5 @@ use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector; use Rector\Visibility\Rector\ClassMethod\ExplicitPublicClassMethodRector; return static function (RectorConfig $rectorConfig) : void { $rectorConfig->ruleWithConfiguration(FuncCallToConstFetchRector::class, ['php_sapi_name' => 'PHP_SAPI', 'pi' => 'M_PI']); - $rectorConfig->rules([SeparateMultiUseImportsRector::class, PostIncDecToPreIncDecRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, BinarySwitchToIfElseRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, StringClassNameToClassConstantRector::class, CatchExceptionNameMatchingTypeRector::class, UseIncrementAssignRector::class, SplitDoubleAssignRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, AddArrayDefaultToArrayPropertyRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, StaticArrowFunctionRector::class, StaticClosureRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class, FuncGetArgsToVariadicParamRector::class, StrictArraySearchRector::class, UseClassKeywordForClassNameResolutionRector::class, SplitGroupedPropertiesRector::class, SplitGroupedClassConstantsRector::class, ExplicitPublicClassMethodRector::class]); + $rectorConfig->rules([SeparateMultiUseImportsRector::class, PostIncDecToPreIncDecRector::class, NewlineAfterStatementRector::class, RemoveFinalFromConstRector::class, NullableCompareToNullRector::class, ConsistentImplodeRector::class, TernaryConditionVariableAssignmentRector::class, SymplifyQuoteEscapeRector::class, StringClassNameToClassConstantRector::class, CatchExceptionNameMatchingTypeRector::class, UseIncrementAssignRector::class, SplitDoubleAssignRector::class, EncapsedStringsToSprintfRector::class, WrapEncapsedVariableInCurlyBracesRector::class, NewlineBeforeNewAssignSetRector::class, AddArrayDefaultToArrayPropertyRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, CallUserFuncArrayToVariadicRector::class, VersionCompareFuncCallToConstantRector::class, StaticArrowFunctionRector::class, StaticClosureRector::class, CountArrayToEmptyArrayComparisonRector::class, CallUserFuncToMethodCallRector::class, FuncGetArgsToVariadicParamRector::class, StrictArraySearchRector::class, UseClassKeywordForClassNameResolutionRector::class, SplitGroupedPropertiesRector::class, SplitGroupedClassConstantsRector::class, ExplicitPublicClassMethodRector::class]); }; diff --git a/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php b/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php index 9e7c345e692..8b1b1e49aff 100644 --- a/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php +++ b/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php @@ -4,39 +4,15 @@ declare (strict_types=1); namespace Rector\CodingStyle\Rector\Switch_; use PhpParser\Node; -use PhpParser\Node\Expr; -use PhpParser\Node\Expr\BinaryOp\BooleanOr; -use PhpParser\Node\Expr\BinaryOp\Equal; -use PhpParser\Node\Stmt\Case_; -use PhpParser\Node\Stmt\Else_; -use PhpParser\Node\Stmt\ElseIf_; -use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Switch_; -use Rector\Core\NodeAnalyzer\ExprAnalyzer; use Rector\Core\Rector\AbstractRector; -use Rector\Renaming\NodeManipulator\SwitchManipulator; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see \Rector\Tests\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector\BinarySwitchToIfElseRectorTest + * @deprecated This rule is deprecated as prevents refactoring to match (), use PHPStan, manual handling and PHP 8.0 upgrade set instead */ final class BinarySwitchToIfElseRector extends AbstractRector { - /** - * @readonly - * @var \Rector\Renaming\NodeManipulator\SwitchManipulator - */ - private $switchManipulator; - /** - * @readonly - * @var \Rector\Core\NodeAnalyzer\ExprAnalyzer - */ - private $exprAnalyzer; - public function __construct(SwitchManipulator $switchManipulator, ExprAnalyzer $exprAnalyzer) - { - $this->switchManipulator = $switchManipulator; - $this->exprAnalyzer = $exprAnalyzer; - } public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Changes switch with 2 options to if-else', [new CodeSample(<<<'CODE_SAMPLE' @@ -70,42 +46,7 @@ CODE_SAMPLE */ public function refactor(Node $node) : ?Node { - if ($node->cases === [] || \count($node->cases) > 2) { - return null; - } - // avoid removal of cases if it goes to be skipped next - $cases = $node->cases; - /** @var Case_ $firstCase */ - $firstCase = \array_shift($cases); - if (!$firstCase->cond instanceof Expr) { - return null; - } - if ($this->exprAnalyzer->isDynamicExpr($firstCase->cond)) { - return null; - } - $secondCase = \array_shift($cases); - // special case with empty first case → || - $isFirstCaseEmpty = $firstCase->stmts === []; - if ($isFirstCaseEmpty && $secondCase instanceof Case_ && $secondCase->cond instanceof Expr) { - $else = new BooleanOr(new Equal($node->cond, $firstCase->cond), new Equal($node->cond, $secondCase->cond)); - $ifNode = new If_($else); - $ifNode->stmts = $this->switchManipulator->removeBreakNodes($secondCase->stmts); - return $ifNode; - } - $ifNode = new If_(new Equal($node->cond, $firstCase->cond)); - $ifNode->stmts = $this->switchManipulator->removeBreakNodes($firstCase->stmts); - // just one condition - if (!$secondCase instanceof Case_) { - return $ifNode; - } - if ($secondCase->cond instanceof Expr) { - // has condition - $equal = new Equal($node->cond, $secondCase->cond); - $ifNode->elseifs[] = new ElseIf_($equal, $this->switchManipulator->removeBreakNodes($secondCase->stmts)); - } else { - // defaults - $ifNode->else = new Else_($this->switchManipulator->removeBreakNodes($secondCase->stmts)); - } - return $ifNode; + \trigger_error(\sprintf('The "%s" rule is deprecated as prevents refactoring to match (), use PHPStan, manual handling and PHP 8.0 upgrade set instead.', self::class), \E_USER_ERROR); + return null; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index cb498ef38c1..bd7c6f7bb67 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '40d127ee553bda3f486546f721a72698830d5b89'; + public const PACKAGE_VERSION = '85a407a1b75939448a0ee6d539ebe86538252e52'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-09-22 02:38:19'; + public const RELEASE_DATE = '2023-09-22 11:52:48'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index d7c136b2879..7f76ffb4b9c 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit74647fac53a9d53ef3626b53a324f04b::getLoader(); +return ComposerAutoloaderInit4550c0cd10b7e4bfde148cf529736b43::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 734a54a9d2e..40e198c9ba0 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit74647fac53a9d53ef3626b53a324f04b +class ComposerAutoloaderInit4550c0cd10b7e4bfde148cf529736b43 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit74647fac53a9d53ef3626b53a324f04b return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit74647fac53a9d53ef3626b53a324f04b', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit4550c0cd10b7e4bfde148cf529736b43', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit74647fac53a9d53ef3626b53a324f04b', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit4550c0cd10b7e4bfde148cf529736b43', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit74647fac53a9d53ef3626b53a324f04b::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit74647fac53a9d53ef3626b53a324f04b::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3c086d63575..a868d3e681f 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit74647fac53a9d53ef3626b53a324f04b +class ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2601,9 +2601,9 @@ class ComposerStaticInit74647fac53a9d53ef3626b53a324f04b public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit74647fac53a9d53ef3626b53a324f04b::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit74647fac53a9d53ef3626b53a324f04b::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit74647fac53a9d53ef3626b53a324f04b::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit4550c0cd10b7e4bfde148cf529736b43::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 55e764e03dc..b20d3f337d8 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1944,12 +1944,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-symfony.git", - "reference": "09ddd39b611dd02321b4b79f5e175a819e04c670" + "reference": "2c4fedfdafa9932f93ca1196272f440cda1e64ce" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/09ddd39b611dd02321b4b79f5e175a819e04c670", - "reference": "09ddd39b611dd02321b4b79f5e175a819e04c670", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/2c4fedfdafa9932f93ca1196272f440cda1e64ce", + "reference": "2c4fedfdafa9932f93ca1196272f440cda1e64ce", "shasum": "" }, "require": { @@ -1982,7 +1982,7 @@ "tomasvotruba\/unused-public": "^0.2", "tracy\/tracy": "^2.10" }, - "time": "2023-09-13T14:49:54+00:00", + "time": "2023-09-22T09:39:15+00:00", "default-branch": true, "type": "rector-extension", "extra": { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 4746442a6b3..10269bd94bb 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace RectorPrefix202309; -return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.1.0', 'version' => '3.1.0.0', 'reference' => '4bff79ddd77851fe3cdd11616ed3f92841ba5bd2', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.8', 'version' => '2.0.8.0', 'reference' => 'f9301a5b2fb1216b2b08f02ba04dc45423db6bff', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '0.5.1', 'version' => '0.5.1.0', 'reference' => 'b58e5a3933e541dc286cc91fc4f3898bbc6f1623', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v10.24.0', 'version' => '10.24.0.0', 'reference' => 'ddc26273085fad3c471b2602ad820e0097ff7939', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v10.24.0', 'version' => '10.24.0.0', 'reference' => '6c39fba7b2311e28f5c6ac7d729e3d49a2a98406', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v3.2.10', 'version' => '3.2.10.0', 'reference' => 'a4175c62652f2300c8017fb7e640f9ccb11648d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.17.1', 'version' => '4.17.1.0', 'reference' => 'a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.1.0', 'version' => '4.1.0.0', 'reference' => '8a4b664e916df82ff26a44709942dfd593fa6f30', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.24.1', 'version' => '1.24.1.0', 'reference' => '9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('pretty_version' => '1.10.35', 'version' => '1.10.35.0', 'reference' => 'e730e5facb75ffe09dfb229795e8c01a459f26c3', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.11.0', 'version' => '1.11.0.0', 'reference' => '3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '6e7e587714fff7a83dcc7025aee42ab3b265ae05', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v2.10.0', 'version' => '2.10.0.0', 'reference' => 'f913fb8cceba1e6644b7b90c4bfb678ed8a3ef38', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.14.0', 'version' => '1.14.0.0', 'reference' => '21591111d3ea62e31f2254280ca0656bc2b1bda6', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '6fbc9672905c7d5a885f2da2fc696f65840f4a66', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '4b2518028cc5bf9266a9069b1f3e287d62a0012d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '2b2a7cd5587c0ee5199804fffd7c99b5b5b5d076', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'be3974a30b1870f984e832464b58bdac2d18d66d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '09ddd39b611dd02321b4b79f5e175a819e04c670', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.0.3', 'version' => '5.0.3.0', 'reference' => '912dc2fbe3e3c1e7873313cc801b100b6c68c87b', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.3.4', 'version' => '6.3.4.0', 'reference' => 'eca495f2ee845130855ddf1cf18460c38966c8b6', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/filesystem' => array('pretty_version' => 'v6.3.1', 'version' => '6.3.1.0', 'reference' => 'edd36776956f2a6fcf577edb5b05eb0e3bdc52ae', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.3.3', 'version' => '6.3.3.0', 'reference' => '9915db259f67d21eefee768c1abcf1cc61b1fc9e', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', 'reference' => '42292d99c55abe617799667f454222c54c60e229', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.3.4', 'version' => '6.3.4.0', 'reference' => '0b5c29118f2e980d455d2e34a5659f4579847c54', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.3.0', 'version' => '3.3.0.0', 'reference' => '40da9cc13ec349d9e4966ce18b5fbcd724ab10a4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symplify/easy-parallel' => array('pretty_version' => '11.1.27', 'version' => '11.1.27.0', 'reference' => '28911142f6a0f4127271f745e2403bb84fcd2b87', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.1.26', 'version' => '11.1.26.0', 'reference' => '3e66b3fec678b74a076395ec629d535fb95293b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); +return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.1.0', 'version' => '3.1.0.0', 'reference' => '4bff79ddd77851fe3cdd11616ed3f92841ba5bd2', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.8', 'version' => '2.0.8.0', 'reference' => 'f9301a5b2fb1216b2b08f02ba04dc45423db6bff', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '0.5.1', 'version' => '0.5.1.0', 'reference' => 'b58e5a3933e541dc286cc91fc4f3898bbc6f1623', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v10.24.0', 'version' => '10.24.0.0', 'reference' => 'ddc26273085fad3c471b2602ad820e0097ff7939', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v10.24.0', 'version' => '10.24.0.0', 'reference' => '6c39fba7b2311e28f5c6ac7d729e3d49a2a98406', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v3.2.10', 'version' => '3.2.10.0', 'reference' => 'a4175c62652f2300c8017fb7e640f9ccb11648d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.17.1', 'version' => '4.17.1.0', 'reference' => 'a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.1.0', 'version' => '4.1.0.0', 'reference' => '8a4b664e916df82ff26a44709942dfd593fa6f30', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.24.1', 'version' => '1.24.1.0', 'reference' => '9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('pretty_version' => '1.10.35', 'version' => '1.10.35.0', 'reference' => 'e730e5facb75ffe09dfb229795e8c01a459f26c3', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpstan', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.11.0', 'version' => '1.11.0.0', 'reference' => '3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '6e7e587714fff7a83dcc7025aee42ab3b265ae05', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v2.10.0', 'version' => '2.10.0.0', 'reference' => 'f913fb8cceba1e6644b7b90c4bfb678ed8a3ef38', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.14.0', 'version' => '1.14.0.0', 'reference' => '21591111d3ea62e31f2254280ca0656bc2b1bda6', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '6fbc9672905c7d5a885f2da2fc696f65840f4a66', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '4b2518028cc5bf9266a9069b1f3e287d62a0012d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '2b2a7cd5587c0ee5199804fffd7c99b5b5b5d076', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'be3974a30b1870f984e832464b58bdac2d18d66d', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => NULL, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '2c4fedfdafa9932f93ca1196272f440cda1e64ce', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.0.3', 'version' => '5.0.3.0', 'reference' => '912dc2fbe3e3c1e7873313cc801b100b6c68c87b', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.3.4', 'version' => '6.3.4.0', 'reference' => 'eca495f2ee845130855ddf1cf18460c38966c8b6', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/filesystem' => array('pretty_version' => 'v6.3.1', 'version' => '6.3.1.0', 'reference' => 'edd36776956f2a6fcf577edb5b05eb0e3bdc52ae', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.3.3', 'version' => '6.3.3.0', 'reference' => '9915db259f67d21eefee768c1abcf1cc61b1fc9e', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.28.0', 'version' => '1.28.0.0', 'reference' => '42292d99c55abe617799667f454222c54c60e229', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.3.4', 'version' => '6.3.4.0', 'reference' => '0b5c29118f2e980d455d2e34a5659f4579847c54', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.3.0', 'version' => '3.3.0.0', 'reference' => '40da9cc13ec349d9e4966ce18b5fbcd724ab10a4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symplify/easy-parallel' => array('pretty_version' => '11.1.27', 'version' => '11.1.27.0', 'reference' => '28911142f6a0f4127271f745e2403bb84fcd2b87', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.1.26', 'version' => '11.1.26.0', 'reference' => '3e66b3fec678b74a076395ec629d535fb95293b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); diff --git a/vendor/rector/extension-installer/src/GeneratedConfig.php b/vendor/rector/extension-installer/src/GeneratedConfig.php index f9492393eb3..fee95fb9d42 100644 --- a/vendor/rector/extension-installer/src/GeneratedConfig.php +++ b/vendor/rector/extension-installer/src/GeneratedConfig.php @@ -9,7 +9,7 @@ namespace Rector\RectorInstaller; */ final class GeneratedConfig { - public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 4b25180'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2b2a7cd'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main be3974a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 09ddd39')); + public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 4b25180'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2b2a7cd'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main be3974a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 2c4fedf')); private function __construct() { } diff --git a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/MakeCommandLazyRector.php b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/MakeCommandLazyRector.php index 8a963663c47..730b6973f62 100644 --- a/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/MakeCommandLazyRector.php +++ b/vendor/rector/rector-symfony/rules/CodeQuality/Rector/Class_/MakeCommandLazyRector.php @@ -6,6 +6,7 @@ namespace Rector\Symfony\CodeQuality\Rector\Class_; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; @@ -81,10 +82,7 @@ CODE_SAMPLE private function resolveCommandNameFromSetName(Class_ $class) : ?Expr { $configureClassMethod = $class->getMethod('configure'); - if (!$configureClassMethod instanceof ClassMethod) { - return null; - } - if ($configureClassMethod->stmts === null) { + if (!$configureClassMethod instanceof ClassMethod || $configureClassMethod->stmts === null) { return null; } foreach ($configureClassMethod->stmts as $key => $stmt) { @@ -95,18 +93,32 @@ CODE_SAMPLE continue; } $methodCall = $stmt->expr; - if (!$this->isName($methodCall->name, 'setName')) { - continue; + if ($methodCall->var instanceof Variable) { + return $this->resolveFromNonFluentMethodCall($methodCall, $configureClassMethod, $key); } - if (!$this->isObjectType($methodCall->var, new ObjectType('Symfony\\Component\\Console\\Command\\Command'))) { - continue; - } - $commandNameEpxr = $methodCall->getArgs()[0]->value; - unset($configureClassMethod->stmts[$key]); - return $commandNameEpxr; + $expr = null; + $this->traverseNodesWithCallable($stmt, function (Node $node) use(&$expr) { + if ($node instanceof MethodCall && $this->isName($node->name, 'setName')) { + $expr = $node->getArgs()[0]->value; + // remove nested call + return $node->var; + } + return null; + }); + return $expr; } return null; } + private function resolveFromNonFluentMethodCall(MethodCall $methodCall, ClassMethod $classMethod, int $key) : ?Expr + { + if (!$this->isName($methodCall->name, 'setName')) { + return null; + } + $expr = $methodCall->getArgs()[0]->value; + // cleanup fluent call + unset($classMethod->stmts[$key]); + return $expr; + } private function createStaticProtectedPropertyWithDefault(string $name, Node $node) : Property { $property = new \PhpParser\Builder\Property($name);