@@ -6,9 +6,9 @@ discard block |
||
| 6 | 6 | { |
| 7 | 7 | $files = glob($pattern, $flags); |
| 8 | 8 | |
| 9 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) |
|
| 9 | + foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) |
|
| 10 | 10 | { |
| 11 | - $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); |
|
| 11 | + $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | return $files; |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | 'build/humbug.json', |
| 81 | 81 | 'build/humbug-log.txt', |
| 82 | 82 | ]; |
| 83 | - array_map(function ($file) { |
|
| 83 | + array_map(function($file) { |
|
| 84 | 84 | @unlink($file); |
| 85 | 85 | }, $cleanFiles); |
| 86 | 86 | |
| 87 | 87 | // So the task doesn't complain, |
| 88 | 88 | // make any 'missing' dirs to cleanup |
| 89 | - array_map(function ($dir) { |
|
| 89 | + array_map(function($dir) { |
|
| 90 | 90 | if ( ! is_dir($dir)) |
| 91 | 91 | { |
| 92 | 92 | `mkdir -p {$dir}`; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $chunks = array_chunk($files, 6); |
| 132 | 132 | |
| 133 | - foreach($chunks as $chunk) |
|
| 133 | + foreach ($chunks as $chunk) |
|
| 134 | 134 | { |
| 135 | 135 | $this->parallelLint($chunk); |
| 136 | 136 | } |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | ->monitor('composer.json', function() { |
| 242 | 242 | $this->taskComposerUpdate()->run(); |
| 243 | 243 | }) |
| 244 | - ->monitor('src', function () { |
|
| 244 | + ->monitor('src', function() { |
|
| 245 | 245 | $this->taskExec('test')->run(); |
| 246 | 246 | }) |
| 247 | - ->monitor('tests', function () { |
|
| 247 | + ->monitor('tests', function() { |
|
| 248 | 248 | $this->taskExec('test')->run(); |
| 249 | 249 | }) |
| 250 | 250 | ->run(); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | ->timeout(5) |
| 296 | 296 | ->printed(FALSE); |
| 297 | 297 | |
| 298 | - foreach($chunk as $file) |
|
| 298 | + foreach ($chunk as $file) |
|
| 299 | 299 | { |
| 300 | 300 | $task = $task->process("php -l {$file}"); |
| 301 | 301 | } |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | * @return string|bool The relative path from $appRoot to $filePath, or |
| 138 | 138 | * false if $appRoot cannot be found in $filePath. |
| 139 | 139 | */ |
| 140 | - private static function _getLocationPath ($filePath, $appRoot) |
|
| 140 | + private static function _getLocationPath($filePath, $appRoot) |
|
| 141 | 141 | { |
| 142 | 142 | // removes the path to application root |
| 143 | 143 | // from the beginning of the file path |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function process(File $phpcsFile, $stackPtr) |
| 49 | 49 | { |
| 50 | - $error = __CLASS__.'::'.__METHOD__.' is abstract. Please develop this method in a child class.'; |
|
| 50 | + $error = __CLASS__ . '::' . __METHOD__ . ' is abstract. Please develop this method in a child class.'; |
|
| 51 | 51 | throw new PHP_CodeSniffer_Exception($error); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Comment without comment delimiter(s) and whitespaces. |
| 66 | 66 | */ |
| 67 | - protected static function _getCommentContent ($comment) |
|
| 67 | + protected static function _getCommentContent($comment) |
|
| 68 | 68 | { |
| 69 | 69 | if (self::_stringStartsWith($comment, '#')) { |
| 70 | 70 | $comment = substr($comment, 1); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return bool true if $haystack starts with $needle, false otherwise. |
| 90 | 90 | */ |
| 91 | - protected static function _stringStartsWith ($haystack, $needle) |
|
| 91 | + protected static function _stringStartsWith($haystack, $needle) |
|
| 92 | 92 | { |
| 93 | 93 | $startsWith = false; |
| 94 | 94 | if (strlen($needle) <= strlen($haystack)) { |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | $phpcsFile->addError($error, $stackPtr); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | - if ( ! $isPhp4Constructor && ! $isPhp5Constructor ) { |
|
| 85 | + if ( ! $isPhp4Constructor && ! $isPhp5Constructor) { |
|
| 86 | 86 | return; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -70,11 +70,11 @@ |
||
| 70 | 70 | // [^_] means "something different from _", but not "nothing or something different from _" |
| 71 | 71 | $lcClassNameChunk = preg_replace('/([^_])([A-Z])/', '${1}_${2}', $className); |
| 72 | 72 | $expectedClassName |
| 73 | - = strtoupper($className[0]) . strtolower(substr($lcClassNameChunk,1)); |
|
| 73 | + = strtoupper($className[0]) . strtolower(substr($lcClassNameChunk, 1)); |
|
| 74 | 74 | // ensures that the current class name |
| 75 | 75 | // and the expected class name are identical |
| 76 | 76 | if (0 !== strcmp($className, $expectedClassName)) { |
| 77 | - $error = 'Class names should always have their first letter uppercase. Multiple words should be separated with an underscore, and not CamelCased. Please consider ' . $expectedClassName . ' instead of ' . $className . '.'; |
|
| 77 | + $error = 'Class names should always have their first letter uppercase. Multiple words should be separated with an underscore, and not CamelCased. Please consider ' . $expectedClassName . ' instead of ' . $className . '.'; |
|
| 78 | 78 | $phpcsFile->addError($error, $stackPtr); |
| 79 | 79 | } |
| 80 | 80 | }//end process() |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $varName = substr($varTk['content'], 1); |
| 62 | 62 | $varProps = $phpcsFile->getMemberProperties($stackPtr); |
| 63 | 63 | // check(s) |
| 64 | - if ( ! $this->checkLowerCase($phpcsFile, $stackPtr, $varName) ) { |
|
| 64 | + if ( ! $this->checkLowerCase($phpcsFile, $stackPtr, $varName)) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | if ( ! $this->checkVisibilityPrefix($phpcsFile, $stackPtr, $varName, $varProps)) { |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $currentTk = $tokens[$stackPtr]; |
| 321 | 321 | if (array_key_exists('nested_parenthesis', $currentTk)) { |
| 322 | 322 | $nestedParenthesis = $currentTk['nested_parenthesis']; |
| 323 | - foreach ( $nestedParenthesis as $openParPtr => $closeParPtr) { |
|
| 323 | + foreach ($nestedParenthesis as $openParPtr => $closeParPtr) { |
|
| 324 | 324 | $nonWhitspacePtr = $phpcsFile->findPrevious( |
| 325 | 325 | array(T_WHITESPACE), |
| 326 | 326 | $openParPtr - 1, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $className = $phpcsFile->getDeclarationName($currScope); |
|
| 92 | + $className = $phpcsFile->getDeclarationName($currScope); |
|
| 93 | 93 | |
| 94 | 94 | // Is this a magic method i.e. is prefixed with "__". |
| 95 | 95 | if (0 === strcmp(substr($methodName, 0, 2), '__')) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // PHP4 destructors are allowed to break our rules. |
| 111 | - if ($methodName === '_'.$className) { |
|
| 111 | + if ($methodName === '_' . $className) { |
|
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if (true === $scopeSpecified) { |
| 137 | 137 | $error = "Public method name \"$className::$methodName\" must not be prefixed with an underscore"; |
| 138 | 138 | } else { |
| 139 | - $error = ucfirst($scope)." method name \"$className::$methodName\" must not be prefixed with an underscore"; |
|
| 139 | + $error = ucfirst($scope) . " method name \"$className::$methodName\" must not be prefixed with an underscore"; |
|
| 140 | 140 | } |
| 141 | 141 | $phpcsFile->addError($error, $stackPtr); |
| 142 | 142 | return; |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | private static function _checkUtf8W3c($content) |
| 98 | 98 | { |
| 99 | - $content_chunks=self::mb_chunk_split($content, 4096, ''); |
|
| 100 | - foreach($content_chunks as $content_chunk) |
|
| 99 | + $content_chunks = self::mb_chunk_split($content, 4096, ''); |
|
| 100 | + foreach ($content_chunks as $content_chunk) |
|
| 101 | 101 | { |
| 102 | - $preg_result= preg_match( |
|
| 102 | + $preg_result = preg_match( |
|
| 103 | 103 | '%^(?: |
| 104 | 104 | [\x09\x0A\x0D\x20-\x7E] # ASCII |
| 105 | 105 | | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | )*$%xs', |
| 113 | 113 | $content_chunk |
| 114 | 114 | ); |
| 115 | - if($preg_result!==1) |
|
| 115 | + if ($preg_result !== 1) |
|
| 116 | 116 | { |
| 117 | 117 | return false; |
| 118 | 118 | } |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | if (($c >= 254)) { |
| 142 | 142 | return false; |
| 143 | 143 | } elseif ($c >= 252) { |
| 144 | - $bits=6; |
|
| 144 | + $bits = 6; |
|
| 145 | 145 | } elseif ($c >= 248) { |
| 146 | - $bits=5; |
|
| 146 | + $bits = 5; |
|
| 147 | 147 | } elseif ($c >= 240) { |
| 148 | 148 | $bytes = 4; |
| 149 | 149 | } elseif ($c >= 224) { |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | private static function mb_chunk_split($str, $len, $glue) |
| 183 | 183 | { |
| 184 | 184 | if (empty($str)) return false; |
| 185 | - $array = self::mbStringToArray ($str); |
|
| 185 | + $array = self::mbStringToArray($str); |
|
| 186 | 186 | $n = -1; |
| 187 | 187 | $new = Array(); |
| 188 | 188 | foreach ($array as $char) { |
| 189 | 189 | $n++; |
| 190 | - if ($n < $len) $new []= $char; |
|
| 190 | + if ($n < $len) $new [] = $char; |
|
| 191 | 191 | elseif ($n == $len) { |
| 192 | - $new []= $glue . $char; |
|
| 192 | + $new [] = $glue . $char; |
|
| 193 | 193 | $n = 0; |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @see http://php.net/manual/en/function.chunk-split.php |
| 206 | 206 | */ |
| 207 | - private static function mbStringToArray ($str) |
|
| 207 | + private static function mbStringToArray($str) |
|
| 208 | 208 | { |
| 209 | 209 | if (empty($str)) return false; |
| 210 | 210 | $len = mb_strlen($str); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function register() |
| 41 | 41 | { |
| 42 | - return array( T_OPEN_TAG ); |
|
| 42 | + return array(T_OPEN_TAG); |
|
| 43 | 43 | }//end register() |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return void |
| 76 | 76 | */ |
| 77 | - public function process(File $phpcsFile, $stackPtr ) |
|
| 77 | + public function process(File $phpcsFile, $stackPtr) |
|
| 78 | 78 | { |
| 79 | 79 | // We are only interested if this is the first open tag. |
| 80 | 80 | if ($stackPtr !== 0) { |