diff --git a/src/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff.php b/src/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff.php index 05f49c1..0aa738c 100644 --- a/src/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff.php +++ b/src/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff.php @@ -51,10 +51,18 @@ class Typo3Update_Sniffs_Classname_TypeHintSniff extends AbstractClassnameChecke continue; } - $position = $phpcsFile->findPrevious(T_STRING, $parameter['token'], $stackPtr, false, null, true); + $position = $phpcsFile->findPrevious([ + T_OPEN_PARENTHESIS, T_COMMA + ], $parameter['token'] - 2, $stackPtr, false, null, true); if ($position === false) { continue; } + + $position = $phpcsFile->findNext(T_STRING, $position); + if ($position === false) { + continue; + } + $this->processFeatures($phpcsFile, $position, $parameter['type_hint']); } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.diff b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.diff index 54ec8ea..7ccb526 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.diff +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.diff @@ -38,4 +38,4 @@ + public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user) { } - } + diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.json b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.json index 9fde95c..2e56a13 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.json +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/Expected.json @@ -56,14 +56,41 @@ "severity": 5, "source": "Typo3Update.Classname.TypeHint.legacyClassname", "type": "ERROR" + }, + { + "column": 31, + "fixable": false, + "line": 63, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.TypeHint.RemovedClass.perm", + "type": "WARNING" + }, + { + "column": 96, + "fixable": false, + "line": 63, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.TypeHint.RemovedClass.perm", + "type": "WARNING" + }, + { + "column": 31, + "fixable": false, + "line": 66, + "message": "Calls to removed code are not allowed; found perm. Removed in 7.0. The logic is moved into EXT:beuser. See: https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.0/Breaking-62339-MoveExtPermIntoExtBeuser.html", + "severity": 5, + "source": "Typo3Update.Classname.TypeHint.RemovedClass.perm", + "type": "WARNING" } ], - "warnings": 0 + "warnings": 3 } }, "totals": { "errors": 6, "fixable": 6, - "warnings": 0 + "warnings": 3 } } diff --git a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/InputFileForIssues.php b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/InputFileForIssues.php index 8200349..7f88ddd 100644 --- a/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/InputFileForIssues.php +++ b/tests/Fixtures/Standards/Typo3Update/Sniffs/Classname/TypeHintSniff/InputFileForIssues.php @@ -59,4 +59,11 @@ class SomeClass public function something(Tx_Extbase_Domain_Model_Backenduser $user) { } + + public function something(TYPO3\CMS\Perm\Controller\PermissionAjaxController $controller, \Tx_Perm_Controller_PermissionAjaxController $controller) + { + } + public function something(Tx_Perm_Controller_PermissionAjaxController $controller) + { + } }