BUGFIX: Fix bug introduced in e6e372f8b1

* Allow static calls to find class name before $stackPtr.
This commit is contained in:
Daniel Siepmann 2017-03-21 10:31:14 +01:00
parent c59351f92e
commit 5fd8e965ac
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 25 additions and 0 deletions

View file

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

View file

@ -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.
*