diff --git a/src/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff.php b/src/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff.php new file mode 100644 index 0000000..ef93ceb --- /dev/null +++ b/src/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff.php @@ -0,0 +1,58 @@ + + */ + protected function getRemovedConfigFiles() + { + return []; + } + + /** + * The original call, to allow user to check matches. + * + * As we match the name, that can be provided by multiple classes, you + * should provide an example, so users can check that this is the legacy + * one. + * + * @param array $config + * + * @return string + */ + protected function getOldUsage(array $config) + { + return ''; + } + + /** + * Registers the tokens that this sniff wants to listen for. + * + * An example return value for a sniff that wants to listen for whitespace + * and any comments would be: + * + * + * return array( + * T_WHITESPACE, + * T_DOC_COMMENT, + * T_COMMENT, + * ); + * + * + * @return int[] + * @see Tokens.php + */ + public function register() + { + return []; + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/Expected.json new file mode 100644 index 0000000..22c013b --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/Expected.json @@ -0,0 +1,24 @@ +{ + "files": { + "InputFileForIssues.php": { + "errors": 0, + "messages": [ + { + "column": 63, + "fixable": false, + "line": 22, + "message": "Legacy extension are not allowed; found \"perm\"", + "severity": 5, + "source": "Typo3Update.Removed.ExtensionKey.legacyKey", + "type": "WARNING" + } + ], + "warnings": 1 + } + }, + "totals": { + "errors": 0, + "fixable": 0, + "warnings": 1 + } +} diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/InputFileForIssues.php new file mode 100644 index 0000000..2cf7985 --- /dev/null +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Removed/ExtensionKeySniff/InputFileForIssues.php @@ -0,0 +1,22 @@ + + * + * 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\Core\Utility\ExtensionManagementUtility::isLoaded('perm');