diff --git a/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php b/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php deleted file mode 100644 index 63175082f2a..00000000000 --- a/rules/Transform/Rector/ArrayDimFetch/ArrayDimFetchToMethodCallRector.php +++ /dev/null @@ -1,53 +0,0 @@ -get('key'); -CODE_SAMPLE - ), - ]); - } - - public function getNodeTypes(): array - { - return [Assign::class, Isset_::class, Unset_::class, ArrayDimFetch::class]; - } - - /** - * @param Assign|Isset_|Unset_|ArrayDimFetch $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and never used. Use a specific rule instead', - self::class - )); - } -} diff --git a/rules/Transform/Rector/Class_/MergeInterfacesRector.php b/rules/Transform/Rector/Class_/MergeInterfacesRector.php deleted file mode 100644 index a5e3b7d7708..00000000000 --- a/rules/Transform/Rector/Class_/MergeInterfacesRector.php +++ /dev/null @@ -1,69 +0,0 @@ - 'SomeInterface', - ] - ), - ]); - } - - /** - * @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 too niche and never used; use a custom rule scoped to your exact case instead', - self::class - )); - } - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - } -} diff --git a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php b/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php deleted file mode 100644 index 28d220346e4..00000000000 --- a/rules/Transform/Rector/ConstFetch/ConstFetchToClassConstFetchRector.php +++ /dev/null @@ -1,54 +0,0 @@ -render('some_template'); - } -} -CODE_SAMPLE - - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - public function show() - { - return view('some_template'); - } -} -CODE_SAMPLE - , - [new MethodCallToFuncCall('SomeClass', 'render', 'view')] - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [MethodCall::class]; - } - - /** - * @param MethodCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as changing a method call to a function call is niche and depends on project context; 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/MethodCall/MethodCallToStaticCallRector.php b/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php deleted file mode 100644 index 1b7d1a5ebbc..00000000000 --- a/rules/Transform/Rector/MethodCall/MethodCallToStaticCallRector.php +++ /dev/null @@ -1,90 +0,0 @@ -anotherDependency = $anotherDependency; - } - - public function loadConfiguration() - { - return $this->anotherDependency->process('value'); - } -} -CODE_SAMPLE - , - <<<'CODE_SAMPLE' -final class SomeClass -{ - private $anotherDependency; - - public function __construct(AnotherDependency $anotherDependency) - { - $this->anotherDependency = $anotherDependency; - } - - public function loadConfiguration() - { - return StaticCaller::anotherMethod('value'); - } -} -CODE_SAMPLE - , - [new MethodCallToStaticCall('AnotherDependency', 'process', 'StaticCaller', 'anotherMethod')] - ), - ]); - } - - /** - * @return array> - */ - public function getNodeTypes(): array - { - return [MethodCall::class]; - } - - /** - * @param MethodCall $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as turning a method call into a static call depends on project context; 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/New_/NewToStaticCallRector.php b/rules/Transform/Rector/New_/NewToStaticCallRector.php deleted file mode 100644 index 5511bdd8fe3..00000000000 --- a/rules/Transform/Rector/New_/NewToStaticCallRector.php +++ /dev/null @@ -1,65 +0,0 @@ -> - */ - public function getNodeTypes(): array - { - return [New_::class]; - } - - /** - * @param New_ $node - */ - public function refactor(Node $node): ?Node - { - throw new ShouldNotHappenException(sprintf( - '"%s" rule is deprecated, as too niche and never used. Write a custom rule for the exact project case instead', - self::class - )); - } -} diff --git a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php b/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php deleted file mode 100644 index 53d21553326..00000000000 --- a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php +++ /dev/null @@ -1,97 +0,0 @@ -smartFileSystem = $smartFileSystem; - } - - public function run() - { - return $this->smartFileSystem->dumpFile('file', 'content'); - } -} -CODE_SAMPLE - , - [ - new StaticCallToMethodCall( - 'Nette\Utils\FileSystem', - 'write', - 'App\Custom\SmartFileSystem', - 'dumpFile' - ), - ] - ), - ]); - } - - /** - * @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 passing a service through the constructor to replace a static call is risky; 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/ConstFetchToClassConstFetch.php b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php deleted file mode 100644 index c9079318c2f..00000000000 --- a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php +++ /dev/null @@ -1,38 +0,0 @@ -oldConstName); - RectorAssert::className($this->newClassName); - RectorAssert::constantName($this->newConstName); - } - - public function getOldConstName(): string - { - return $this->oldConstName; - } - - public function getNewClassName(): string - { - return $this->newClassName; - } - - public function getNewConstName(): string - { - return $this->newConstName; - } -} diff --git a/rules/Transform/ValueObject/MethodCallToFuncCall.php b/rules/Transform/ValueObject/MethodCallToFuncCall.php deleted file mode 100644 index eb1582cccef..00000000000 --- a/rules/Transform/ValueObject/MethodCallToFuncCall.php +++ /dev/null @@ -1,33 +0,0 @@ -objectType; - } - - public function getMethodName(): string - { - return $this->methodName; - } - - public function getFunctionName(): string - { - return $this->functionName; - } -} diff --git a/rules/Transform/ValueObject/MethodCallToStaticCall.php b/rules/Transform/ValueObject/MethodCallToStaticCall.php deleted file mode 100644 index 7996fc5e173..00000000000 --- a/rules/Transform/ValueObject/MethodCallToStaticCall.php +++ /dev/null @@ -1,47 +0,0 @@ -oldClass); - } - - public function getOldMethod(): string - { - return $this->oldMethod; - } - - public function getNewClass(): string - { - return $this->newClass; - } - - public function getNewMethod(): string - { - return $this->newMethod; - } -} diff --git a/rules/Transform/ValueObject/StaticCallToMethodCall.php b/rules/Transform/ValueObject/StaticCallToMethodCall.php deleted file mode 100644 index 693d3c27697..00000000000 --- a/rules/Transform/ValueObject/StaticCallToMethodCall.php +++ /dev/null @@ -1,76 +0,0 @@ -classType); - } - - public function getClassType(): string - { - return $this->classType; - } - - public function getMethodName(): string - { - return $this->methodName; - } - - public function isStaticCallMatch(StaticCall $staticCall): bool - { - if (! $staticCall->class instanceof Name) { - return false; - } - - $staticCallClassName = $staticCall->class->toString(); - if ($staticCallClassName !== $this->staticClass) { - return false; - } - - if (! $staticCall->name instanceof Identifier) { - return false; - } - - // all methods - if ($this->staticMethod === '*') { - return true; - } - - $staticCallMethodName = $staticCall->name->toString(); - return $staticCallMethodName === $this->staticMethod; - } -}