diff --git a/config/level/php/php72.yml b/config/level/php/php72.yml index b40dd055c24..6651b700f30 100644 --- a/config/level/php/php72.yml +++ b/config/level/php/php72.yml @@ -1,3 +1,4 @@ services: Rector\Php\Rector\While_\WhileEachToForeachRector: ~ Rector\Php\Rector\Each\ListEachRector: ~ + Rector\Php\Rector\Unset_\UnsetCastRector: ~ diff --git a/ecs.yml b/ecs.yml index e1a120225f7..4a6fe61ef05 100644 --- a/ecs.yml +++ b/ecs.yml @@ -105,6 +105,7 @@ parameters: - '*Command.php' - '*NodeVisitor.php' - '*CompilerPass.php' + - 'packages/Php/src/Rector/Unset_/UnsetCastRector.php' # array type check - 'src/RectorDefinition/RectorDefinition.php' diff --git a/packages/Php/src/Rector/Unset_/UnsetCastRector.php b/packages/Php/src/Rector/Unset_/UnsetCastRector.php new file mode 100644 index 00000000000..afc8fb6537b --- /dev/null +++ b/packages/Php/src/Rector/Unset_/UnsetCastRector.php @@ -0,0 +1,45 @@ +doTestFileMatchesExpectedContent($wrong, $fixed); + } + + public function provideWrongToFixedFiles(): Iterator + { + yield [__DIR__ . '/Wrong/wrong.php.inc', __DIR__ . '/Correct/correct.php.inc']; + } + + protected function provideConfig(): string + { + return __DIR__ . '/config.yml'; + } +} diff --git a/packages/Php/tests/Rector/Unset_/UnsetCastRector/Wrong/wrong.php.inc b/packages/Php/tests/Rector/Unset_/UnsetCastRector/Wrong/wrong.php.inc new file mode 100644 index 00000000000..d37fc4b56eb --- /dev/null +++ b/packages/Php/tests/Rector/Unset_/UnsetCastRector/Wrong/wrong.php.inc @@ -0,0 +1,4 @@ +