From: Tim Düsterhus Date: Wed, 13 Apr 2016 18:42:25 +0000 (+0200) Subject: Fix detection of namespaces function calls X-Git-Tag: 3.0.0_Beta_1~1903 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10699119dc252e9ceff5f9a76a7b613adba821d9;p=GitHub%2FWoltLab%2FWCF.git Fix detection of namespaces function calls --- diff --git a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php index 18d2733ff8..1413ad4a18 100644 --- a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php +++ b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php @@ -60,7 +60,9 @@ class WCF_Sniffs_Namespaces_ClassMustBeImportedSniff implements PHP_CodeSniffer_ $newClass = $phpcsFile->findNext(T_STRING, $tClass); if ($tokens[$newClass]['content'] == $tokens[$end - 1]['content']) return; } - $tNew = $phpcsFile->findPrevious(array(T_NEW), $stackPtr - 1, null, false, null, true); + $pos = $prevNonClassPart - 1; + while ($tokens[$pos]['code'] === T_WHITESPACE) $pos--; + $tNew = $tokens[$pos]['code'] === T_NEW; // are we trying to create a new object? if ($tNew === false) {