diff --git a/bench/add_property_type_bucket_bench.php b/bench/add_property_type_bucket_bench.php deleted file mode 100644 index cf59055f05b..00000000000 --- a/bench/add_property_type_bucket_bench.php +++ /dev/null @@ -1,102 +0,0 @@ -create(); -$rectorConfig->boot(); - -/** @var TestingParser $testingParser */ -$testingParser = $rectorConfig->make(TestingParser::class); - -/** @var BetterNodeFinder $betterNodeFinder */ -$betterNodeFinder = $rectorConfig->make(BetterNodeFinder::class); - -$rector = $rectorConfig->make(AddPropertyTypeDeclarationRector::class); - -$addPropertyTypeDeclarations = []; -for ($i = 0; $i < ENTRIES; ++$i) { - $addPropertyTypeDeclarations[] = new AddPropertyTypeDeclaration('Bench\\SomeParent' . $i, 'oldProperty' . $i, new StringType()); -} - -$rector->configure($addPropertyTypeDeclarations); - -$source = "parseFileToDecoratedNodes($sourceFilePath); - -/** @var Property[] $properties */ -$properties = $betterNodeFinder->findInstanceOf($stmts, Property::class); - -$cpuSeconds = static function (): float { - $usage = getrusage(); - return $usage['ru_utime.tv_sec'] + $usage['ru_utime.tv_usec'] / 1_000_000 - + $usage['ru_stime.tv_sec'] + $usage['ru_stime.tv_usec'] / 1_000_000; -}; - -$run = static function () use ($rector, $properties): void { - foreach ($properties as $property) { - $rector->refactor($property); - } -}; - -// warm up autoloading/reflection caches once, excluded from timing -$run(); - -$wallStart = microtime(true); -$cpuStart = $cpuSeconds(); - -for ($repeat = 0; $repeat < REPEAT; ++$repeat) { - $run(); -} - -$cpu = $cpuSeconds() - $cpuStart; -$wall = microtime(true) - $wallStart; - -@unlink($sourceFilePath); - -$totalCalls = REPEAT * count($properties); - -printf('entries: %d, properties: %d, repeats: %d, refactor() calls: %d%s', ENTRIES, count($properties), REPEAT, $totalCalls, PHP_EOL); -printf('CPU: %.4f s (%.3f us/call)%s', $cpu, $cpu / $totalCalls * 1_000_000, PHP_EOL); -printf('wall: %.4f s%s', $wall, PHP_EOL); diff --git a/bench/remove_method_call_param_bucket_bench.php b/bench/remove_method_call_param_bucket_bench.php deleted file mode 100644 index 13108963536..00000000000 --- a/bench/remove_method_call_param_bucket_bench.php +++ /dev/null @@ -1,99 +0,0 @@ -create(); -$rectorConfig->boot(); - -/** @var TestingParser $testingParser */ -$testingParser = $rectorConfig->make(TestingParser::class); - -/** @var BetterNodeFinder $betterNodeFinder */ -$betterNodeFinder = $rectorConfig->make(BetterNodeFinder::class); - -$rector = $rectorConfig->make(RemoveMethodCallParamRector::class); - -$removeMethodCallParams = []; -for ($i = 0; $i < ENTRIES; ++$i) { - $removeMethodCallParams[] = new RemoveMethodCallParam('Bench\\SomeClass' . $i, 'oldMethod' . $i, 0); -} - -$rector->configure($removeMethodCallParams); - -$source = "freshCall{$i}(1, 2);\n"; -} - -$sourceFilePath = tempnam(sys_get_temp_dir(), 'bench_') . '.php'; -file_put_contents($sourceFilePath, $source); - -$stmts = $testingParser->parseFileToDecoratedNodes($sourceFilePath); - -/** @var MethodCall[] $methodCalls */ -$methodCalls = $betterNodeFinder->findInstanceOf($stmts, MethodCall::class); - -$cpuSeconds = static function (): float { - $usage = getrusage(); - return $usage['ru_utime.tv_sec'] + $usage['ru_utime.tv_usec'] / 1_000_000 - + $usage['ru_stime.tv_sec'] + $usage['ru_stime.tv_usec'] / 1_000_000; -}; - -$run = static function () use ($rector, $methodCalls): void { - foreach ($methodCalls as $methodCall) { - $rector->refactor($methodCall); - } -}; - -// warm up autoloading/reflection caches once, excluded from timing -$run(); - -$wallStart = microtime(true); -$cpuStart = $cpuSeconds(); - -for ($repeat = 0; $repeat < REPEAT; ++$repeat) { - $run(); -} - -$cpu = $cpuSeconds() - $cpuStart; -$wall = microtime(true) - $wallStart; - -@unlink($sourceFilePath); - -$totalCalls = REPEAT * count($methodCalls); - -printf('entries: %d, calls: %d, repeats: %d, refactor() calls: %d%s', ENTRIES, count($methodCalls), REPEAT, $totalCalls, PHP_EOL); -printf('CPU: %.4f s (%.3f us/call)%s', $cpu, $cpu / $totalCalls * 1_000_000, PHP_EOL); -printf('wall: %.4f s%s', $wall, PHP_EOL); diff --git a/bench/transform_funccall_to_staticcall_bucket_bench.php b/bench/transform_funccall_to_staticcall_bucket_bench.php deleted file mode 100644 index 7a8dbe5052e..00000000000 --- a/bench/transform_funccall_to_staticcall_bucket_bench.php +++ /dev/null @@ -1,100 +0,0 @@ -create(); -$rectorConfig->boot(); - -/** @var TestingParser $testingParser */ -$testingParser = $rectorConfig->make(TestingParser::class); - -/** @var BetterNodeFinder $betterNodeFinder */ -$betterNodeFinder = $rectorConfig->make(BetterNodeFinder::class); - -$rector = $rectorConfig->make(FuncCallToStaticCallRector::class); - -$funcCallsToStaticCalls = []; -for ($i = 0; $i < RENAMES; ++$i) { - $funcCallsToStaticCalls[] = new FuncCallToStaticCall('old_function_' . $i, 'Bench\\SomeClass' . $i, 'method' . $i); -} - -$rector->configure($funcCallsToStaticCalls); - -$source = "parseFileToDecoratedNodes($sourceFilePath); - -/** @var FuncCall[] $funcCalls */ -$funcCalls = $betterNodeFinder->findInstanceOf($stmts, FuncCall::class); - -$cpuSeconds = static function (): float { - $usage = getrusage(); - return $usage['ru_utime.tv_sec'] + $usage['ru_utime.tv_usec'] / 1_000_000 - + $usage['ru_stime.tv_sec'] + $usage['ru_stime.tv_usec'] / 1_000_000; -}; - -$run = static function () use ($rector, $funcCalls): void { - foreach ($funcCalls as $funcCall) { - $rector->refactor($funcCall); - } -}; - -// warm up autoloading/reflection caches once, excluded from timing -$run(); - -$wallStart = microtime(true); -$cpuStart = $cpuSeconds(); - -for ($repeat = 0; $repeat < REPEAT; ++$repeat) { - $run(); -} - -$cpu = $cpuSeconds() - $cpuStart; -$wall = microtime(true) - $wallStart; - -@unlink($sourceFilePath); - -$totalCalls = REPEAT * count($funcCalls); - -printf('entries: %d, calls: %d, repeats: %d, refactor() calls: %d%s', RENAMES, count($funcCalls), REPEAT, $totalCalls, PHP_EOL); -printf('CPU: %.4f s (%.3f us/call)%s', $cpu, $cpu / $totalCalls * 1_000_000, PHP_EOL); -printf('wall: %.4f s%s', $wall, PHP_EOL); diff --git a/phpstan-deprecated.neon b/phpstan-deprecated.neon index 40506644177..c7a57b54209 100644 --- a/phpstan-deprecated.neon +++ b/phpstan-deprecated.neon @@ -1,11 +1,6 @@ # deprecated code kept temporarily, ignores to drop once the deprecated API is removed parameters: ignoreErrors: - - - message: '#^Unused Rector\\Arguments\\ValueObject\\ReplaceArgumentDefaultValue\:\:(.*?)$#' - identifier: shipmonk.deadMethod - path: rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php - # the deprecated set objects are still resolved internally, until every extension bonds its rules - message: '#deprecated (class|interface) Rector\\(Set|Bridge)\\#' diff --git a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php b/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php deleted file mode 100644 index 4d9c2ecda61..00000000000 --- a/rules/Arguments/Rector/ClassMethod/ReplaceArgumentDefaultValueRector.php +++ /dev/null @@ -1,69 +0,0 @@ -someMethod(SomeClass::OLD_CONSTANT); -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -$someObject = new SomeClass; -$someObject->someMethod(false); -CODE_SAMPLE - , - [ - new ReplaceArgumentDefaultValue( - 'SomeClass', - 'someMethod', - 0, - 'SomeClass::OLD_CONSTANT', - false - ), - ] - ), - ] - ); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [MethodCall::class, StaticCall::class, ClassMethod::class, New_::class]; - } - - /** - * @param MethodCall|StaticCall|ClassMethod|New_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf('"%s" rule is deprecated, write a dedicated custom Rector rule instead', self::class)); - } -} diff --git a/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php b/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php deleted file mode 100644 index 6445e7b1865..00000000000 --- a/rules/Arguments/Rector/FuncCall/FunctionArgumentDefaultValueReplacerRector.php +++ /dev/null @@ -1,53 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [FuncCall::class]; - } - - /** - * @param FuncCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf('"%s" rule is deprecated, write a dedicated custom Rector rule instead', self::class)); - } -} diff --git a/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php b/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php deleted file mode 100644 index a13bae490e5..00000000000 --- a/rules/Arguments/Rector/MethodCall/RemoveMethodCallParamRector.php +++ /dev/null @@ -1,66 +0,0 @@ -process(1, 2); - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function run(Caller $caller) - { - $caller->process(1); - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [MethodCall::class, StaticCall::class]; - } - - /** - * @param MethodCall|StaticCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and generic. Use a specific rule instead', - self::class - )); - } -} diff --git a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php deleted file mode 100644 index 66a30652aa2..00000000000 --- a/rules/Arguments/ValueObject/ReplaceArgumentDefaultValue.php +++ /dev/null @@ -1,52 +0,0 @@ - $position - */ - public function __construct( - private string $class, - private string $method, - private int $position, - private mixed $valueBefore, - private mixed $valueAfter - ) { - RectorAssert::className($class); - } - - public function getObjectType(): ObjectType - { - return new ObjectType($this->class); - } - - public function getMethod(): string - { - return $this->method; - } - - public function getPosition(): int - { - return $this->position; - } - - public function getValueBefore(): mixed - { - return $this->valueBefore; - } - - public function getValueAfter(): mixed - { - return $this->valueAfter; - } -} diff --git a/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php b/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php deleted file mode 100644 index 0af73f8ef58..00000000000 --- a/rules/CodeQuality/Rector/Class_/CompleteDynamicPropertiesRector.php +++ /dev/null @@ -1,70 +0,0 @@ -value = 5; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -class SomeClass -{ - /** - * @var int - */ - public $value; - - public function set() - { - $this->value = 5; - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [Class_::class]; - } - - /** - * @param Class_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as it can create invalid properties on classes with partial type information', - self::class - )); - } -} diff --git a/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php b/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php deleted file mode 100644 index 6e34b2b0b81..00000000000 --- a/rules/CodeQuality/Rector/Expression/TernaryFalseExpressionToIfRector.php +++ /dev/null @@ -1,65 +0,0 @@ -call($value) : false; - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function run($value, $someMethod) - { - if ($value) { - $someMethod->call($value); - } - } -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [Expression::class]; - } - - /** - * @param Expression $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf('"%s" rule is deprecated, as too niche for wide application', self::class)); - } -} diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector.php deleted file mode 100644 index e9dc2886133..00000000000 --- a/rules/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector.php +++ /dev/null @@ -1,78 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Class_::class]; - } - - /** - * @param Class_ $node - */ - public function refactor(Node $node): ?Class_ - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as removing a delegating constructor is risky and such constructors are nearly always kept on purpose', - self::class - )); - } -} diff --git a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php b/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php deleted file mode 100644 index f11d38fe30e..00000000000 --- a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php +++ /dev/null @@ -1,80 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class]; - } - - /** - * @param ClassMethod|Function_|Closure $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated in favor of RemoveAlwaysTrueIfConditionRector', - self::class - )); - } -} diff --git a/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php b/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php deleted file mode 100644 index 02970dd8649..00000000000 --- a/rules/EarlyReturn/Rector/StmtsAwareInterface/ReturnEarlyIfVariableRector.php +++ /dev/null @@ -1,71 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return NodeGroup::STMTS_AWARE; - } - - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and can reduce readability', - self::class - )); - } -} diff --git a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php b/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php deleted file mode 100644 index 7676cf9b54e..00000000000 --- a/rules/Php83/Rector/ClassMethod/AddOverrideAttributeToOverriddenMethodsRector.php +++ /dev/null @@ -1,92 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Class_::class]; - } - - /** - * @param Class_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as never used and not part of any set. Apply the #[\Override] attribute explicitly on the methods that override, based on your own requirements', - self::class - )); - } - - public function provideMinPhpVersion(): int - { - return PhpVersion::PHP_83; - } -} diff --git a/rules/Removing/Rector/Class_/RemoveTraitUseRector.php b/rules/Removing/Rector/Class_/RemoveTraitUseRector.php deleted file mode 100644 index bed1a6f8ac6..00000000000 --- a/rules/Removing/Rector/Class_/RemoveTraitUseRector.php +++ /dev/null @@ -1,69 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Class_::class, Trait_::class]; - } - - /** - * @param Class_|Trait_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php b/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php deleted file mode 100644 index 60f9a5fd120..00000000000 --- a/rules/Renaming/Rector/StaticCall/RenameStaticMethodRector.php +++ /dev/null @@ -1,58 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [StaticCall::class]; - } - - /** - * @param StaticCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Renaming/ValueObject/RenameStaticMethod.php b/rules/Renaming/ValueObject/RenameStaticMethod.php deleted file mode 100644 index 7cb3716e65e..00000000000 --- a/rules/Renaming/ValueObject/RenameStaticMethod.php +++ /dev/null @@ -1,52 +0,0 @@ -oldClass); - } - - public function getOldMethod(): string - { - return $this->oldMethod; - } - - public function getNewClass(): string - { - return $this->newClass; - } - - public function getNewMethod(): string - { - return $this->newMethod; - } - - public function hasClassChanged(): bool - { - return $this->oldClass !== $this->newClass; - } -} diff --git a/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php b/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php deleted file mode 100644 index 2761be2cb3c..00000000000 --- a/rules/Transform/Rector/FuncCall/FuncCallToNewRector.php +++ /dev/null @@ -1,77 +0,0 @@ - 'Collection', - ] - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [FuncCall::class]; - } - - /** - * @param FuncCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php b/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php deleted file mode 100644 index 71c089a7d90..00000000000 --- a/rules/Transform/Rector/FuncCall/FuncCallToStaticCallRector.php +++ /dev/null @@ -1,58 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [FuncCall::class]; - } - - /** - * @param FuncCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Transform/Rector/String_/StringToClassConstantRector.php b/rules/Transform/Rector/String_/StringToClassConstantRector.php deleted file mode 100644 index e18b0c817dc..00000000000 --- a/rules/Transform/Rector/String_/StringToClassConstantRector.php +++ /dev/null @@ -1,76 +0,0 @@ - 'compile']; - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeSubscriber -{ - public static function getSubscribedEvents() - { - return [\Yet\AnotherClass::CONSTANT => 'compile']; - } -} -CODE_SAMPLE - , - [new StringToClassConstant('compiler.post_dump', 'Yet\AnotherClass', 'CONSTANT')] - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [String_::class]; - } - - /** - * @param String_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Transform/ValueObject/FuncCallToStaticCall.php b/rules/Transform/ValueObject/FuncCallToStaticCall.php deleted file mode 100644 index a203517e4dc..00000000000 --- a/rules/Transform/ValueObject/FuncCallToStaticCall.php +++ /dev/null @@ -1,39 +0,0 @@ -oldFuncName; - } - - public function getNewClassName(): string - { - return $this->newClassName; - } - - public function getNewMethodName(): string - { - return $this->newMethodName; - } -} diff --git a/rules/Transform/ValueObject/StringToClassConstant.php b/rules/Transform/ValueObject/StringToClassConstant.php index dc8de619ed1..6a6469aeddd 100644 --- a/rules/Transform/ValueObject/StringToClassConstant.php +++ b/rules/Transform/ValueObject/StringToClassConstant.php @@ -7,7 +7,7 @@ use Rector\Validation\RectorAssert; /** - * @api used in deprecated StringToClassConstantRector configs + * @api used in rector-laravel */ final readonly class StringToClassConstant { diff --git a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php b/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php deleted file mode 100644 index 51a7353b0fe..00000000000 --- a/rules/TypeDeclaration/Rector/BooleanAnd/BinaryOpNullableToInstanceofRector.php +++ /dev/null @@ -1,69 +0,0 @@ -someMethod()) { - return 'yes'; - } - - return 'no'; -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -function someFunction(?SomeClass $someClass) -{ - if ($someClass instanceof SomeClass && $someClass->someMethod()) { - return 'yes'; - } - - return 'no'; -} -CODE_SAMPLE - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [BooleanAnd::class, BooleanOr::class]; - } - - /** - * @param BooleanAnd|BooleanOr $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, use ExplicitNullableObjectInstanceRector instead', - self::class - )); - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddParamStringTypeFromSprintfUseRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddParamStringTypeFromSprintfUseRector.php deleted file mode 100644 index 0dc32d51d55..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddParamStringTypeFromSprintfUseRector.php +++ /dev/null @@ -1,70 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [ClassMethod::class, Function_::class, Closure::class, ArrowFunction::class]; - } - - /** - * @param ClassMethod|Function_|Closure|ArrowFunction $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as sprintf masks convert int/float arguments to string and would add an invalid param type', - self::class - )); - } -} diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php deleted file mode 100644 index eea0180c536..00000000000 --- a/rules/TypeDeclaration/Rector/ClassMethod/ParamTypeByParentCallTypeRector.php +++ /dev/null @@ -1,77 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Class_::class]; - } - - /** - * @param Class_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf('"%s" rule is deprecated', self::class)); - } -} diff --git a/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php deleted file mode 100644 index c88320988cc..00000000000 --- a/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php +++ /dev/null @@ -1,72 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Property::class]; - } - - /** - * @param Property $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and part of no set; write a custom rule for the exact project case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php deleted file mode 100644 index 69d4310ac26..00000000000 --- a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php +++ /dev/null @@ -1,37 +0,0 @@ -class; - } - - public function getPropertyName(): string - { - return $this->propertyName; - } - - public function getType(): Type - { - return $this->type; - } -} diff --git a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php b/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php deleted file mode 100644 index 806203da9c3..00000000000 --- a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php +++ /dev/null @@ -1,70 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [Class_::class, Interface_::class]; - } - - /** - * @param Class_|Interface_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and risky. Use a custom rule to handle your case instead', - self::class - )); - } -}