From: Tim Düsterhus Date: Mon, 7 Jan 2013 21:26:27 +0000 (+0100) Subject: Improve SortedUseDeclarationSniff X-Git-Tag: 2.0.0_Beta_1~579 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3369c4441e56cb1263967a81518a99d56b1c42ad;p=GitHub%2FWoltLab%2FWCF.git Improve SortedUseDeclarationSniff --- diff --git a/CodeSniff/WCF/Sniffs/Namespaces/SortedUseDeclarationSniff.php b/CodeSniff/WCF/Sniffs/Namespaces/SortedUseDeclarationSniff.php index be72338a55..dc8b87ae5f 100644 --- a/CodeSniff/WCF/Sniffs/Namespaces/SortedUseDeclarationSniff.php +++ b/CodeSniff/WCF/Sniffs/Namespaces/SortedUseDeclarationSniff.php @@ -82,9 +82,11 @@ class WCF_Sniffs_Namespaces_SortedUseDeclarationSniff implements PHP_CodeSniffer $classA = array_values($classA); $classB = array_values($classB); - for ($i = 0, $max = min(count($classA), count($classB)); $i < $max; $i++) { - if (ucfirst($classB[$i]) == $classB[$i] && ucfirst($classA[$i]) != $classA[$i]) return true; - if (ucfirst($classB[$i]) != $classB[$i] && ucfirst($classA[$i]) == $classA[$i]) return false; + $classALength = count($classA); + $classBLength = count($classB); + for ($i = 0, $max = min($classALength, $classBLength); $i < $max; $i++) { + if ($i + 1 === $classBLength && $i + 1 !== $classALength) return true; + if ($i + 1 !== $classBLength && $i + 1 === $classALength) return false; if (strcasecmp($classA[$i], $classB[$i]) < 0) { return true;