From: Tim Düsterhus Date: Wed, 6 Jan 2016 17:32:30 +0000 (+0100) Subject: Fix detection of namespaced function calls X-Git-Tag: 3.0.0_Beta_1~2062 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2c9ecb45a1e589f04d583636b1965b9843a323c8;p=GitHub%2FWoltLab%2FWCF.git Fix detection of namespaced function calls --- diff --git a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php index bf432696a5..18d2733ff8 100644 --- a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php +++ b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php @@ -60,14 +60,13 @@ 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); + $tNew = $phpcsFile->findPrevious(array(T_NEW), $stackPtr - 1, null, false, null, true); // are we trying to create a new object? if ($tNew === false) { // no $parenthesis = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $end); $nonParenthesis = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $end, null, true); - // are we accessing something that's static? if ($parenthesis !== false && $parenthesis < $nonParenthesis) { // no -> this looks like a function call of a namespaced function