diff --git a/config/v12/typo3-120.php b/config/v12/typo3-120.php index d6ef5092c..1f3d9cadd 100644 --- a/config/v12/typo3-120.php +++ b/config/v12/typo3-120.php @@ -18,6 +18,7 @@ use Ssch\TYPO3Rector\TYPO312\v0\MigrateFetchToFetchAssociativeRector; use Ssch\TYPO3Rector\TYPO312\v0\MigrateQueryBuilderExecuteRector; use Ssch\TYPO3Rector\TYPO312\v0\MoveAllowTableOnStandardPagesToTCAConfigurationRector; +use Ssch\TYPO3Rector\TYPO312\v0\RemoveAddLLrefForTCAdescrMethodCallRector; use Ssch\TYPO3Rector\TYPO312\v0\RemoveMailerAdapterInterfaceRector; use Ssch\TYPO3Rector\TYPO312\v0\RemoveRelativeToCurrentScriptArgumentsRector; use Ssch\TYPO3Rector\TYPO312\v0\RemoveTSFEConvOutputCharsetCallsRector; @@ -173,4 +174,5 @@ $rectorConfig->rule(MigrateBackendModuleRegistrationRector::class); $rectorConfig->rule(MigrateContentObjectRendererGetTypoLinkUrlRector::class); $rectorConfig->rule(ExtbaseActionsWithRedirectMustReturnResponseInterfaceRector::class); + $rectorConfig->rule(RemoveAddLLrefForTCAdescrMethodCallRector::class); }; diff --git a/rules/TYPO312/v0/RemoveAddLLrefForTCAdescrMethodCallRector.php b/rules/TYPO312/v0/RemoveAddLLrefForTCAdescrMethodCallRector.php new file mode 100644 index 000000000..ba65027f9 --- /dev/null +++ b/rules/TYPO312/v0/RemoveAddLLrefForTCAdescrMethodCallRector.php @@ -0,0 +1,69 @@ +> + */ + public function getNodeTypes(): array + { + return [StaticCall::class]; + } + + /** + * @param StaticCall $node + */ + public function refactor(Node $node): ?Node + { + if (! $node instanceof StaticCall) { + return null; + } + + if (! $this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType( + $node, + ExtensionManagementUtility::class + )) { + return null; + } + + if (! $this->isName($node->name, 'addLLrefForTCAdescr')) { + return null; + } + + return null; + } +} diff --git a/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/Fixture/fixture.php.inc b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/Fixture/fixture.php.inc new file mode 100644 index 000000000..623b8d154 --- /dev/null +++ b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/Fixture/fixture.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/RemoveAddLLrefForTCAdescrMethodCallRectorTest.php b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/RemoveAddLLrefForTCAdescrMethodCallRectorTest.php new file mode 100644 index 000000000..3281b7358 --- /dev/null +++ b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/RemoveAddLLrefForTCAdescrMethodCallRectorTest.php @@ -0,0 +1,31 @@ +doTestFile($filePath); + } + + /** + * @return \Iterator> + */ + public static function provideData(): \Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/config/configured_rule.php b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/config/configured_rule.php new file mode 100644 index 000000000..1fe204688 --- /dev/null +++ b/tests/Rector/v12/v0/RemoveAddLLrefForTCAdescrMethodCallRector/config/configured_rule.php @@ -0,0 +1,11 @@ +import(__DIR__ . '/../../../../../../config/config_test.php'); + $rectorConfig->rule(RemoveAddLLrefForTCAdescrMethodCallRector::class); +};