From: Tim Düsterhus Date: Thu, 10 Jan 2013 17:15:52 +0000 (+0100) Subject: Fix ClassMustBeImportedSniff X-Git-Tag: 2.0.0_Beta_1~574 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1710e63bd4141268f8225a0a21e3813e38ea25b5;p=GitHub%2FWoltLab%2FWCF.git Fix ClassMustBeImportedSniff Fixes #1090 --- diff --git a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php index 736035c900..0e1ba74ca7 100644 --- a/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php +++ b/CodeSniff/WCF/Sniffs/Namespaces/ClassMustBeImportedSniff.php @@ -54,10 +54,10 @@ class WCF_Sniffs_Namespaces_ClassMustBeImportedSniff implements PHP_CodeSniffer_ $class .= $tokens[$i]['content']; } - $extends = $phpcsFile->findPrevious(array(T_EXTENDS), $stackPtr - 1, null, false, null, true); + $tClass = $phpcsFile->findPrevious(array(T_CLASS), $stackPtr - 1); // are we trying to extend a class with the same name? - if ($extends !== false) { - $newClass = $phpcsFile->findPrevious(T_STRING, $extends); + if ($tClass !== false) { + $newClass = $phpcsFile->findNext(T_STRING, $tClass); if ($tokens[$newClass]['content'] == $tokens[$end - 1]['content']) return; }