BUGFIX: Look for argument only in current statement
* Just check T_STRING as this are all function calls. * Remove unused line of code. * Limit position to current statement to not return later classname multiple times. Relates: #44
This commit is contained in:
parent
2894784978
commit
e3dd6013ba
1 changed files with 2 additions and 3 deletions
|
@ -34,7 +34,7 @@ class Typo3Update_Sniffs_Classname_InstantiationWithMakeInstanceSniff extends Ab
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
return Tokens::$functionNameTokens;
|
||||
return [T_STRING];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,13 +57,12 @@ class Typo3Update_Sniffs_Classname_InstantiationWithMakeInstanceSniff extends Ab
|
|||
return;
|
||||
}
|
||||
|
||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr);
|
||||
$classnamePosition = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr, null, false, null, true);
|
||||
if ($classnamePosition === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$classname = $tokens[$classnamePosition]['content'];
|
||||
$this->originalTokenContent = $tokens[$classnamePosition]['content'];
|
||||
$this->processFeatures($phpcsFile, $classnamePosition, $classname);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue