diff --git a/config/set/downgrade-php73.php b/config/set/downgrade-php73.php index d64935ca0da4..6fd54b9cc090 100644 --- a/config/set/downgrade-php73.php +++ b/config/set/downgrade-php73.php @@ -2,11 +2,10 @@ declare(strict_types=1); -use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCalls; -use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntax; +use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(DowngradeFlexibleHeredocSyntax::class); + $services->set(DowngradeTrailingCommasInFunctionCallsRector::class); }; diff --git a/rules/downgrade-php73/src/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php b/rules/downgrade-php73/src/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php new file mode 100644 index 000000000000..27d944da1438 --- /dev/null +++ b/rules/downgrade-php73/src/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php @@ -0,0 +1,66 @@ +setAttribute(AttributeKey::ORIGINAL_NODE, null); + return $node; + } +} diff --git a/rules/downgrade-php73/src/Rector/String_/DowngradeFlexibleHeredocSyntax.php b/rules/downgrade-php73/src/Rector/String_/DowngradeFlexibleHeredocSyntax.php deleted file mode 100644 index fadd5a45ff80..000000000000 --- a/rules/downgrade-php73/src/Rector/String_/DowngradeFlexibleHeredocSyntax.php +++ /dev/null @@ -1,70 +0,0 @@ -getAttribute(AttributeKey::KIND), [String_::KIND_HEREDOC, String_::KIND_NOWDOC], true)) { - return null; - } - - $node->setAttribute('docIndentation', ''); - $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); - - return $node; - } -} diff --git a/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/DowngradeTrailingCommasInFunctionCallsRectorTest.php b/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/DowngradeTrailingCommasInFunctionCallsRectorTest.php new file mode 100644 index 000000000000..1685dd3abc88 --- /dev/null +++ b/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/DowngradeTrailingCommasInFunctionCallsRectorTest.php @@ -0,0 +1,40 @@ += 7.3 + * @dataProvider provideData() + */ + public function test(SmartFileInfo $fileInfo): void + { + $this->doTestFileInfo($fileInfo); + } + + public function provideData(): Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + protected function getRectorClass(): string + { + return DowngradeTrailingCommasInFunctionCallsRector::class; + } + + protected function getPhpVersion(): string + { + return '7.2'; +// TODO: create constant +// return PhpVersionFeature::; + } +} diff --git a/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/Fixture/fixture.php.inc b/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/Fixture/fixture.php.inc new file mode 100644 index 000000000000..99c2eadddf33 --- /dev/null +++ b/rules/downgrade-php73/tests/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector/Fixture/fixture.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/DowngradeFlexibleHeredocSyntaxTest.php b/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/DowngradeFlexibleHeredocSyntaxTest.php deleted file mode 100644 index e72c2d718f2f..000000000000 --- a/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/DowngradeFlexibleHeredocSyntaxTest.php +++ /dev/null @@ -1,31 +0,0 @@ -doTestFileInfo($fileInfo); - } - - public function provideData(): Iterator - { - return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - protected function getRectorClass(): string - { - return DowngradeFlexibleHeredocSyntax::class; - } -} diff --git a/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/Fixture/fixture.php.inc b/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/Fixture/fixture.php.inc deleted file mode 100644 index 5c6151045cb7..000000000000 --- a/rules/downgrade-php73/tests/Rector/String_/DowngradeFlexibleHeredocSyntax/Fixture/fixture.php.inc +++ /dev/null @@ -1,35 +0,0 @@ - ------ -