BUGFIX: Fix bug introduced in e6e372f8b1
* Allow static calls to find class name before $stackPtr.
This commit is contained in:
parent
c59351f92e
commit
5fd8e965ac
2 changed files with 25 additions and 0 deletions
|
@ -56,6 +56,17 @@ trait ClassnameCheckerTrait
|
|||
$this->legacyClassnames = $legacyClassnames['aliasToClassNameMapping'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define whether the T_STRING default behaviour should be checked before
|
||||
* or after the $stackPtr.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function findPrev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the tokens that this sniff is interested in.
|
||||
*
|
||||
|
@ -74,6 +85,9 @@ trait ClassnameCheckerTrait
|
|||
$tokens = $phpcsFile->getTokens();
|
||||
|
||||
$classnamePosition = $phpcsFile->findNext(T_STRING, $stackPtr);
|
||||
if ($this->findPrev()) {
|
||||
$classnamePosition = $phpcsFile->findPrevious(T_STRING, $stackPtr);
|
||||
}
|
||||
if ($classnamePosition === false) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,17 @@ class Typo3Update_Sniffs_LegacyClassnames_StaticCallSniff implements PHP_CodeSni
|
|||
{
|
||||
use \Typo3Update\Sniffs\LegacyClassnames\ClassnameCheckerTrait;
|
||||
|
||||
/**
|
||||
* Define whether the T_STRING default behaviour should be checked before
|
||||
* or after the $stackPtr.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function findPrev()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the token types that this sniff is interested in.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue