From 6ad00a78fc51030e9d6c3fa0e20c3e1347bb2094 Mon Sep 17 00:00:00 2001 From: Chris Abbey Date: Wed, 30 Oct 2024 10:28:26 -0700 Subject: [PATCH 1/3] add new rectors for php8.3's deprecation of get_class()/get_parent_class() without arguments --- config/set/php83.php | 4 + .../Fixture/fixture.php.inc | 27 +++++++ .../Fixture/skip_different_func_call.php.inc | 11 +++ .../Fixture/skip_with_args.php.inc | 14 ++++ .../RemoveGetClassNoArgsRectorTest.php | 28 +++++++ .../config/configured_rule.php | 13 +++ .../Fixture/fixture.php.inc | 27 +++++++ .../Fixture/skip_different_func_call.php.inc | 11 +++ .../Fixture/skip_with_args.php.inc | 14 ++++ .../RemoveGetParentClassNoArgsRectorTest.php | 28 +++++++ .../config/configured_rule.php | 13 +++ .../FuncCall/RemoveGetClassNoArgsRector.php | 81 +++++++++++++++++++ .../RemoveGetParentClassNoArgsRector.php | 81 +++++++++++++++++++ src/ValueObject/PhpVersionFeature.php | 6 ++ 14 files changed, 358 insertions(+) create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_different_func_call.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_with_args.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/RemoveGetClassNoArgsRectorTest.php create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_with_args.php.inc create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/RemoveGetParentClassNoArgsRectorTest.php create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/config/configured_rule.php create mode 100644 rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php create mode 100644 rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php diff --git a/config/set/php83.php b/config/set/php83.php index 357ec95be4e..ff9e27296bf 100644 --- a/config/set/php83.php +++ b/config/set/php83.php @@ -6,11 +6,15 @@ use Rector\Php83\Rector\ClassConst\AddTypeToConstRector; use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector; use Rector\Php83\Rector\FuncCall\CombineHostPortLdapUriRector; +use Rector\Php83\Rector\FuncCall\RemoveGetClassNoArgsRector; +use Rector\Php83\Rector\FuncCall\RemoveGetParentClassNoArgsRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->rules([ AddOverrideAttributeToOverriddenMethodsRector::class, AddTypeToConstRector::class, CombineHostPortLdapUriRector::class, + RemoveGetClassNoArgsRector::class, + RemoveGetParentClassNoArgsRector::class, ]); }; diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc new file mode 100644 index 00000000000..2fe8c4d8c0b --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_different_func_call.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_different_func_call.php.inc new file mode 100644 index 00000000000..3c1f8228220 --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_different_func_call.php.inc @@ -0,0 +1,11 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php new file mode 100644 index 00000000000..0722362d32f --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php @@ -0,0 +1,13 @@ +rule(RemoveGetClassNoArgsRector::class); + + $rectorConfig->phpVersion(PhpVersion::PHP_83); +}; diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc new file mode 100644 index 00000000000..47b761893b4 --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc new file mode 100644 index 00000000000..55b6be57c0b --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc @@ -0,0 +1,11 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/config/configured_rule.php b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/config/configured_rule.php new file mode 100644 index 00000000000..c8c0ef74127 --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/config/configured_rule.php @@ -0,0 +1,13 @@ +rule(RemoveGetParentClassNoArgsRector::class); + + $rectorConfig->phpVersion(PhpVersion::PHP_83); +}; diff --git a/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php new file mode 100644 index 00000000000..7461de7e451 --- /dev/null +++ b/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php @@ -0,0 +1,81 @@ +> + */ + public function getNodeTypes(): array + { + return [Node\Expr\FuncCall::class]; + } + + /** + * @param Node\Expr\FuncCall $node + */ + public function refactor(Node $node): ?Node + { + if ($node->isFirstClassCallable()) { + return null; + } + + if (! ($this->isName($node, 'get_class'))) { + return null; + } + + if (count($node->getArgs()) !== 0) { + return null; + } + + return new Node\Scalar\MagicConst\Class_(); + } + + public function provideMinPhpVersion(): int + { + return PhpVersionFeature::DEPRECATE_GET_CLASS_WITHOUT_ARGS; + } +} diff --git a/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php new file mode 100644 index 00000000000..686b77e4a35 --- /dev/null +++ b/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php @@ -0,0 +1,81 @@ +> + */ + public function getNodeTypes(): array + { + return [Node\Expr\FuncCall::class]; + } + + /** + * @param Node\Expr\FuncCall $node + */ + public function refactor(Node $node): ?Node + { + if ($node->isFirstClassCallable()) { + return null; + } + + if (! ($this->isName($node, 'get_parent_class'))) { + return null; + } + + if (count($node->getArgs()) !== 0) { + return null; + } + + return new Node\Expr\ClassConstFetch(new Node\Name(['parent']), new Node\VarLikeIdentifier('class')); + } + + public function provideMinPhpVersion(): int + { + return PhpVersionFeature::DEPRECATE_GET_CLASS_WITHOUT_ARGS; + } +} diff --git a/src/ValueObject/PhpVersionFeature.php b/src/ValueObject/PhpVersionFeature.php index 9013dbe0bc6..d88378cd29f 100644 --- a/src/ValueObject/PhpVersionFeature.php +++ b/src/ValueObject/PhpVersionFeature.php @@ -689,4 +689,10 @@ final class PhpVersionFeature * @var int */ public const DEPRECATE_HOST_PORT_SEPARATE_ARGS = PhpVersion::PHP_83; + + /** + * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.core.get-class + * @var int + */ + public const DEPRECATE_GET_CLASS_WITHOUT_ARGS = PhpVersion::PHP_83; } From 7134f0336d74c1255b1ca6ec98e9e86bb263d8e0 Mon Sep 17 00:00:00 2001 From: Chris Abbey Date: Wed, 30 Oct 2024 11:16:15 -0700 Subject: [PATCH 2/3] relocate reasoning docs to feature constant --- rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php | 2 -- .../Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php | 2 -- src/ValueObject/PhpVersionFeature.php | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php index 7461de7e451..cb1f52922a2 100644 --- a/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php +++ b/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php @@ -12,8 +12,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see https://php.watch/versions/8.3/get_class-get_parent_class-parameterless-deprecated - * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.core.get-class * @see \Rector\Tests\Php83\Rector\FuncCall\RemoveGetClassNoArgsRector\RemoveGetClassNoArgsRectorTest */ final class RemoveGetClassNoArgsRector extends AbstractRector implements MinPhpVersionInterface diff --git a/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php index 686b77e4a35..e0f60b0e285 100644 --- a/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php +++ b/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php @@ -12,8 +12,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** - * @see https://php.watch/versions/8.3/get_class-get_parent_class-parameterless-deprecated - * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.core.get-class * @see \Rector\Tests\Php83\Rector\FuncCall\RemoveGetParentClassNoArgsRector\RemoveGetParentClassNoArgsRectorTest */ final class RemoveGetParentClassNoArgsRector extends AbstractRector implements MinPhpVersionInterface diff --git a/src/ValueObject/PhpVersionFeature.php b/src/ValueObject/PhpVersionFeature.php index d88378cd29f..9940a51c135 100644 --- a/src/ValueObject/PhpVersionFeature.php +++ b/src/ValueObject/PhpVersionFeature.php @@ -692,6 +692,7 @@ final class PhpVersionFeature /** * @see https://www.php.net/manual/en/migration83.deprecated.php#migration83.deprecated.core.get-class + * @see https://php.watch/versions/8.3/get_class-get_parent_class-parameterless-deprecated * @var int */ public const DEPRECATE_GET_CLASS_WITHOUT_ARGS = PhpVersion::PHP_83; From 79a25e6b3e83db9ccc848d1aeabf7a339302a3cd Mon Sep 17 00:00:00 2001 From: Chris Abbey Date: Mon, 4 Nov 2024 13:45:47 -0800 Subject: [PATCH 3/3] combine the two rules into one --- config/set/php83.php | 6 +- .../Fixture/fixture_get_class.php.inc | 27 ++++++ .../Fixture/fixture_get_parent_class.php.inc} | 4 +- .../Fixture/skip_different_func_call.php.inc | 2 +- .../Fixture/skip_with_args.php.inc | 15 ++++ ...etClassGetParentClassNoArgsRectorTest.php} | 4 +- .../config/configured_rule.php | 4 +- .../Fixture/fixture.php.inc | 27 ------ .../Fixture/skip_with_args.php.inc | 14 --- .../RemoveGetClassNoArgsRectorTest.php | 28 ------ .../config/configured_rule.php | 13 --- .../Fixture/skip_different_func_call.php.inc | 11 --- .../Fixture/skip_with_args.php.inc | 14 --- ...moveGetClassGetParentClassNoArgsRector.php | 88 +++++++++++++++++++ .../FuncCall/RemoveGetClassNoArgsRector.php | 79 ----------------- .../RemoveGetParentClassNoArgsRector.php | 79 ----------------- 16 files changed, 139 insertions(+), 276 deletions(-) create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_class.php.inc rename rules-tests/Php83/Rector/FuncCall/{RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc => RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_parent_class.php.inc} (51%) rename rules-tests/Php83/Rector/FuncCall/{RemoveGetClassNoArgsRector => RemoveGetClassGetParentClassNoArgsRector}/Fixture/skip_different_func_call.php.inc (56%) create mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/skip_with_args.php.inc rename rules-tests/Php83/Rector/FuncCall/{RemoveGetParentClassNoArgsRector/RemoveGetParentClassNoArgsRectorTest.php => RemoveGetClassGetParentClassNoArgsRector/RemoveGetClassGetParentClassNoArgsRectorTest.php} (75%) rename rules-tests/Php83/Rector/FuncCall/{RemoveGetParentClassNoArgsRector => RemoveGetClassGetParentClassNoArgsRector}/config/configured_rule.php (59%) delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_with_args.php.inc delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/RemoveGetClassNoArgsRectorTest.php delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc delete mode 100644 rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_with_args.php.inc create mode 100644 rules/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector.php delete mode 100644 rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php delete mode 100644 rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php diff --git a/config/set/php83.php b/config/set/php83.php index ff9e27296bf..91a264d0c02 100644 --- a/config/set/php83.php +++ b/config/set/php83.php @@ -6,15 +6,13 @@ use Rector\Php83\Rector\ClassConst\AddTypeToConstRector; use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector; use Rector\Php83\Rector\FuncCall\CombineHostPortLdapUriRector; -use Rector\Php83\Rector\FuncCall\RemoveGetClassNoArgsRector; -use Rector\Php83\Rector\FuncCall\RemoveGetParentClassNoArgsRector; +use Rector\Php83\Rector\FuncCall\RemoveGetClassGetParentClassNoArgsRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->rules([ AddOverrideAttributeToOverriddenMethodsRector::class, AddTypeToConstRector::class, CombineHostPortLdapUriRector::class, - RemoveGetClassNoArgsRector::class, - RemoveGetParentClassNoArgsRector::class, + RemoveGetClassGetParentClassNoArgsRector::class, ]); }; diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_class.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_class.php.inc new file mode 100644 index 00000000000..4102c849034 --- /dev/null +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_class.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_parent_class.php.inc similarity index 51% rename from rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc rename to rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_parent_class.php.inc index 47b761893b4..daf6b9e8d83 100644 --- a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/fixture.php.inc +++ b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassGetParentClassNoArgsRector/Fixture/fixture_get_parent_class.php.inc @@ -1,6 +1,6 @@ rule(RemoveGetParentClassNoArgsRector::class); + $rectorConfig->rule(RemoveGetClassGetParentClassNoArgsRector::class); $rectorConfig->phpVersion(PhpVersion::PHP_83); }; diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc deleted file mode 100644 index 2fe8c4d8c0b..00000000000 --- a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/fixture.php.inc +++ /dev/null @@ -1,27 +0,0 @@ - ------ - diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_with_args.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_with_args.php.inc deleted file mode 100644 index c0f3a7cf18a..00000000000 --- a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/Fixture/skip_with_args.php.inc +++ /dev/null @@ -1,14 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php b/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php deleted file mode 100644 index 0722362d32f..00000000000 --- a/rules-tests/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector/config/configured_rule.php +++ /dev/null @@ -1,13 +0,0 @@ -rule(RemoveGetClassNoArgsRector::class); - - $rectorConfig->phpVersion(PhpVersion::PHP_83); -}; diff --git a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc b/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc deleted file mode 100644 index 55b6be57c0b..00000000000 --- a/rules-tests/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector/Fixture/skip_different_func_call.php.inc +++ /dev/null @@ -1,11 +0,0 @@ -> + */ + public function getNodeTypes(): array + { + return [Node\Expr\FuncCall::class]; + } + + /** + * @param Node\Expr\FuncCall $node + */ + public function refactor(Node $node): ?Node + { + if ($node->isFirstClassCallable()) { + return null; + } + + if (count($node->getArgs()) !== 0) { + return null; + } + + $target = null; + if ($this->isName($node, 'get_class')) { + $target = 'self'; + } + + if ($this->isName($node, 'get_parent_class')) { + $target = 'parent'; + } + + if ($target !== null) { + return new Node\Expr\ClassConstFetch(new Node\Name([$target]), new Node\VarLikeIdentifier('class')); + } + + return null; + } + + public function provideMinPhpVersion(): int + { + return PhpVersionFeature::DEPRECATE_GET_CLASS_WITHOUT_ARGS; + } +} diff --git a/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php deleted file mode 100644 index cb1f52922a2..00000000000 --- a/rules/Php83/Rector/FuncCall/RemoveGetClassNoArgsRector.php +++ /dev/null @@ -1,79 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Node\Expr\FuncCall::class]; - } - - /** - * @param Node\Expr\FuncCall $node - */ - public function refactor(Node $node): ?Node - { - if ($node->isFirstClassCallable()) { - return null; - } - - if (! ($this->isName($node, 'get_class'))) { - return null; - } - - if (count($node->getArgs()) !== 0) { - return null; - } - - return new Node\Scalar\MagicConst\Class_(); - } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::DEPRECATE_GET_CLASS_WITHOUT_ARGS; - } -} diff --git a/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php b/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php deleted file mode 100644 index e0f60b0e285..00000000000 --- a/rules/Php83/Rector/FuncCall/RemoveGetParentClassNoArgsRector.php +++ /dev/null @@ -1,79 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Node\Expr\FuncCall::class]; - } - - /** - * @param Node\Expr\FuncCall $node - */ - public function refactor(Node $node): ?Node - { - if ($node->isFirstClassCallable()) { - return null; - } - - if (! ($this->isName($node, 'get_parent_class'))) { - return null; - } - - if (count($node->getArgs()) !== 0) { - return null; - } - - return new Node\Expr\ClassConstFetch(new Node\Name(['parent']), new Node\VarLikeIdentifier('class')); - } - - public function provideMinPhpVersion(): int - { - return PhpVersionFeature::DEPRECATE_GET_CLASS_WITHOUT_ARGS; - } -}