FEATURE: Add removed extension to type hint sniff

* Integrate feature and adjust code as needed.
* We need to find the class names inside of type hints more accurate.
* Also tests need to cover the new feature.

Relates: #44
This commit is contained in:
Daniel Siepmann 2017-05-09 10:34:58 +02:00
parent 633a714043
commit 3034f3fec4
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
4 changed files with 46 additions and 4 deletions

View file

@ -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']);
}
}

View file

@ -38,4 +38,4 @@
+ public function something(\TYPO3\CMS\Extbase\Domain\Model\BackendUser $user)
{
}
}

View file

@ -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
}
}

View file

@ -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)
{
}
}