From 6105d98780adf42f64a00afdb766235c3ca48206 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 8 May 2023 21:19:03 +0000 Subject: [PATCH] Updated Rector to commit cb30fd90e2fafe2b0bc7f6bd3f3ec2e6c09a4b09 https://github.com/rectorphp/rector-src/commit/cb30fd90e2fafe2b0bc7f6bd3f3ec2e6c09a4b09 [Transform] Remove MethodCallToAnotherMethodCallWithArgumentsRector as unused (#3777) --- docs/rector_rules_overview.md | 40 +---------- ...ToAnotherMethodCallWithArgumentsRector.php | 69 ------------------- ...odCallToAnotherMethodCallWithArguments.php | 62 ----------------- src/Application/VersionResolver.php | 4 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 2 - vendor/composer/autoload_real.php | 10 +-- vendor/composer/autoload_static.php | 10 ++- 8 files changed, 14 insertions(+), 185 deletions(-) delete mode 100644 rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php delete mode 100644 rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index afda9c8802d..2cb0bcfcc4d 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 417 Rules Overview +# 415 Rules Overview
@@ -62,7 +62,7 @@ - [Strict](#strict) (6) -- [Transform](#transform) (33) +- [Transform](#transform) (31) - [TypeDeclaration](#typedeclaration) (40) @@ -8175,42 +8175,6 @@ return static function (RectorConfig $rectorConfig): void {
-### MethodCallToAnotherMethodCallWithArgumentsRector - -Turns old method call with specific types to new one with arguments - -:wrench: **configure it!** - -- class: [`Rector\Transform\Rector\MethodCall\MethodCallToAnotherMethodCallWithArgumentsRector`](../rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php) - -```php -ruleWithConfiguration(MethodCallToAnotherMethodCallWithArgumentsRector::class, [ - new MethodCallToAnotherMethodCallWithArguments('Nette\DI\ServiceDefinition', 'setInject', 'addTag', [ - 'inject', - ]), - ]); -}; -``` - -↓ - -```diff - $serviceDefinition = new Nette\DI\ServiceDefinition; --$serviceDefinition->setInject(); -+$serviceDefinition->addTag('inject'); -``` - -
- ### MethodCallToFuncCallRector Change method call to function call diff --git a/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php b/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php deleted file mode 100644 index 05f1457b300..00000000000 --- a/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php +++ /dev/null @@ -1,69 +0,0 @@ -setInject(); -CODE_SAMPLE -, <<<'CODE_SAMPLE' -$serviceDefinition = new Nette\DI\ServiceDefinition; -$serviceDefinition->addTag('inject'); -CODE_SAMPLE -, [new MethodCallToAnotherMethodCallWithArguments('Nette\\DI\\ServiceDefinition', 'setInject', 'addTag', ['inject'])])]); - } - /** - * @return array> - */ - public function getNodeTypes() : array - { - return [MethodCall::class]; - } - /** - * @param MethodCall $node - */ - public function refactor(Node $node) : ?Node - { - foreach ($this->methodCallRenamesWithAddedArguments as $methodCallRenameWithAddedArgument) { - if (!$this->isName($node->name, $methodCallRenameWithAddedArgument->getOldMethod())) { - continue; - } - if (!$this->isObjectType($node->var, $methodCallRenameWithAddedArgument->getObjectType())) { - continue; - } - $node->name = new Identifier($methodCallRenameWithAddedArgument->getNewMethod()); - $node->args = $this->nodeFactory->createArgs($methodCallRenameWithAddedArgument->getNewArguments()); - return $node; - } - return null; - } - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration) : void - { - Assert::allIsAOf($configuration, MethodCallToAnotherMethodCallWithArguments::class); - $this->methodCallRenamesWithAddedArguments = $configuration; - } -} diff --git a/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php b/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php deleted file mode 100644 index d0459a97e47..00000000000 --- a/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php +++ /dev/null @@ -1,62 +0,0 @@ -type = $type; - $this->oldMethod = $oldMethod; - $this->newMethod = $newMethod; - $this->newArguments = $newArguments; - RectorAssert::className($type); - RectorAssert::methodName($oldMethod); - RectorAssert::methodName($newMethod); - } - public function getObjectType() : ObjectType - { - return new ObjectType($this->type); - } - public function getOldMethod() : string - { - return $this->oldMethod; - } - public function getNewMethod() : string - { - return $this->newMethod; - } - /** - * @return mixed[] - */ - public function getNewArguments() : array - { - return $this->newArguments; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index a5fac246978..c69f0f38b0d 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 = 'd9e17ca2c6bfc750eade85131368c8a2c35a0ca1'; + public const PACKAGE_VERSION = 'cb30fd90e2fafe2b0bc7f6bd3f3ec2e6c09a4b09'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-05-08 21:06:06'; + public const RELEASE_DATE = '2023-05-08 21:14:10'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 2b422f7ec99..2023570c319 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 ComposerAutoloaderInitd5b423b8c5068bd673f374fa308743a1::getLoader(); +return ComposerAutoloaderInit4b7ef3b28e4f79e09b1d95321673e9a9::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 20446a36de8..82fab462ef7 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2710,7 +2710,6 @@ return array( 'Rector\\Transform\\Rector\\FuncCall\\FuncCallToNewRector' => $baseDir . '/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php', 'Rector\\Transform\\Rector\\FuncCall\\FuncCallToStaticCallRector' => $baseDir . '/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php', 'Rector\\Transform\\Rector\\Isset_\\UnsetAndIssetToMethodCallRector' => $baseDir . '/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php', - 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToAnotherMethodCallWithArgumentsRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToFuncCallRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToMethodCallRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToMethodCallRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToPropertyFetchRector' => $baseDir . '/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php', @@ -2730,7 +2729,6 @@ return array( 'Rector\\Transform\\ValueObject\\FuncCallToMethodCall' => $baseDir . '/rules/Transform/ValueObject/FuncCallToMethodCall.php', 'Rector\\Transform\\ValueObject\\FuncCallToStaticCall' => $baseDir . '/rules/Transform/ValueObject/FuncCallToStaticCall.php', 'Rector\\Transform\\ValueObject\\GetAndSetToMethodCall' => $baseDir . '/rules/Transform/ValueObject/GetAndSetToMethodCall.php', - 'Rector\\Transform\\ValueObject\\MethodCallToAnotherMethodCallWithArguments' => $baseDir . '/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php', 'Rector\\Transform\\ValueObject\\MethodCallToFuncCall' => $baseDir . '/rules/Transform/ValueObject/MethodCallToFuncCall.php', 'Rector\\Transform\\ValueObject\\MethodCallToMethodCall' => $baseDir . '/rules/Transform/ValueObject/MethodCallToMethodCall.php', 'Rector\\Transform\\ValueObject\\MethodCallToPropertyFetch' => $baseDir . '/rules/Transform/ValueObject/MethodCallToPropertyFetch.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 1cbae2ad4e6..acfeaddf7c3 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitd5b423b8c5068bd673f374fa308743a1 +class ComposerAutoloaderInit4b7ef3b28e4f79e09b1d95321673e9a9 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInitd5b423b8c5068bd673f374fa308743a1 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitd5b423b8c5068bd673f374fa308743a1', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit4b7ef3b28e4f79e09b1d95321673e9a9', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInitd5b423b8c5068bd673f374fa308743a1', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit4b7ef3b28e4f79e09b1d95321673e9a9', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitd5b423b8c5068bd673f374fa308743a1::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInitd5b423b8c5068bd673f374fa308743a1::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9::$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 8b095bc96ef..edb98bc22e1 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitd5b423b8c5068bd673f374fa308743a1 +class ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2952,7 +2952,6 @@ class ComposerStaticInitd5b423b8c5068bd673f374fa308743a1 'Rector\\Transform\\Rector\\FuncCall\\FuncCallToNewRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php', 'Rector\\Transform\\Rector\\FuncCall\\FuncCallToStaticCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php', 'Rector\\Transform\\Rector\\Isset_\\UnsetAndIssetToMethodCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php', - 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToAnotherMethodCallWithArgumentsRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToFuncCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToFuncCallRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToMethodCallRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToMethodCallRector.php', 'Rector\\Transform\\Rector\\MethodCall\\MethodCallToPropertyFetchRector' => __DIR__ . '/../..' . '/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php', @@ -2972,7 +2971,6 @@ class ComposerStaticInitd5b423b8c5068bd673f374fa308743a1 'Rector\\Transform\\ValueObject\\FuncCallToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/FuncCallToMethodCall.php', 'Rector\\Transform\\ValueObject\\FuncCallToStaticCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/FuncCallToStaticCall.php', 'Rector\\Transform\\ValueObject\\GetAndSetToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/GetAndSetToMethodCall.php', - 'Rector\\Transform\\ValueObject\\MethodCallToAnotherMethodCallWithArguments' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToAnotherMethodCallWithArguments.php', 'Rector\\Transform\\ValueObject\\MethodCallToFuncCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToFuncCall.php', 'Rector\\Transform\\ValueObject\\MethodCallToMethodCall' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToMethodCall.php', 'Rector\\Transform\\ValueObject\\MethodCallToPropertyFetch' => __DIR__ . '/../..' . '/rules/Transform/ValueObject/MethodCallToPropertyFetch.php', @@ -3115,9 +3113,9 @@ class ComposerStaticInitd5b423b8c5068bd673f374fa308743a1 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitd5b423b8c5068bd673f374fa308743a1::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitd5b423b8c5068bd673f374fa308743a1::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitd5b423b8c5068bd673f374fa308743a1::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit4b7ef3b28e4f79e09b1d95321673e9a9::$classMap; }, null, ClassLoader::class); }