diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.diff new file mode 100644 index 0000000..30eec72 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.diff @@ -0,0 +1,52 @@ +--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/InputFileForIssues.php ++++ PHP_CodeSniffer +@@ -20,7 +20,7 @@ + */ + + TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'name', + [ + 'Controller' => 'action', +@@ -28,7 +28,7 @@ + ); + + Tx_Extbase_Utility_Extension::configurePlugin( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'name', + [ + 'Controller' => 'action', +@@ -36,19 +36,19 @@ + ); + + Tx_Extbase_Utility_Extension::registerPlugin( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'name', + 'title' + ); + + TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'name', + 'title' + ); + + Tx_Extbase_Utility_Extension::registerModule( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'subpart', + 'key' + '', +@@ -58,7 +58,7 @@ + ); + + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( +- $_EXTKEY, ++ 'YourCompany.' . $_EXTKEY, + 'subpart', + 'key' + '', diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.json new file mode 100644 index 0000000..8f4511c --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/Expected.json @@ -0,0 +1,69 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 6, + "messages": [ + { + "column": 5, + "fixable": true, + "line": 23, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 31, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 39, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 45, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 51, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 61, + "message": "No vendor is given, that will break TYPO3 handling for namespaced classes. Add vendor before Extensionkey like: \"YourCompany.\" . $_EXTKEY", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.MissingVendorForPluginsAndModules.missingVendor", + "type": "ERROR" + } + ], + "warnings": 0 + } + }, + "totals": { + "errors": 6, + "fixable": 6, + "warnings": 0 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/InputFileForIssues.php new file mode 100644 index 0000000..65d0d16 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/MissingVendorForPluginsAndModulesSniff/InputFileForIssues.php @@ -0,0 +1,118 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + $_EXTKEY, + 'name', + [ + 'Controller' => 'action', + ] +); + +Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'name', + [ + 'Controller' => 'action', + ] +); + +Tx_Extbase_Utility_Extension::registerPlugin( + $_EXTKEY, + 'name', + 'title' +); + +TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + $_EXTKEY, + 'name', + 'title' +); + +Tx_Extbase_Utility_Extension::registerModule( + $_EXTKEY, + 'subpart', + 'key' + '', + [ + 'Controller' => 'action', + ] +); + +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + $_EXTKEY, + 'subpart', + 'key' + '', + [ + 'Controller' => 'action', + ] +); + +// Already vendor exists + +TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Vendor.' . $_EXTKEY, + 'name', + [ + 'Controller' => 'action', + ] +); + +Tx_Extbase_Utility_Extension::configurePlugin( + 'Vendor.' . $_EXTKEY, + 'name', + [ + 'Controller' => 'action', + ] +); + +Tx_Extbase_Utility_Extension::registerPlugin( + 'Vendor.' . $_EXTKEY, + 'name', + 'title' +); + +TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Vendor.' . $_EXTKEY, + 'name', + 'title' +); + +Tx_Extbase_Utility_Extension::registerModule( + 'Vendor.' . $_EXTKEY, + 'subpart', + 'key' + '', + [ + 'Controller' => 'action', + ] +); + +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + 'Vendor.' . $_EXTKEY, + 'subpart', + 'key' + '', + [ + 'Controller' => 'action', + ] +); diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.diff new file mode 100644 index 0000000..22be3a6 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.diff @@ -0,0 +1,21 @@ +--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php ++++ PHP_CodeSniffer +@@ -19,13 +19,13 @@ + * 02110-1301, USA. + */ + +-Tx_Extbase_Utility_Extension::configurePlugin( ++\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + $_EXTKEY, + 'name', + ['Controller' => 'action'] + ); +-t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class); +-$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class); ++\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Command\HelpCommandController::class); ++$this->objectManager->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class); + \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager) +- ->get(\Tx_Extbase_Command_HelpCommandController::class); +-is_a($a, t3lib_Singleton::class); ++ ->get(\TYPO3\CMS\Extbase\Command\HelpCommandController::class); ++is_a($a, \TYPO3\CMS\Core\SingletonInterface::class); diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.json new file mode 100644 index 0000000..f2e2a54 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/Expected.json @@ -0,0 +1,69 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 6, + "messages": [ + { + "column": 1, + "fixable": true, + "line": 22, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Utility_Extension\", use \"TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + }, + { + "column": 1, + "fixable": true, + "line": 27, + "message": "Legacy classes are not allowed; found \"t3lib_div\", use \"TYPO3\\CMS\\Core\\Utility\\GeneralUtility\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + }, + { + "column": 25, + "fixable": true, + "line": 27, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + }, + { + "column": 28, + "fixable": true, + "line": 28, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + }, + { + "column": 12, + "fixable": true, + "line": 30, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Command_HelpCommandController\", use \"TYPO3\\CMS\\Extbase\\Command\\HelpCommandController\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + }, + { + "column": 10, + "fixable": true, + "line": 31, + "message": "Legacy classes are not allowed; found \"t3lib_Singleton\", use \"TYPO3\\CMS\\Core\\SingletonInterface\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.StaticCall.legacyClassname", + "type": "ERROR" + } + ], + "warnings": 0 + } + }, + "totals": { + "errors": 6, + "fixable": 6, + "warnings": 0 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php new file mode 100644 index 0000000..df4f280 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/StaticCallSniff/InputFileForIssues.php @@ -0,0 +1,31 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +Tx_Extbase_Utility_Extension::configurePlugin( + $_EXTKEY, + 'name', + ['Controller' => 'action'] +); +t3lib_div::makeInstance(Tx_Extbase_Command_HelpCommandController::class); +$this->objectManager->get(\Tx_Extbase_Command_HelpCommandController::class); +\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager) + ->get(\Tx_Extbase_Command_HelpCommandController::class); +is_a($a, t3lib_Singleton::class); diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.diff new file mode 100644 index 0000000..bfbb25d --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.diff @@ -0,0 +1,18 @@ +--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php ++++ PHP_CodeSniffer +@@ -21,13 +21,13 @@ + + try { + // something +-} catch (\Tx_Extbase_Exception $e) { ++} catch (\TYPO3\CMS\Extbase\Exception $e) { + // else + } + + try { + // something +-} catch (Tx_Extbase_Exception $e) { ++} catch (\TYPO3\CMS\Extbase\Exception $e) { + // else + } + diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.json new file mode 100644 index 0000000..ae6d240 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/Expected.json @@ -0,0 +1,33 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 2, + "messages": [ + { + "column": 11, + "fixable": true, + "line": 24, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname", + "type": "ERROR" + }, + { + "column": 10, + "fixable": true, + "line": 30, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Exception\", use \"TYPO3\\CMS\\Extbase\\Exception\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHintCatchException.legacyClassname", + "type": "ERROR" + } + ], + "warnings": 0 + } + }, + "totals": { + "errors": 2, + "fixable": 2, + "warnings": 0 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php new file mode 100644 index 0000000..0ea392d --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintCatchExceptionSniff/InputFileForIssues.php @@ -0,0 +1,44 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +try { + // something +} catch (\Tx_Extbase_Exception $e) { + // else +} + +try { + // something +} catch (Tx_Extbase_Exception $e) { + // else +} + +try { + // something +} catch (\TYPO3\CMS\Extbase\Exception $e) { + // else +} + +try { + // something +} catch (TYPO3\CMS\Extbase\Exception $e) { + // else +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.diff new file mode 100644 index 0000000..bceab5a --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.diff @@ -0,0 +1,41 @@ +--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php ++++ PHP_CodeSniffer +@@ -25,10 +25,10 @@ + function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +-function something(\Tx_Extbase_Domain_Model_Backenduser $user) ++function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +-function something(Tx_Extbase_Domain_Model_Backenduser $user) ++function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + +@@ -40,10 +40,10 @@ + function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +- function something(\Tx_Extbase_Domain_Model_Backenduser $user) ++ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +- function something(Tx_Extbase_Domain_Model_Backenduser $user) ++ function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + +@@ -53,10 +53,10 @@ + public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +- public function something(\Tx_Extbase_Domain_Model_Backenduser $user) ++ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } +- public function something(Tx_Extbase_Domain_Model_Backenduser $user) ++ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.json new file mode 100644 index 0000000..9b45649 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/Expected.json @@ -0,0 +1,69 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 6, + "messages": [ + { + "column": 21, + "fixable": true, + "line": 28, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + }, + { + "column": 20, + "fixable": true, + "line": 31, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + }, + { + "column": 25, + "fixable": true, + "line": 43, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + }, + { + "column": 24, + "fixable": true, + "line": 46, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + }, + { + "column": 32, + "fixable": true, + "line": 56, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + }, + { + "column": 31, + "fixable": true, + "line": 59, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.TypeHint.legacyClassname", + "type": "ERROR" + } + ], + "warnings": 0 + } + }, + "totals": { + "errors": 6, + "fixable": 6, + "warnings": 0 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php new file mode 100644 index 0000000..8200349 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/TypeHintSniff/InputFileForIssues.php @@ -0,0 +1,62 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) +{ +} +function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) +{ +} +function something(\Tx_Extbase_Domain_Model_Backenduser $user) +{ +} +function something(Tx_Extbase_Domain_Model_Backenduser $user) +{ +} + +class SomeClass +{ + function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + function something(\Tx_Extbase_Domain_Model_Backenduser $user) + { + } + function something(Tx_Extbase_Domain_Model_Backenduser $user) + { + } + + public function something(TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) + { + } + public function something(\Tx_Extbase_Domain_Model_Backenduser $user) + { + } + public function something(Tx_Extbase_Domain_Model_Backenduser $user) + { + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.diff new file mode 100644 index 0000000..919696a --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.diff @@ -0,0 +1,13 @@ +--- tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php ++++ PHP_CodeSniffer +@@ -19,8 +19,8 @@ + * 02110-1301, USA. + */ + +-use \Tx_Extbase_Domain_Model_Backenduser; +-use Tx_Extbase_Domain_Model_Backenduser; ++use \TYPO3\CMS\Extbase\Domain\Model\BackendUser; ++use TYPO3\CMS\Extbase\Domain\Model\BackendUser; + use TYPO3\CMS\Extbase\Mvc\Cli\Command; + use \TYPO3\CMS\Extbase\Mvc\Cli\Command; + diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.json new file mode 100644 index 0000000..6b30360 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/Expected.json @@ -0,0 +1,33 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 2, + "messages": [ + { + "column": 6, + "fixable": true, + "line": 22, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.Use.legacyClassname", + "type": "ERROR" + }, + { + "column": 5, + "fixable": true, + "line": 23, + "message": "Legacy classes are not allowed; found \"Tx_Extbase_Domain_Model_Backenduser\", use \"TYPO3\\CMS\\Extbase\\Domain\\Model\\BackendUser\" instead", + "severity": 5, + "source": "Typo3Update.LegacyClassnames.Use.legacyClassname", + "type": "ERROR" + } + ], + "warnings": 0 + } + }, + "totals": { + "errors": 2, + "fixable": 2, + "warnings": 0 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php new file mode 100644 index 0000000..7dbcfd4 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/UseSniff/InputFileForIssues.php @@ -0,0 +1,26 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use \Tx_Extbase_Domain_Model_Backenduser; +use Tx_Extbase_Domain_Model_Backenduser; +use TYPO3\CMS\Extbase\Mvc\Cli\Command; +use \TYPO3\CMS\Extbase\Mvc\Cli\Command; +