FEATURE: Also migrate legacy classes in extends

* Migrate legacy classes after extends keyword.
* Sort token types alphabetical.
This commit is contained in:
Daniel Siepmann 2017-03-07 12:05:50 +01:00
parent 1aaf0e5840
commit f912313da3

View file

@ -50,12 +50,12 @@ class Typo3Update_Sniffs_Legacy_ClassnamesSniff implements PHP_CodeSniffer_Sniff
public function register() public function register()
{ {
return [ return [
// T_USE, T_EXTENDS,
// T_NEW,
// T_INSTANCEOF,
T_IMPLEMENTS, T_IMPLEMENTS,
// T_EXTENDS, // T_INSTANCEOF,
// T_NEW,
// T_STRING, // T_STRING,
// T_USE,
]; ];
} }
@ -84,6 +84,7 @@ class Typo3Update_Sniffs_Legacy_ClassnamesSniff implements PHP_CodeSniffer_Sniff
if ($fix === true) { if ($fix === true) {
switch ($tokens[$stackPtr]['code']) { switch ($tokens[$stackPtr]['code']) {
case T_EXTENDS:
case T_IMPLEMENTS: case T_IMPLEMENTS:
$phpcsFile->fixer->replaceToken($classnamePosition, '\\' . $this->getNewClassname($classname)); $phpcsFile->fixer->replaceToken($classnamePosition, '\\' . $this->getNewClassname($classname));
break; break;