Merge pull request #32 from DanielSiepmann/hotfix/fix-static-call-sniff

BUGFIX: Fix bug introduced in e6e372f8b1
This commit is contained in:
simonhard 2017-03-21 10:38:23 +01:00 committed by GitHub
commit f1b6cc86c1
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.
*