diff --git a/src/NodeVisitor/UpgradeDeprecation/AbstraceReplaceDeprecatedConstantNodeVisitor.php b/src/NodeVisitor/UpgradeDeprecation/AbstraceReplaceDeprecatedConstantNodeVisitor.php deleted file mode 100644 index e2182e9b7d3..00000000000 --- a/src/NodeVisitor/UpgradeDeprecation/AbstraceReplaceDeprecatedConstantNodeVisitor.php +++ /dev/null @@ -1,49 +0,0 @@ -isCandidate($node)) { - $this->refactor($node); - return NodeTraverser::DONT_TRAVERSE_CHILDREN; - } - - return null; - } - - private function isCandidate(Node $node): bool - { - if ($node instanceof ClassConstFetch) { - if ((string) $node->class !== $this->getClassName()) { - return false; - } - - if ((string) $node->name !== $this->getOldConstantName()) { - return false; - } - - return true; - } - - return false; - } - - private function refactor(ClassConstFetch $classConstFetchNode): void - { - $classConstFetchNode->name->name = $this->getNewConstantName(); - } -} diff --git a/src/Rector/Contrib/Nette/NetteObjectToSmartTraitRector.php b/src/Rector/Contrib/Nette/NetteObjectToSmartTraitRector.php index 01eb3bedc49..82c99655ce0 100644 --- a/src/Rector/Contrib/Nette/NetteObjectToSmartTraitRector.php +++ b/src/Rector/Contrib/Nette/NetteObjectToSmartTraitRector.php @@ -11,7 +11,7 @@ use Rector\Deprecation\SetNames; use Rector\Rector\AbstractRector; /** - * Reflects @link https://doc.nette.org/en/2.4/migration-2-4#toc-nette-smartobject + * Covers https://doc.nette.org/en/2.4/migration-2-4#toc-nette-smartobject */ final class NetteObjectToSmartTraitRector extends AbstractRector { diff --git a/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php b/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php new file mode 100644 index 00000000000..55614ea0739 --- /dev/null +++ b/src/Rector/Contrib/Nette/RemoveConfiguratorConstantsRector.php @@ -0,0 +1,49 @@ +class !== 'Nette\Configurator') { + return false; + } + + if (! in_array((string) $node->name, ['DEVELOPMENT', 'PRODUCTION'], true)) { + return false; + } + + return true; + } + + return false; + } + + /** + * @param ClassConstFetch $classConstFetchNode + */ + public function refactor($classConstFetchNode): void + { + dump($classConstFetchNode->name->name); + die; + + $classConstFetchNode->name->name = $this->getNewConstantName(); + } + + public function getSetName(): string + { + return SetNames::NETTE; + } + + public function sinceVersion(): float + { + return 2.3; + } +} diff --git a/src/Testing/PHPUnit/AbstractReconstructorTestCase.php b/src/Testing/PHPUnit/AbstractReconstructorTestCase.php index f3dcce41136..730ad2629e3 100644 --- a/src/Testing/PHPUnit/AbstractReconstructorTestCase.php +++ b/src/Testing/PHPUnit/AbstractReconstructorTestCase.php @@ -22,7 +22,7 @@ abstract class AbstractReconstructorTestCase extends TestCase protected function setUp(): void { - $this->container = (new ContainerFactory)->createWithConfig(__DIR__ . '/../../../tests/config/services.yml'); + $this->container = (new ContainerFactory)->create(); $this->fileReconstructor = $this->container->get(FileReconstructor::class); } diff --git a/tests/NodeVisitor/UpgradeDeprecation/ReplaceDeprecatedConstantNodeVisitor/ReplaceOldConstantNodeVisitor.php b/tests/NodeVisitor/UpgradeDeprecation/ReplaceDeprecatedConstantNodeVisitor/ReplaceOldConstantNodeVisitor.php deleted file mode 100644 index c9e5e5bcece..00000000000 --- a/tests/NodeVisitor/UpgradeDeprecation/ReplaceDeprecatedConstantNodeVisitor/ReplaceOldConstantNodeVisitor.php +++ /dev/null @@ -1,23 +0,0 @@ -