diff --git a/config/v11/tca-110.php b/config/v11/tca-110.php new file mode 100644 index 000000000..502789023 --- /dev/null +++ b/config/v11/tca-110.php @@ -0,0 +1,11 @@ +import(__DIR__ . '/../config.php'); + $rectorConfig->rule(RemoveWorkspacePlaceholderShadowColumnsConfigurationRector::class); +}; diff --git a/src/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector.php b/src/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector.php new file mode 100644 index 000000000..58be2dec9 --- /dev/null +++ b/src/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector.php @@ -0,0 +1,58 @@ + [ + 'shadowColumnsForNewPlaceholders' => '', + 'shadowColumnsForMovePlaceholders' => '', + ], +]; +CODE_SAMPLE + , + <<<'CODE_SAMPLE' +return [ + 'ctrl' => [ + ], +]; +CODE_SAMPLE + )]); + } + + protected function refactorCtrl(Array_ $ctrlArray): void + { + $shadowColumnsForNewPlaceholdersArrayItem = $this->extractArrayItemByKey($ctrlArray, 'shadowColumnsForNewPlaceholders'); + if ($shadowColumnsForNewPlaceholdersArrayItem instanceof ArrayItem) { + $this->removeNode($shadowColumnsForNewPlaceholdersArrayItem); + $this->hasAstBeenChanged = true; + } + + $shadowColumnsForMovePlaceholdersArrayItem = $this->extractArrayItemByKey($ctrlArray, 'shadowColumnsForMovePlaceholders'); + if ($shadowColumnsForMovePlaceholdersArrayItem instanceof ArrayItem) { + $this->removeNode($shadowColumnsForMovePlaceholdersArrayItem); + $this->hasAstBeenChanged = true; + } + } +} diff --git a/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/Fixture/fixture.php.inc b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/Fixture/fixture.php.inc new file mode 100644 index 000000000..94411539b --- /dev/null +++ b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/Fixture/fixture.php.inc @@ -0,0 +1,22 @@ + [ + 'shadowColumnsForNewPlaceholders' => '', + 'shadowColumnsForMovePlaceholders' => '', + ], + 'columns' => [], +]; +?> +----- + [], + 'columns' => [], +]; +?> diff --git a/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/RemoveWorkspacePlaceholderShadowColumnsConfigurationRectorTest.php b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/RemoveWorkspacePlaceholderShadowColumnsConfigurationRectorTest.php new file mode 100644 index 000000000..c666f47da --- /dev/null +++ b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/RemoveWorkspacePlaceholderShadowColumnsConfigurationRectorTest.php @@ -0,0 +1,32 @@ +doTestFile($filePath); + } + + /** + * @return Iterator> + */ + public function provideData(): Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/config/configured_rule.php b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/config/configured_rule.php new file mode 100644 index 000000000..030889ad4 --- /dev/null +++ b/tests/Rector/v11/v0/tca/RemoveWorkspacePlaceholderShadowColumnsConfigurationRector/config/configured_rule.php @@ -0,0 +1,11 @@ +import(__DIR__ . '/../../../../../../../config/config_test.php'); + $rectorConfig->rule(RemoveWorkspacePlaceholderShadowColumnsConfigurationRector::class); +};