@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | - protected function processDoubleQuotedString (File $phpcsFile, $stackPtr, $dblQtString) |
|
| 92 | + protected function processDoubleQuotedString(File $phpcsFile, $stackPtr, $dblQtString) |
|
| 93 | 93 | { |
| 94 | 94 | $variableFound = FALSE; |
| 95 | - $strTokens = token_get_all('<?php '.$dblQtString); |
|
| 95 | + $strTokens = token_get_all('<?php ' . $dblQtString); |
|
| 96 | 96 | $strPtr = 1; // skip php opening tag added by ourselves |
| 97 | 97 | $requireDblQuotes = FALSE; |
| 98 | 98 | while ($strPtr < count($strTokens)) { |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - protected function processSingleQuotedString (File $phpcsFile, $stackPtr, $sglQtString) |
|
| 139 | + protected function processSingleQuotedString(File $phpcsFile, $stackPtr, $sglQtString) |
|
| 140 | 140 | { |
| 141 | 141 | $variableFound = FALSE; |
| 142 | - $strTokens = token_get_all('<?php '.$sglQtString); |
|
| 142 | + $strTokens = token_get_all('<?php ' . $sglQtString); |
|
| 143 | 143 | $strPtr = 1; // skip php opening tag added by ourselves |
| 144 | 144 | while ($strPtr < count($strTokens)) { |
| 145 | 145 | $strToken = $strTokens[$strPtr]; |
@@ -171,17 +171,17 @@ discard block |
||
| 171 | 171 | * @return array The attribute name associated to index 'var', an array with |
| 172 | 172 | * indexes 'obj' and 'attr' or an array with indexes 'arr' and 'idx'. |
| 173 | 173 | */ |
| 174 | - private function _parseVariable ($strTokens, &$strPtr) |
|
| 174 | + private function _parseVariable($strTokens, &$strPtr) |
|
| 175 | 175 | { |
| 176 | 176 | if ( ! in_array($strTokens[$strPtr][0], array(T_VARIABLE, T_STRING_VARNAME))) { |
| 177 | - throw new Exception ('Expected variable name.'); |
|
| 177 | + throw new Exception('Expected variable name.'); |
|
| 178 | 178 | } |
| 179 | 179 | $var = $strTokens[$strPtr][1]; |
| 180 | 180 | $strPtr++; |
| 181 | 181 | $startStrPtr = $strPtr; |
| 182 | 182 | try { |
| 183 | 183 | $attr = $this->_parseObjectAttribute($strTokens, $strPtr); |
| 184 | - return array ('obj' => $var, 'attr' => $attr); |
|
| 184 | + return array('obj' => $var, 'attr' => $attr); |
|
| 185 | 185 | } catch (Exception $err) { |
| 186 | 186 | if ($strPtr !== $startStrPtr) { |
| 187 | 187 | throw $err; |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | try { |
| 191 | 191 | $idx = $this->_parseArrayIndexes($strTokens, $strPtr); |
| 192 | - return array ('arr' => $var, 'idx' => $idx); |
|
| 192 | + return array('arr' => $var, 'idx' => $idx); |
|
| 193 | 193 | } catch (Exception $err) { |
| 194 | 194 | if ($strPtr !== $startStrPtr) { |
| 195 | 195 | throw $err; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | - return array ('var' => $var); |
|
| 198 | + return array('var' => $var); |
|
| 199 | 199 | }//end _parseVariable() |
| 200 | 200 | |
| 201 | 201 | |
@@ -215,21 +215,21 @@ discard block |
||
| 215 | 215 | * @return mixed The attribute name as a string, an array with indexes |
| 216 | 216 | * 'obj' and 'attr' or an array with indexes 'arr' and 'idx'. |
| 217 | 217 | */ |
| 218 | - private function _parseObjectAttribute ($strTokens, &$strPtr) |
|
| 218 | + private function _parseObjectAttribute($strTokens, &$strPtr) |
|
| 219 | 219 | { |
| 220 | 220 | if (T_OBJECT_OPERATOR !== $strTokens[$strPtr][0]) { |
| 221 | - throw new Exception ('Expected ->.'); |
|
| 221 | + throw new Exception('Expected ->.'); |
|
| 222 | 222 | } |
| 223 | 223 | $strPtr++; |
| 224 | 224 | if (T_STRING !== $strTokens[$strPtr][0]) { |
| 225 | - throw new Exception ('Expected an object attribute.'); |
|
| 225 | + throw new Exception('Expected an object attribute.'); |
|
| 226 | 226 | } |
| 227 | 227 | $attr = $strTokens[$strPtr][1]; |
| 228 | 228 | $strPtr++; |
| 229 | 229 | $startStrPtr = $strPtr; |
| 230 | 230 | try { |
| 231 | 231 | $sub_attr = $this->_parseObjectAttribute($strTokens, $strPtr); |
| 232 | - return array ('obj' => $attr, 'attr' => $sub_attr); |
|
| 232 | + return array('obj' => $attr, 'attr' => $sub_attr); |
|
| 233 | 233 | } catch (Exception $err) { |
| 234 | 234 | if ($strPtr !== $startStrPtr) { |
| 235 | 235 | throw $err; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | try { |
| 239 | 239 | $idx = $this->_parseArrayIndexes($strTokens, $strPtr); |
| 240 | - return array ('arr' => $attr, 'idx' => $idx); |
|
| 240 | + return array('arr' => $attr, 'idx' => $idx); |
|
| 241 | 241 | } catch (Exception $err) { |
| 242 | 242 | if ($strPtr !== $startStrPtr) { |
| 243 | 243 | throw $err; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return array Indexes in the same order as in the string. |
| 262 | 262 | */ |
| 263 | - private function _parseArrayIndexes ($strTokens, &$strPtr) |
|
| 263 | + private function _parseArrayIndexes($strTokens, &$strPtr) |
|
| 264 | 264 | { |
| 265 | 265 | $indexes = array($this->_parseArrayIndex($strTokens, $strPtr)); |
| 266 | 266 | try { |
@@ -290,19 +290,19 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @return string Index between the 2 square brackets |
| 292 | 292 | */ |
| 293 | - private function _parseArrayIndex ($strTokens, &$strPtr) |
|
| 293 | + private function _parseArrayIndex($strTokens, &$strPtr) |
|
| 294 | 294 | { |
| 295 | 295 | if ('[' !== $strTokens[$strPtr]) { |
| 296 | - throw new Exception ('Expected [.'); |
|
| 296 | + throw new Exception('Expected [.'); |
|
| 297 | 297 | } |
| 298 | 298 | $strPtr++; |
| 299 | - if (! in_array($strTokens[$strPtr][0], array(T_CONSTANT_ENCAPSED_STRING, T_LNUMBER))) { |
|
| 300 | - throw new Exception ('Expected an array index.'); |
|
| 299 | + if ( ! in_array($strTokens[$strPtr][0], array(T_CONSTANT_ENCAPSED_STRING, T_LNUMBER))) { |
|
| 300 | + throw new Exception('Expected an array index.'); |
|
| 301 | 301 | } |
| 302 | 302 | $index = $strTokens[$strPtr][1]; |
| 303 | 303 | $strPtr++; |
| 304 | 304 | if (']' !== $strTokens[$strPtr]) { |
| 305 | - throw new Exception ('Expected ].'); |
|
| 305 | + throw new Exception('Expected ].'); |
|
| 306 | 306 | } |
| 307 | 307 | $strPtr++; |
| 308 | 308 | return $index; |
@@ -380,11 +380,11 @@ discard block |
||
| 380 | 380 | * |
| 381 | 381 | * @return void |
| 382 | 382 | */ |
| 383 | - protected function processDoubleQuotedString (File $phpcsFile, $stackPtr, $qtString) |
|
| 383 | + protected function processDoubleQuotedString(File $phpcsFile, $stackPtr, $qtString) |
|
| 384 | 384 | { |
| 385 | 385 | // so there should be at least a single quote or a special char |
| 386 | 386 | // if there are the 2 kinds of quote and no special char, then add a warning |
| 387 | - $has_variable = parent::processDoubleQuotedString($phpcsFile, $stackPtr, '"'.$qtString.'"'); |
|
| 387 | + $has_variable = parent::processDoubleQuotedString($phpcsFile, $stackPtr, '"' . $qtString . '"'); |
|
| 388 | 388 | $has_specific_sequence = $this->_hasSpecificSequence($qtString); |
| 389 | 389 | $dbl_qt_at = strpos($qtString, '"'); |
| 390 | 390 | $smpl_qt_at = strpos($qtString, "'"); |
@@ -413,14 +413,14 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @return void |
| 415 | 415 | */ |
| 416 | - protected function processSingleQuotedString (File $phpcsFile, $stackPtr, $qtString) |
|
| 416 | + protected function processSingleQuotedString(File $phpcsFile, $stackPtr, $qtString) |
|
| 417 | 417 | { |
| 418 | 418 | // if there is single quotes without additional double quotes, |
| 419 | 419 | // then user is allowed to use double quote to avoid having to |
| 420 | 420 | // escape single quotes. Don't add the warning, if an error was |
| 421 | 421 | // already added, because a variable was found in a single-quoted |
| 422 | 422 | // string. |
| 423 | - $has_variable = parent::processSingleQuotedString($phpcsFile, $stackPtr, "'".$qtString."'"); |
|
| 423 | + $has_variable = parent::processSingleQuotedString($phpcsFile, $stackPtr, "'" . $qtString . "'"); |
|
| 424 | 424 | $dbl_qt_at = strpos($qtString, '"'); |
| 425 | 425 | $smpl_qt_at = strpos($qtString, "'"); |
| 426 | 426 | if (false === $has_variable && false !== $smpl_qt_at && false === $dbl_qt_at) { |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $tokens = $phpcsFile->getTokens(); |
| 96 | 96 | if ($tokens[$stackPtr]['content']{0} === '#') { |
| 97 | - $error = 'Perl-style comments are not allowed; use "// Comment" or DocBlock comments instead'; |
|
| 97 | + $error = 'Perl-style comments are not allowed; use "// Comment" or DocBlock comments instead'; |
|
| 98 | 98 | $phpcsFile->addError($error, $stackPtr, 'WrongStyle'); |
| 99 | 99 | return FALSE; |
| 100 | 100 | } else if (substr($tokens[$stackPtr]['content'], 0, 2) === '/*' |
| 101 | 101 | || $tokens[$stackPtr]['content']{0} === '*' |
| 102 | 102 | ) { |
| 103 | - $error = 'Multi lines comments are not allowed; use "// Comment" DocBlock comments instead'; |
|
| 103 | + $error = 'Multi lines comments are not allowed; use "// Comment" DocBlock comments instead'; |
|
| 104 | 104 | $phpcsFile->addError($error, $stackPtr, 'WrongStyle'); |
| 105 | 105 | return FALSE; |
| 106 | 106 | } else if (substr($tokens[$stackPtr]['content'], 0, 2) !== '//') { |
| 107 | - $error = 'Use single line or DocBlock comments within code'; |
|
| 107 | + $error = 'Use single line or DocBlock comments within code'; |
|
| 108 | 108 | $phpcsFile->addError($error, $stackPtr, 'WrongStyle'); |
| 109 | 109 | return FALSE; |
| 110 | 110 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $firstPreviousSpacePtr--; |
| 163 | 163 | } |
| 164 | 164 | if ($tokens[$firstPreviousSpacePtr]['line'] >= $tokens[$firstCommentPtr]['line'] - 1) { |
| 165 | - $error = "Please add a blank line before comments counting more than {$this->longCommentLimit} lines."; |
|
| 165 | + $error = "Please add a blank line before comments counting more than {$this->longCommentLimit} lines."; |
|
| 166 | 166 | $phpcsFile->addError($error, $firstCommentPtr, 'LongCommentWithoutSpacing'); |
| 167 | 167 | $hasBlankLinesAround = FALSE; |
| 168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $lastNextSpacePtr++; |
| 175 | 175 | } |
| 176 | 176 | if ($tokens[$lastNextSpacePtr]['line'] <= $tokens[$lastCommentPtr]['line'] + 1) { |
| 177 | - $error = "Please add a blank line after comments counting more than {$this->longCommentLimit} lines."; |
|
| 177 | + $error = "Please add a blank line after comments counting more than {$this->longCommentLimit} lines."; |
|
| 178 | 178 | $phpcsFile->addError($error, $lastCommentPtr, 'LongCommentWithoutSpacing'); |
| 179 | 179 | $hasBlankLinesAround = FALSE; |
| 180 | 180 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | $file_patterns = [ |
| 5 | 5 | 'app/bootstrap.php', |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | // [0] => token type constant |
| 34 | 34 | // [1] => raw sytax parsed to that token |
| 35 | 35 | // [2] => line number |
| 36 | - foreach($tokens as $token) |
|
| 36 | + foreach ($tokens as $token) |
|
| 37 | 37 | { |
| 38 | 38 | // Since we only care about opening docblocks, |
| 39 | 39 | // bail out when we get to the namespace token |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * Anime List Client |
| 4 | 4 | * |