From: Tim Düsterhus Date: Thu, 18 Dec 2014 21:37:55 +0000 (+0100) Subject: Add some more sane Code Sniffs and fix smelling code X-Git-Tag: 2.1.0_Beta_3~107^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=29ddf8adf4e91ca5e7b6acae8f5f6888d8903caf;p=GitHub%2FWoltLab%2FWCF.git Add some more sane Code Sniffs and fix smelling code --- diff --git a/CodeSniff/WCF/ruleset.xml b/CodeSniff/WCF/ruleset.xml index be86bd9a81..4cc0530220 100644 --- a/CodeSniff/WCF/ruleset.xml +++ b/CodeSniff/WCF/ruleset.xml @@ -5,6 +5,9 @@ */CodeSniff/* + + + @@ -16,6 +19,7 @@ + @@ -26,9 +30,13 @@ + + + + diff --git a/wcfsetup/install/files/lib/system/io/GZipFile.class.php b/wcfsetup/install/files/lib/system/io/GZipFile.class.php index d92b170ec1..3589a4cc41 100644 --- a/wcfsetup/install/files/lib/system/io/GZipFile.class.php +++ b/wcfsetup/install/files/lib/system/io/GZipFile.class.php @@ -69,7 +69,7 @@ class GZipFile extends File { $eof += $byteBlock * ($this->seek($eof) ? -1 : 1); } - if ($this->seek($eof) == -1) $eof -= 1; + if ($this->seek($eof) == -1) $eof--; $this->rewind(); return $eof - $correction; diff --git a/wcfsetup/install/files/lib/util/FileReader.class.php b/wcfsetup/install/files/lib/util/FileReader.class.php index 8f007eff0a..14625bd9ae 100644 --- a/wcfsetup/install/files/lib/util/FileReader.class.php +++ b/wcfsetup/install/files/lib/util/FileReader.class.php @@ -233,6 +233,5 @@ class FileReader { */ public function removeHeader($name) { unset($this->headers[$name]); - return; } } diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index 6fb3d322c8..cc7e8a010b 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -169,9 +169,7 @@ final class FileUtil { unset($target[$j]); } $relPath .= str_repeat('../', count($current) - $i).implode('/', $target).'/'; - for ($j = $i + 1; $j < count($current); $j++) { - unset($current[$j]); - } + break; } } diff --git a/wcfsetup/install/files/lib/util/StringStack.class.php b/wcfsetup/install/files/lib/util/StringStack.class.php index 4d07c12bf5..a816afeab2 100644 --- a/wcfsetup/install/files/lib/util/StringStack.class.php +++ b/wcfsetup/install/files/lib/util/StringStack.class.php @@ -32,7 +32,8 @@ final class StringStack { * @return string $hash */ public static function pushToStringStack($string, $type = 'default', $delimiter = '@@') { - $hash = $delimiter.StringUtil::getHash(self::$i++ . uniqid(microtime()) . $string).$delimiter; + self::$i++; + $hash = $delimiter.StringUtil::getHash(self::$i.uniqid(microtime()).$string).$delimiter; if (!isset(self::$stringStack[$type])) { self::$stringStack[$type] = array();