@@ -193,7 +193,7 @@ |
||
| 193 | 193 | /** |
| 194 | 194 | * Return the file path of the current file being processed. |
| 195 | 195 | * |
| 196 | - * @return void |
|
| 196 | + * @return string |
|
| 197 | 197 | */ |
| 198 | 198 | function key() |
| 199 | 199 | { |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | * |
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | - public function addFile($path, $file=null) |
|
| 109 | + public function addFile($path, $file = null) |
|
| 110 | 110 | { |
| 111 | 111 | // No filtering is done for STDIN. |
| 112 | 112 | if ($path === 'STDIN' |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | namespace Symplify\PHP7_CodeSniffer\Reports; |
| 11 | 11 | |
| 12 | 12 | use Symplify\PHP7_CodeSniffer\Files\File; |
| 13 | -use Symplify\PHP7_CodeSniffer\Util; |
|
| 14 | 13 | |
| 15 | 14 | class Diff implements Report |
| 16 | 15 | { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | /** |
| 357 | 357 | * Start recording actions for a changeset. |
| 358 | 358 | * |
| 359 | - * @return void |
|
| 359 | + * @return false|null |
|
| 360 | 360 | */ |
| 361 | 361 | public function beginChangeset() |
| 362 | 362 | { |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | /** |
| 384 | 384 | * Stop recording actions for a changeset, and apply logged changes. |
| 385 | 385 | * |
| 386 | - * @return boolean |
|
| 386 | + * @return false|null |
|
| 387 | 387 | */ |
| 388 | 388 | public function endChangeset() |
| 389 | 389 | { |
@@ -529,9 +529,9 @@ |
||
| 529 | 529 | |
| 530 | 530 | if (isset($this->_oldTokenValues[$stackPtr]) === false) { |
| 531 | 531 | $this->_oldTokenValues[$stackPtr] = array( |
| 532 | - 'curr' => $content, |
|
| 533 | - 'prev' => $this->_tokens[$stackPtr], |
|
| 534 | - 'loop' => $this->loops, |
|
| 532 | + 'curr' => $content, |
|
| 533 | + 'prev' => $this->_tokens[$stackPtr], |
|
| 534 | + 'loop' => $this->loops, |
|
| 535 | 535 | ); |
| 536 | 536 | } else { |
| 537 | 537 | if ($this->_oldTokenValues[$stackPtr]['prev'] === $content |
@@ -283,14 +283,14 @@ |
||
| 283 | 283 | foreach ($diffLines as $line) { |
| 284 | 284 | if (isset($line[0]) === true) { |
| 285 | 285 | switch ($line[0]) { |
| 286 | - case '-': |
|
| 287 | - $diff[] = "\033[31m$line\033[0m"; |
|
| 288 | - break; |
|
| 289 | - case '+': |
|
| 290 | - $diff[] = "\033[32m$line\033[0m"; |
|
| 291 | - break; |
|
| 292 | - default: |
|
| 293 | - $diff[] = $line; |
|
| 286 | + case '-': |
|
| 287 | + $diff[] = "\033[31m$line\033[0m"; |
|
| 288 | + break; |
|
| 289 | + case '+': |
|
| 290 | + $diff[] = "\033[32m$line\033[0m"; |
|
| 291 | + break; |
|
| 292 | + default: |
|
| 293 | + $diff[] = $line; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return string |
| 239 | 239 | */ |
| 240 | - public function generateDiff($filePath=null, $colors=true) |
|
| 240 | + public function generateDiff($filePath = null, $colors = true) |
|
| 241 | 241 | { |
| 242 | 242 | if ($filePath === null) { |
| 243 | 243 | $filePath = $this->_currentFile->getFilename(); |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | * |
| 655 | 655 | * @return bool If the change was accepted. |
| 656 | 656 | */ |
| 657 | - public function substrToken($stackPtr, $start, $length=null) |
|
| 657 | + public function substrToken($stackPtr, $start, $length = null) |
|
| 658 | 658 | { |
| 659 | 659 | $current = $this->getTokenContent($stackPtr); |
| 660 | 660 | |
@@ -890,26 +890,26 @@ |
||
| 890 | 890 | $nestedBraces = 0; |
| 891 | 891 | for ($start = $from; $start >= 0; $start--) { |
| 892 | 892 | switch ($pattern[$start]) { |
| 893 | - case '(': |
|
| 894 | - if ($nestedParenthesis === 0) { |
|
| 895 | - $skip['to'] = 'parenthesis_closer'; |
|
| 896 | - } |
|
| 893 | + case '(': |
|
| 894 | + if ($nestedParenthesis === 0) { |
|
| 895 | + $skip['to'] = 'parenthesis_closer'; |
|
| 896 | + } |
|
| 897 | 897 | |
| 898 | - $nestedParenthesis--; |
|
| 899 | - break; |
|
| 900 | - case '{': |
|
| 901 | - if ($nestedBraces === 0) { |
|
| 902 | - $skip['to'] = 'scope_closer'; |
|
| 903 | - } |
|
| 898 | + $nestedParenthesis--; |
|
| 899 | + break; |
|
| 900 | + case '{': |
|
| 901 | + if ($nestedBraces === 0) { |
|
| 902 | + $skip['to'] = 'scope_closer'; |
|
| 903 | + } |
|
| 904 | 904 | |
| 905 | - $nestedBraces--; |
|
| 906 | - break; |
|
| 907 | - case '}': |
|
| 908 | - $nestedBraces++; |
|
| 909 | - break; |
|
| 910 | - case ')': |
|
| 911 | - $nestedParenthesis++; |
|
| 912 | - break; |
|
| 905 | + $nestedBraces--; |
|
| 906 | + break; |
|
| 907 | + case '}': |
|
| 908 | + $nestedBraces++; |
|
| 909 | + break; |
|
| 910 | + case ')': |
|
| 911 | + $nestedParenthesis++; |
|
| 912 | + break; |
|
| 913 | 913 | }//end switch |
| 914 | 914 | |
| 915 | 915 | if (isset($skip['to']) === true) { |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | * |
| 79 | 79 | * @param boolean $ignoreComments If true, comments will be ignored. |
| 80 | 80 | */ |
| 81 | - public function __construct($ignoreComments=null) |
|
| 81 | + public function __construct($ignoreComments = null) |
|
| 82 | 82 | { |
| 83 | 83 | // This is here for backwards compatibility. |
| 84 | 84 | if ($ignoreComments !== null) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | /** |
| 178 | 178 | * Processes the test. |
| 179 | 179 | * |
| 180 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where the |
|
| 180 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where the |
|
| 181 | 181 | * token occurred. |
| 182 | 182 | * @param int $stackPtr The position in the tokens stack |
| 183 | 183 | * where the listening token type was |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * for checking, which includes are |
| 248 | 248 | * parsed token representation of the |
| 249 | 249 | * pattern. |
| 250 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where the |
|
| 250 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where the |
|
| 251 | 251 | * token occurred. |
| 252 | 252 | * @param int $stackPtr The position in the tokens stack where |
| 253 | 253 | * the listening token type was found. |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | /** |
| 747 | 747 | * Processes any tokens registered with registerSupplementary(). |
| 748 | 748 | * |
| 749 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where to |
|
| 749 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where to |
|
| 750 | 750 | * process the skip. |
| 751 | 751 | * @param int $stackPtr The position in the tokens stack to |
| 752 | 752 | * process. |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | namespace Symplify\PHP7_CodeSniffer\Sniffs; |
| 11 | 11 | |
| 12 | 12 | use Symplify\PHP7_CodeSniffer\Files\File; |
| 13 | -use Symplify\PHP7_CodeSniffer\Config; |
|
| 14 | 13 | use Symplify\PHP7_CodeSniffer\Util\Tokens; |
| 15 | 14 | use Symplify\PHP7_CodeSniffer\Tokenizers\PHP; |
| 16 | 15 | use Symplify\PHP7_CodeSniffer\Exceptions\RuntimeException; |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | $listenTypes[] = $tokenType; |
| 98 | 98 | |
| 99 | 99 | $patternArray = array( |
| 100 | - 'listen_pos' => $pos, |
|
| 101 | - 'pattern' => $parsedPattern, |
|
| 102 | - 'pattern_code' => $pattern, |
|
| 100 | + 'listen_pos' => $pos, |
|
| 101 | + 'pattern' => $parsedPattern, |
|
| 102 | + 'pattern_code' => $pattern, |
|
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | 105 | if (isset($this->_parsedPatterns[$tokenType]) === false) { |
@@ -743,17 +743,17 @@ discard block |
||
| 743 | 743 | }//end registerSupplementary() |
| 744 | 744 | |
| 745 | 745 | |
| 746 | - /** |
|
| 747 | - * Processes any tokens registered with registerSupplementary(). |
|
| 748 | - * |
|
| 749 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where to |
|
| 750 | - * process the skip. |
|
| 751 | - * @param int $stackPtr The position in the tokens stack to |
|
| 752 | - * process. |
|
| 753 | - * |
|
| 754 | - * @return void |
|
| 755 | - * @see registerSupplementary() |
|
| 756 | - */ |
|
| 746 | + /** |
|
| 747 | + * Processes any tokens registered with registerSupplementary(). |
|
| 748 | + * |
|
| 749 | + * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where to |
|
| 750 | + * process the skip. |
|
| 751 | + * @param int $stackPtr The position in the tokens stack to |
|
| 752 | + * process. |
|
| 753 | + * |
|
| 754 | + * @return void |
|
| 755 | + * @see registerSupplementary() |
|
| 756 | + */ |
|
| 757 | 757 | protected function processSupplementary(File $phpcsFile, $stackPtr) |
| 758 | 758 | { |
| 759 | 759 | |
@@ -926,10 +926,10 @@ discard block |
||
| 926 | 926 | $patterns = array(); |
| 927 | 927 | foreach ($tokens as $patternInfo) { |
| 928 | 928 | $patterns[] = array( |
| 929 | - 'type' => 'token', |
|
| 930 | - 'token' => $patternInfo['code'], |
|
| 931 | - 'value' => $patternInfo['content'], |
|
| 932 | - ); |
|
| 929 | + 'type' => 'token', |
|
| 930 | + 'token' => $patternInfo['code'], |
|
| 931 | + 'value' => $patternInfo['content'], |
|
| 932 | + ); |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | return $patterns; |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | public function __construct( |
| 87 | 87 | array $scopeTokens, |
| 88 | 88 | array $tokens, |
| 89 | - $listenOutside=false |
|
| 89 | + $listenOutside = false |
|
| 90 | 90 | ) { |
| 91 | 91 | if (empty($scopeTokens) === true) { |
| 92 | 92 | $error = 'The scope tokens list cannot be empty'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | /** |
| 118 | 118 | * Processes the tokens that this test is listening for. |
| 119 | 119 | * |
| 120 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The file where this token was found. |
|
| 120 | + * @param File $phpcsFile The file where this token was found. |
|
| 121 | 121 | * @param int $stackPtr The position in the stack where this |
| 122 | 122 | * token was found. |
| 123 | 123 | * |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * Processes a token that is found within the scope that this test is |
| 148 | 148 | * listening to. |
| 149 | 149 | * |
| 150 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The file where this token was found. |
|
| 150 | + * @param File $phpcsFile The file where this token was found. |
|
| 151 | 151 | * @param int $stackPtr The position in the stack where this |
| 152 | 152 | * token was found. |
| 153 | 153 | * @param int $currScope The position in the tokens array that |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * Processes a token that is found within the scope that this test is |
| 164 | 164 | * listening to. |
| 165 | 165 | * |
| 166 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The file where this token was found. |
|
| 166 | + * @param File $phpcsFile The file where this token was found. |
|
| 167 | 167 | * @param int $stackPtr The position in the stack where this |
| 168 | 168 | * token was found. |
| 169 | 169 | * |
@@ -67,17 +67,17 @@ |
||
| 67 | 67 | public function __construct() |
| 68 | 68 | { |
| 69 | 69 | $scopes = array( |
| 70 | - T_CLASS, |
|
| 71 | - T_TRAIT, |
|
| 72 | - T_INTERFACE, |
|
| 73 | - ); |
|
| 70 | + T_CLASS, |
|
| 71 | + T_TRAIT, |
|
| 72 | + T_INTERFACE, |
|
| 73 | + ); |
|
| 74 | 74 | |
| 75 | 75 | $listen = array( |
| 76 | - T_FUNCTION, |
|
| 77 | - T_VARIABLE, |
|
| 78 | - T_DOUBLE_QUOTED_STRING, |
|
| 79 | - T_HEREDOC, |
|
| 80 | - ); |
|
| 76 | + T_FUNCTION, |
|
| 77 | + T_VARIABLE, |
|
| 78 | + T_DOUBLE_QUOTED_STRING, |
|
| 79 | + T_HEREDOC, |
|
| 80 | + ); |
|
| 81 | 81 | |
| 82 | 82 | parent::__construct($scopes, $listen, true); |
| 83 | 83 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * Processes the token in the specified Symplify\PHP7_CodeSniffer_File. |
| 71 | 71 | * |
| 72 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 72 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 73 | 73 | * token was found. |
| 74 | 74 | * @param int $stackPtr The position where the token was found. |
| 75 | 75 | * @param array $currScope The current scope opener token. |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Processes the token outside the scope in the file. |
| 145 | 145 | * |
| 146 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 146 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 147 | 147 | * token was found. |
| 148 | 148 | * @param int $stackPtr The position where the token was found. |
| 149 | 149 | * |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | /** |
| 172 | 172 | * Called to process class member vars. |
| 173 | 173 | * |
| 174 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 174 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 175 | 175 | * token was found. |
| 176 | 176 | * @param int $stackPtr The position where the token was found. |
| 177 | 177 | * |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | /** |
| 184 | 184 | * Called to process normal member vars. |
| 185 | 185 | * |
| 186 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 186 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 187 | 187 | * token was found. |
| 188 | 188 | * @param int $stackPtr The position where the token was found. |
| 189 | 189 | * |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * Note that there may be more than one variable in the string, which will |
| 199 | 199 | * result only in one call for the string or one call per line for heredocs. |
| 200 | 200 | * |
| 201 | - * @param Symplify\PHP7_CodeSniffer_File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 201 | + * @param File $phpcsFile The Symplify\PHP7_CodeSniffer file where this |
|
| 202 | 202 | * token was found. |
| 203 | 203 | * @param int $stackPtr The position where the double quoted |
| 204 | 204 | * string was found. |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | namespace Symplify\PHP7_CodeSniffer\Sniffs; |
| 17 | 17 | |
| 18 | 18 | use Symplify\PHP7_CodeSniffer\Files\File; |
| 19 | -use Symplify\PHP7_CodeSniffer\Exceptions\RuntimeException; |
|
| 20 | 19 | |
| 21 | 20 | abstract class AbstractVariableSniff extends AbstractScopeSniff |
| 22 | 21 | { |
@@ -780,11 +780,11 @@ discard block |
||
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $checkCodes = array( |
| 783 | - $sniffCode, |
|
| 784 | - $parts[0].'.'.$parts[1].'.'.$parts[2], |
|
| 785 | - $parts[0].'.'.$parts[1], |
|
| 786 | - $parts[0], |
|
| 787 | - ); |
|
| 783 | + $sniffCode, |
|
| 784 | + $parts[0].'.'.$parts[1].'.'.$parts[2], |
|
| 785 | + $parts[0].'.'.$parts[1], |
|
| 786 | + $parts[0], |
|
| 787 | + ); |
|
| 788 | 788 | }//end if |
| 789 | 789 | |
| 790 | 790 | // Filter out any messages for sniffs that shouldn't have run |
@@ -860,8 +860,8 @@ discard block |
||
| 860 | 860 | // While there is support for a type of each pattern |
| 861 | 861 | // (absolute or relative) we don't actually support it here. |
| 862 | 862 | $replacements = array( |
| 863 | - '\\,' => ',', |
|
| 864 | - '*' => '.*', |
|
| 863 | + '\\,' => ',', |
|
| 864 | + '*' => '.*', |
|
| 865 | 865 | ); |
| 866 | 866 | |
| 867 | 867 | // We assume a / directory separator, as do the exclude rules |
@@ -908,12 +908,12 @@ discard block |
||
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | $messages[$line][$column][] = array( |
| 911 | - 'message' => $message, |
|
| 912 | - 'source' => $sniffCode, |
|
| 913 | - 'listener' => $this->activeListener, |
|
| 914 | - 'severity' => $severity, |
|
| 915 | - 'fixable' => $fixable, |
|
| 916 | - ); |
|
| 911 | + 'message' => $message, |
|
| 912 | + 'source' => $sniffCode, |
|
| 913 | + 'listener' => $this->activeListener, |
|
| 914 | + 'severity' => $severity, |
|
| 915 | + 'fixable' => $fixable, |
|
| 916 | + ); |
|
| 917 | 917 | |
| 918 | 918 | if (PHP_CODESNIFFER_VERBOSITY > 1 |
| 919 | 919 | && $this->fixer->enabled === true |
@@ -1328,16 +1328,16 @@ discard block |
||
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | $valid = array( |
| 1331 | - T_PUBLIC => T_PUBLIC, |
|
| 1332 | - T_PRIVATE => T_PRIVATE, |
|
| 1333 | - T_PROTECTED => T_PROTECTED, |
|
| 1334 | - T_STATIC => T_STATIC, |
|
| 1335 | - T_FINAL => T_FINAL, |
|
| 1336 | - T_ABSTRACT => T_ABSTRACT, |
|
| 1337 | - T_WHITESPACE => T_WHITESPACE, |
|
| 1338 | - T_COMMENT => T_COMMENT, |
|
| 1339 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1340 | - ); |
|
| 1331 | + T_PUBLIC => T_PUBLIC, |
|
| 1332 | + T_PRIVATE => T_PRIVATE, |
|
| 1333 | + T_PROTECTED => T_PROTECTED, |
|
| 1334 | + T_STATIC => T_STATIC, |
|
| 1335 | + T_FINAL => T_FINAL, |
|
| 1336 | + T_ABSTRACT => T_ABSTRACT, |
|
| 1337 | + T_WHITESPACE => T_WHITESPACE, |
|
| 1338 | + T_COMMENT => T_COMMENT, |
|
| 1339 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1340 | + ); |
|
| 1341 | 1341 | |
| 1342 | 1342 | $scope = 'public'; |
| 1343 | 1343 | $scopeSpecified = false; |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | 'is_final' => $isFinal, |
| 1384 | 1384 | 'is_static' => $isStatic, |
| 1385 | 1385 | 'is_closure' => $isClosure, |
| 1386 | - ); |
|
| 1386 | + ); |
|
| 1387 | 1387 | |
| 1388 | 1388 | }//end getMethodProperties() |
| 1389 | 1389 | |
@@ -1441,16 +1441,16 @@ discard block |
||
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | $valid = array( |
| 1444 | - T_PUBLIC => T_PUBLIC, |
|
| 1445 | - T_PRIVATE => T_PRIVATE, |
|
| 1446 | - T_PROTECTED => T_PROTECTED, |
|
| 1447 | - T_STATIC => T_STATIC, |
|
| 1448 | - T_WHITESPACE => T_WHITESPACE, |
|
| 1449 | - T_COMMENT => T_COMMENT, |
|
| 1450 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1451 | - T_VARIABLE => T_VARIABLE, |
|
| 1452 | - T_COMMA => T_COMMA, |
|
| 1453 | - ); |
|
| 1444 | + T_PUBLIC => T_PUBLIC, |
|
| 1445 | + T_PRIVATE => T_PRIVATE, |
|
| 1446 | + T_PROTECTED => T_PROTECTED, |
|
| 1447 | + T_STATIC => T_STATIC, |
|
| 1448 | + T_WHITESPACE => T_WHITESPACE, |
|
| 1449 | + T_COMMENT => T_COMMENT, |
|
| 1450 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1451 | + T_VARIABLE => T_VARIABLE, |
|
| 1452 | + T_COMMA => T_COMMA, |
|
| 1453 | + ); |
|
| 1454 | 1454 | |
| 1455 | 1455 | $scope = 'public'; |
| 1456 | 1456 | $scopeSpecified = false; |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | 'scope' => $scope, |
| 1485 | 1485 | 'scope_specified' => $scopeSpecified, |
| 1486 | 1486 | 'is_static' => $isStatic, |
| 1487 | - ); |
|
| 1487 | + ); |
|
| 1488 | 1488 | |
| 1489 | 1489 | }//end getMemberProperties() |
| 1490 | 1490 | |
@@ -1514,12 +1514,12 @@ discard block |
||
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | $valid = array( |
| 1517 | - T_FINAL => T_FINAL, |
|
| 1518 | - T_ABSTRACT => T_ABSTRACT, |
|
| 1519 | - T_WHITESPACE => T_WHITESPACE, |
|
| 1520 | - T_COMMENT => T_COMMENT, |
|
| 1521 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1522 | - ); |
|
| 1517 | + T_FINAL => T_FINAL, |
|
| 1518 | + T_ABSTRACT => T_ABSTRACT, |
|
| 1519 | + T_WHITESPACE => T_WHITESPACE, |
|
| 1520 | + T_COMMENT => T_COMMENT, |
|
| 1521 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
| 1522 | + ); |
|
| 1523 | 1523 | |
| 1524 | 1524 | $isAbstract = false; |
| 1525 | 1525 | $isFinal = false; |
@@ -1543,7 +1543,7 @@ discard block |
||
| 1543 | 1543 | return array( |
| 1544 | 1544 | 'is_abstract' => $isAbstract, |
| 1545 | 1545 | 'is_final' => $isFinal, |
| 1546 | - ); |
|
| 1546 | + ); |
|
| 1547 | 1547 | |
| 1548 | 1548 | }//end getClassProperties() |
| 1549 | 1549 | |
@@ -1893,17 +1893,17 @@ discard block |
||
| 1893 | 1893 | public function findEndOfStatement($start, $ignore=null) |
| 1894 | 1894 | { |
| 1895 | 1895 | $endTokens = array( |
| 1896 | - T_COLON => true, |
|
| 1897 | - T_COMMA => true, |
|
| 1898 | - T_DOUBLE_ARROW => true, |
|
| 1899 | - T_SEMICOLON => true, |
|
| 1900 | - T_CLOSE_PARENTHESIS => true, |
|
| 1901 | - T_CLOSE_SQUARE_BRACKET => true, |
|
| 1902 | - T_CLOSE_CURLY_BRACKET => true, |
|
| 1903 | - T_CLOSE_SHORT_ARRAY => true, |
|
| 1904 | - T_OPEN_TAG => true, |
|
| 1905 | - T_CLOSE_TAG => true, |
|
| 1906 | - ); |
|
| 1896 | + T_COLON => true, |
|
| 1897 | + T_COMMA => true, |
|
| 1898 | + T_DOUBLE_ARROW => true, |
|
| 1899 | + T_SEMICOLON => true, |
|
| 1900 | + T_CLOSE_PARENTHESIS => true, |
|
| 1901 | + T_CLOSE_SQUARE_BRACKET => true, |
|
| 1902 | + T_CLOSE_CURLY_BRACKET => true, |
|
| 1903 | + T_CLOSE_SHORT_ARRAY => true, |
|
| 1904 | + T_OPEN_TAG => true, |
|
| 1905 | + T_CLOSE_TAG => true, |
|
| 1906 | + ); |
|
| 1907 | 1907 | |
| 1908 | 1908 | if ($ignore !== null) { |
| 1909 | 1909 | $ignore = (array) $ignore; |
@@ -2116,9 +2116,9 @@ discard block |
||
| 2116 | 2116 | } |
| 2117 | 2117 | |
| 2118 | 2118 | $find = array( |
| 2119 | - T_NS_SEPARATOR, |
|
| 2120 | - T_STRING, |
|
| 2121 | - T_WHITESPACE, |
|
| 2119 | + T_NS_SEPARATOR, |
|
| 2120 | + T_STRING, |
|
| 2121 | + T_WHITESPACE, |
|
| 2122 | 2122 | ); |
| 2123 | 2123 | |
| 2124 | 2124 | $end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true); |
@@ -1209,88 +1209,88 @@ discard block |
||
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | switch ($this->tokens[$i]['code']) { |
| 1212 | - case T_BITWISE_AND: |
|
| 1213 | - $passByReference = true; |
|
| 1214 | - break; |
|
| 1215 | - case T_VARIABLE: |
|
| 1216 | - $currVar = $i; |
|
| 1217 | - break; |
|
| 1218 | - case T_ELLIPSIS: |
|
| 1219 | - $variableLength = true; |
|
| 1220 | - break; |
|
| 1221 | - case T_ARRAY_HINT: |
|
| 1222 | - case T_CALLABLE: |
|
| 1223 | - $typeHint = $this->tokens[$i]['content']; |
|
| 1224 | - break; |
|
| 1225 | - case T_STRING: |
|
| 1226 | - // This is a string, so it may be a type hint, but it could |
|
| 1227 | - // also be a constant used as a default value. |
|
| 1228 | - $prevComma = false; |
|
| 1229 | - for ($t = $i; $t >= $opener; $t--) { |
|
| 1230 | - if ($this->tokens[$t]['code'] === T_COMMA) { |
|
| 1231 | - $prevComma = $t; |
|
| 1232 | - break; |
|
| 1212 | + case T_BITWISE_AND: |
|
| 1213 | + $passByReference = true; |
|
| 1214 | + break; |
|
| 1215 | + case T_VARIABLE: |
|
| 1216 | + $currVar = $i; |
|
| 1217 | + break; |
|
| 1218 | + case T_ELLIPSIS: |
|
| 1219 | + $variableLength = true; |
|
| 1220 | + break; |
|
| 1221 | + case T_ARRAY_HINT: |
|
| 1222 | + case T_CALLABLE: |
|
| 1223 | + $typeHint = $this->tokens[$i]['content']; |
|
| 1224 | + break; |
|
| 1225 | + case T_STRING: |
|
| 1226 | + // This is a string, so it may be a type hint, but it could |
|
| 1227 | + // also be a constant used as a default value. |
|
| 1228 | + $prevComma = false; |
|
| 1229 | + for ($t = $i; $t >= $opener; $t--) { |
|
| 1230 | + if ($this->tokens[$t]['code'] === T_COMMA) { |
|
| 1231 | + $prevComma = $t; |
|
| 1232 | + break; |
|
| 1233 | + } |
|
| 1233 | 1234 | } |
| 1234 | - } |
|
| 1235 | 1235 | |
| 1236 | - if ($prevComma !== false) { |
|
| 1237 | - $nextEquals = false; |
|
| 1238 | - for ($t = $prevComma; $t < $i; $t++) { |
|
| 1239 | - if ($this->tokens[$t]['code'] === T_EQUAL) { |
|
| 1240 | - $nextEquals = $t; |
|
| 1236 | + if ($prevComma !== false) { |
|
| 1237 | + $nextEquals = false; |
|
| 1238 | + for ($t = $prevComma; $t < $i; $t++) { |
|
| 1239 | + if ($this->tokens[$t]['code'] === T_EQUAL) { |
|
| 1240 | + $nextEquals = $t; |
|
| 1241 | + break; |
|
| 1242 | + } |
|
| 1243 | + } |
|
| 1244 | + |
|
| 1245 | + if ($nextEquals !== false) { |
|
| 1241 | 1246 | break; |
| 1242 | 1247 | } |
| 1243 | 1248 | } |
| 1244 | 1249 | |
| 1245 | - if ($nextEquals !== false) { |
|
| 1246 | - break; |
|
| 1250 | + if ($defaultStart === null) { |
|
| 1251 | + $typeHint .= $this->tokens[$i]['content']; |
|
| 1252 | + } |
|
| 1253 | + break; |
|
| 1254 | + case T_NS_SEPARATOR: |
|
| 1255 | + // Part of a type hint or default value. |
|
| 1256 | + if ($defaultStart === null) { |
|
| 1257 | + $typeHint .= $this->tokens[$i]['content']; |
|
| 1258 | + } |
|
| 1259 | + break; |
|
| 1260 | + case T_CLOSE_PARENTHESIS: |
|
| 1261 | + case T_COMMA: |
|
| 1262 | + // If it's null, then there must be no parameters for this |
|
| 1263 | + // method. |
|
| 1264 | + if ($currVar === null) { |
|
| 1265 | + continue; |
|
| 1247 | 1266 | } |
| 1248 | - } |
|
| 1249 | - |
|
| 1250 | - if ($defaultStart === null) { |
|
| 1251 | - $typeHint .= $this->tokens[$i]['content']; |
|
| 1252 | - } |
|
| 1253 | - break; |
|
| 1254 | - case T_NS_SEPARATOR: |
|
| 1255 | - // Part of a type hint or default value. |
|
| 1256 | - if ($defaultStart === null) { |
|
| 1257 | - $typeHint .= $this->tokens[$i]['content']; |
|
| 1258 | - } |
|
| 1259 | - break; |
|
| 1260 | - case T_CLOSE_PARENTHESIS: |
|
| 1261 | - case T_COMMA: |
|
| 1262 | - // If it's null, then there must be no parameters for this |
|
| 1263 | - // method. |
|
| 1264 | - if ($currVar === null) { |
|
| 1265 | - continue; |
|
| 1266 | - } |
|
| 1267 | 1267 | |
| 1268 | - $vars[$paramCount] = array(); |
|
| 1269 | - $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; |
|
| 1268 | + $vars[$paramCount] = array(); |
|
| 1269 | + $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; |
|
| 1270 | 1270 | |
| 1271 | - if ($defaultStart !== null) { |
|
| 1272 | - $vars[$paramCount]['default'] |
|
| 1273 | - = $this->getTokensAsString( |
|
| 1274 | - $defaultStart, |
|
| 1275 | - ($i - $defaultStart) |
|
| 1276 | - ); |
|
| 1277 | - } |
|
| 1271 | + if ($defaultStart !== null) { |
|
| 1272 | + $vars[$paramCount]['default'] |
|
| 1273 | + = $this->getTokensAsString( |
|
| 1274 | + $defaultStart, |
|
| 1275 | + ($i - $defaultStart) |
|
| 1276 | + ); |
|
| 1277 | + } |
|
| 1278 | 1278 | |
| 1279 | - $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
| 1280 | - $vars[$paramCount]['variable_length'] = $variableLength; |
|
| 1281 | - $vars[$paramCount]['type_hint'] = $typeHint; |
|
| 1279 | + $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
| 1280 | + $vars[$paramCount]['variable_length'] = $variableLength; |
|
| 1281 | + $vars[$paramCount]['type_hint'] = $typeHint; |
|
| 1282 | 1282 | |
| 1283 | - // Reset the vars, as we are about to process the next parameter. |
|
| 1284 | - $defaultStart = null; |
|
| 1285 | - $passByReference = false; |
|
| 1286 | - $variableLength = false; |
|
| 1287 | - $typeHint = ''; |
|
| 1283 | + // Reset the vars, as we are about to process the next parameter. |
|
| 1284 | + $defaultStart = null; |
|
| 1285 | + $passByReference = false; |
|
| 1286 | + $variableLength = false; |
|
| 1287 | + $typeHint = ''; |
|
| 1288 | 1288 | |
| 1289 | - $paramCount++; |
|
| 1290 | - break; |
|
| 1291 | - case T_EQUAL: |
|
| 1292 | - $defaultStart = ($i + 1); |
|
| 1293 | - break; |
|
| 1289 | + $paramCount++; |
|
| 1290 | + break; |
|
| 1291 | + case T_EQUAL: |
|
| 1292 | + $defaultStart = ($i + 1); |
|
| 1293 | + break; |
|
| 1294 | 1294 | }//end switch |
| 1295 | 1295 | }//end for |
| 1296 | 1296 | |
@@ -1352,27 +1352,27 @@ discard block |
||
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | switch ($this->tokens[$i]['code']) { |
| 1355 | - case T_PUBLIC: |
|
| 1356 | - $scope = 'public'; |
|
| 1357 | - $scopeSpecified = true; |
|
| 1358 | - break; |
|
| 1359 | - case T_PRIVATE: |
|
| 1360 | - $scope = 'private'; |
|
| 1361 | - $scopeSpecified = true; |
|
| 1362 | - break; |
|
| 1363 | - case T_PROTECTED: |
|
| 1364 | - $scope = 'protected'; |
|
| 1365 | - $scopeSpecified = true; |
|
| 1366 | - break; |
|
| 1367 | - case T_ABSTRACT: |
|
| 1368 | - $isAbstract = true; |
|
| 1369 | - break; |
|
| 1370 | - case T_FINAL: |
|
| 1371 | - $isFinal = true; |
|
| 1372 | - break; |
|
| 1373 | - case T_STATIC: |
|
| 1374 | - $isStatic = true; |
|
| 1375 | - break; |
|
| 1355 | + case T_PUBLIC: |
|
| 1356 | + $scope = 'public'; |
|
| 1357 | + $scopeSpecified = true; |
|
| 1358 | + break; |
|
| 1359 | + case T_PRIVATE: |
|
| 1360 | + $scope = 'private'; |
|
| 1361 | + $scopeSpecified = true; |
|
| 1362 | + break; |
|
| 1363 | + case T_PROTECTED: |
|
| 1364 | + $scope = 'protected'; |
|
| 1365 | + $scopeSpecified = true; |
|
| 1366 | + break; |
|
| 1367 | + case T_ABSTRACT: |
|
| 1368 | + $isAbstract = true; |
|
| 1369 | + break; |
|
| 1370 | + case T_FINAL: |
|
| 1371 | + $isFinal = true; |
|
| 1372 | + break; |
|
| 1373 | + case T_STATIC: |
|
| 1374 | + $isStatic = true; |
|
| 1375 | + break; |
|
| 1376 | 1376 | }//end switch |
| 1377 | 1377 | }//end for |
| 1378 | 1378 | |
@@ -1462,21 +1462,21 @@ discard block |
||
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | 1464 | switch ($this->tokens[$i]['code']) { |
| 1465 | - case T_PUBLIC: |
|
| 1466 | - $scope = 'public'; |
|
| 1467 | - $scopeSpecified = true; |
|
| 1468 | - break; |
|
| 1469 | - case T_PRIVATE: |
|
| 1470 | - $scope = 'private'; |
|
| 1471 | - $scopeSpecified = true; |
|
| 1472 | - break; |
|
| 1473 | - case T_PROTECTED: |
|
| 1474 | - $scope = 'protected'; |
|
| 1475 | - $scopeSpecified = true; |
|
| 1476 | - break; |
|
| 1477 | - case T_STATIC: |
|
| 1478 | - $isStatic = true; |
|
| 1479 | - break; |
|
| 1465 | + case T_PUBLIC: |
|
| 1466 | + $scope = 'public'; |
|
| 1467 | + $scopeSpecified = true; |
|
| 1468 | + break; |
|
| 1469 | + case T_PRIVATE: |
|
| 1470 | + $scope = 'private'; |
|
| 1471 | + $scopeSpecified = true; |
|
| 1472 | + break; |
|
| 1473 | + case T_PROTECTED: |
|
| 1474 | + $scope = 'protected'; |
|
| 1475 | + $scopeSpecified = true; |
|
| 1476 | + break; |
|
| 1477 | + case T_STATIC: |
|
| 1478 | + $isStatic = true; |
|
| 1479 | + break; |
|
| 1480 | 1480 | } |
| 1481 | 1481 | }//end for |
| 1482 | 1482 | |
@@ -1530,13 +1530,13 @@ discard block |
||
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | switch ($this->tokens[$i]['code']) { |
| 1533 | - case T_ABSTRACT: |
|
| 1534 | - $isAbstract = true; |
|
| 1535 | - break; |
|
| 1533 | + case T_ABSTRACT: |
|
| 1534 | + $isAbstract = true; |
|
| 1535 | + break; |
|
| 1536 | 1536 | |
| 1537 | - case T_FINAL: |
|
| 1538 | - $isFinal = true; |
|
| 1539 | - break; |
|
| 1537 | + case T_FINAL: |
|
| 1538 | + $isFinal = true; |
|
| 1539 | + break; |
|
| 1540 | 1540 | } |
| 1541 | 1541 | }//end for |
| 1542 | 1542 | |
@@ -572,9 +572,9 @@ discard block |
||
| 572 | 572 | $error, |
| 573 | 573 | $stackPtr, |
| 574 | 574 | $code, |
| 575 | - $data=array(), |
|
| 576 | - $severity=0, |
|
| 577 | - $fixable=false |
|
| 575 | + $data = array(), |
|
| 576 | + $severity = 0, |
|
| 577 | + $fixable = false |
|
| 578 | 578 | ) { |
| 579 | 579 | if ($stackPtr === null) { |
| 580 | 580 | $line = 1; |
@@ -606,9 +606,9 @@ discard block |
||
| 606 | 606 | $warning, |
| 607 | 607 | $stackPtr, |
| 608 | 608 | $code, |
| 609 | - $data=array(), |
|
| 610 | - $severity=0, |
|
| 611 | - $fixable=false |
|
| 609 | + $data = array(), |
|
| 610 | + $severity = 0, |
|
| 611 | + $fixable = false |
|
| 612 | 612 | ) { |
| 613 | 613 | if ($stackPtr === null) { |
| 614 | 614 | $line = 1; |
@@ -639,8 +639,8 @@ discard block |
||
| 639 | 639 | $error, |
| 640 | 640 | $line, |
| 641 | 641 | $code, |
| 642 | - $data=array(), |
|
| 643 | - $severity=0 |
|
| 642 | + $data = array(), |
|
| 643 | + $severity = 0 |
|
| 644 | 644 | ) { |
| 645 | 645 | return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false); |
| 646 | 646 | |
@@ -663,8 +663,8 @@ discard block |
||
| 663 | 663 | $warning, |
| 664 | 664 | $line, |
| 665 | 665 | $code, |
| 666 | - $data=array(), |
|
| 667 | - $severity=0 |
|
| 666 | + $data = array(), |
|
| 667 | + $severity = 0 |
|
| 668 | 668 | ) { |
| 669 | 669 | return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false); |
| 670 | 670 | |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | $error, |
| 690 | 690 | $stackPtr, |
| 691 | 691 | $code, |
| 692 | - $data=array(), |
|
| 693 | - $severity=0 |
|
| 692 | + $data = array(), |
|
| 693 | + $severity = 0 |
|
| 694 | 694 | ) { |
| 695 | 695 | $recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true); |
| 696 | 696 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | $warning, |
| 721 | 721 | $stackPtr, |
| 722 | 722 | $code, |
| 723 | - $data=array(), |
|
| 724 | - $severity=0 |
|
| 723 | + $data = array(), |
|
| 724 | + $severity = 0 |
|
| 725 | 725 | ) { |
| 726 | 726 | $recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true); |
| 727 | 727 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -1698,10 +1698,10 @@ discard block |
||
| 1698 | 1698 | public function findPrevious( |
| 1699 | 1699 | $types, |
| 1700 | 1700 | $start, |
| 1701 | - $end=null, |
|
| 1702 | - $exclude=false, |
|
| 1703 | - $value=null, |
|
| 1704 | - $local=false |
|
| 1701 | + $end = null, |
|
| 1702 | + $exclude = false, |
|
| 1703 | + $value = null, |
|
| 1704 | + $local = false |
|
| 1705 | 1705 | ) { |
| 1706 | 1706 | $types = (array) $types; |
| 1707 | 1707 | |
@@ -1779,10 +1779,10 @@ discard block |
||
| 1779 | 1779 | public function findNext( |
| 1780 | 1780 | $types, |
| 1781 | 1781 | $start, |
| 1782 | - $end=null, |
|
| 1783 | - $exclude=false, |
|
| 1784 | - $value=null, |
|
| 1785 | - $local=false |
|
| 1782 | + $end = null, |
|
| 1783 | + $exclude = false, |
|
| 1784 | + $value = null, |
|
| 1785 | + $local = false |
|
| 1786 | 1786 | ) { |
| 1787 | 1787 | $types = (array) $types; |
| 1788 | 1788 | |
@@ -1825,7 +1825,7 @@ discard block |
||
| 1825 | 1825 | * |
| 1826 | 1826 | * @return int |
| 1827 | 1827 | */ |
| 1828 | - public function findStartOfStatement($start, $ignore=null) |
|
| 1828 | + public function findStartOfStatement($start, $ignore = null) |
|
| 1829 | 1829 | { |
| 1830 | 1830 | $endTokens = Util\Tokens::$blockOpeners; |
| 1831 | 1831 | |
@@ -1890,7 +1890,7 @@ discard block |
||
| 1890 | 1890 | * |
| 1891 | 1891 | * @return int |
| 1892 | 1892 | */ |
| 1893 | - public function findEndOfStatement($start, $ignore=null) |
|
| 1893 | + public function findEndOfStatement($start, $ignore = null) |
|
| 1894 | 1894 | { |
| 1895 | 1895 | $endTokens = array( |
| 1896 | 1896 | T_COLON => true, |
@@ -1974,7 +1974,7 @@ discard block |
||
| 1974 | 1974 | * |
| 1975 | 1975 | * @return int | bool |
| 1976 | 1976 | */ |
| 1977 | - public function findFirstOnLine($types, $start, $exclude=false, $value=null) |
|
| 1977 | + public function findFirstOnLine($types, $start, $exclude = false, $value = null) |
|
| 1978 | 1978 | { |
| 1979 | 1979 | if (is_array($types) === false) { |
| 1980 | 1980 | $types = array($types); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | /** |
| 531 | 531 | * Returns the token stack for this file. |
| 532 | 532 | * |
| 533 | - * @return array |
|
| 533 | + * @return string |
|
| 534 | 534 | */ |
| 535 | 535 | public function getTokens() |
| 536 | 536 | { |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | * will not be checked. IE. checking will stop |
| 1693 | 1693 | * at the previous semi-colon found. |
| 1694 | 1694 | * |
| 1695 | - * @return int|bool |
|
| 1695 | + * @return integer |
|
| 1696 | 1696 | * @see findNext() |
| 1697 | 1697 | */ |
| 1698 | 1698 | public function findPrevious( |
@@ -128,15 +128,15 @@ |
||
| 128 | 128 | parent::process(); |
| 129 | 129 | |
| 130 | 130 | $cache = array( |
| 131 | - 'hash' => $hash, |
|
| 132 | - 'errors' => $this->errors, |
|
| 133 | - 'warnings' => $this->warnings, |
|
| 134 | - 'metrics' => $this->metrics, |
|
| 135 | - 'errorCount' => $this->errorCount, |
|
| 136 | - 'warningCount' => $this->warningCount, |
|
| 137 | - 'fixableCount' => $this->fixableCount, |
|
| 138 | - 'numTokens' => $this->numTokens, |
|
| 139 | - ); |
|
| 131 | + 'hash' => $hash, |
|
| 132 | + 'errors' => $this->errors, |
|
| 133 | + 'warnings' => $this->warnings, |
|
| 134 | + 'metrics' => $this->metrics, |
|
| 135 | + 'errorCount' => $this->errorCount, |
|
| 136 | + 'warningCount' => $this->warningCount, |
|
| 137 | + 'fixableCount' => $this->fixableCount, |
|
| 138 | + 'numTokens' => $this->numTokens, |
|
| 139 | + ); |
|
| 140 | 140 | |
| 141 | 141 | Cache::set($this->path, $cache); |
| 142 | 142 | |
@@ -402,8 +402,8 @@ discard block |
||
| 402 | 402 | throw new RuntimeException('Failed to create child process'); |
| 403 | 403 | } else if ($pid !== 0) { |
| 404 | 404 | $childProcs[] = array( |
| 405 | - 'pid' => $pid, |
|
| 406 | - 'out' => $childOutFilename, |
|
| 405 | + 'pid' => $pid, |
|
| 406 | + 'out' => $childOutFilename, |
|
| 407 | 407 | ); |
| 408 | 408 | } else { |
| 409 | 409 | // Move forward to the start of the batch. |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | 'totalErrors' => $this->reporter->totalErrors, |
| 452 | 452 | 'totalWarnings' => $this->reporter->totalWarnings, |
| 453 | 453 | 'totalFixable' => $this->reporter->totalFixable, |
| 454 | - ); |
|
| 454 | + ); |
|
| 455 | 455 | |
| 456 | 456 | $output = '<'.'?php'."\n".' $childOutput = '; |
| 457 | 457 | $output .= var_export($childOutput, true); |
@@ -607,19 +607,19 @@ |
||
| 607 | 607 | $input = trim($input); |
| 608 | 608 | |
| 609 | 609 | switch ($input) { |
| 610 | - case 's': |
|
| 611 | - break(2); |
|
| 612 | - case 'q': |
|
| 613 | - exit(0); |
|
| 614 | - default: |
|
| 615 | - // Repopulate the sniffs because some of them save their state |
|
| 616 | - // and only clear it when the file changes, but we are rechecking |
|
| 617 | - // the same file. |
|
| 618 | - $file->ruleset->populateTokenListeners(); |
|
| 619 | - $file->reloadContent(); |
|
| 620 | - $file->process(); |
|
| 621 | - $this->reporter->cacheFileReport($file, $this->config); |
|
| 622 | - break; |
|
| 610 | + case 's': |
|
| 611 | + break(2); |
|
| 612 | + case 'q': |
|
| 613 | + exit(0); |
|
| 614 | + default: |
|
| 615 | + // Repopulate the sniffs because some of them save their state |
|
| 616 | + // and only clear it when the file changes, but we are rechecking |
|
| 617 | + // the same file. |
|
| 618 | + $file->ruleset->populateTokenListeners(); |
|
| 619 | + $file->reloadContent(); |
|
| 620 | + $file->process(); |
|
| 621 | + $this->reporter->cacheFileReport($file, $this->config); |
|
| 622 | + break; |
|
| 623 | 623 | } |
| 624 | 624 | }//end while |
| 625 | 625 | }//end if |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | if (isset($this->ruleset[$code]) === false) { |
| 848 | 848 | $this->ruleset[$code] = array( |
| 849 | - 'properties' => array(), |
|
| 849 | + 'properties' => array(), |
|
| 850 | 850 | ); |
| 851 | 851 | } else if (isset($this->ruleset[$code]['properties']) === false) { |
| 852 | 852 | $this->ruleset[$code]['properties'] = array(); |
@@ -1084,8 +1084,8 @@ discard block |
||
| 1084 | 1084 | $patterns = $this->getIgnorePatterns($sniffCode); |
| 1085 | 1085 | foreach ($patterns as $pattern => $type) { |
| 1086 | 1086 | $replacements = array( |
| 1087 | - '\\,' => ',', |
|
| 1088 | - '*' => '.*', |
|
| 1087 | + '\\,' => ',', |
|
| 1088 | + '*' => '.*', |
|
| 1089 | 1089 | ); |
| 1090 | 1090 | |
| 1091 | 1091 | $ignorePatterns[] = strtr($pattern, $replacements); |
@@ -1095,8 +1095,8 @@ discard block |
||
| 1095 | 1095 | $patterns = $this->getIncludePatterns($sniffCode); |
| 1096 | 1096 | foreach ($patterns as $pattern => $type) { |
| 1097 | 1097 | $replacements = array( |
| 1098 | - '\\,' => ',', |
|
| 1099 | - '*' => '.*', |
|
| 1098 | + '\\,' => ',', |
|
| 1099 | + '*' => '.*', |
|
| 1100 | 1100 | ); |
| 1101 | 1101 | |
| 1102 | 1102 | $includePatterns[] = strtr($pattern, $replacements); |
@@ -1109,12 +1109,12 @@ discard block |
||
| 1109 | 1109 | |
| 1110 | 1110 | if (isset($this->tokenListeners[$token][$sniffClass]) === false) { |
| 1111 | 1111 | $this->tokenListeners[$token][$sniffClass] = array( |
| 1112 | - 'class' => $sniffClass, |
|
| 1113 | - 'source' => $sniffCode, |
|
| 1114 | - 'tokenizers' => $tokenizers, |
|
| 1115 | - 'ignore' => $ignorePatterns, |
|
| 1116 | - 'include' => $includePatterns, |
|
| 1117 | - ); |
|
| 1112 | + 'class' => $sniffClass, |
|
| 1113 | + 'source' => $sniffCode, |
|
| 1114 | + 'tokenizers' => $tokenizers, |
|
| 1115 | + 'ignore' => $ignorePatterns, |
|
| 1116 | + 'include' => $includePatterns, |
|
| 1117 | + ); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | } |
| 1120 | 1120 | }//end foreach |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @return string[] |
| 262 | 262 | * @throws RuntimeException If the ruleset path is invalid. |
| 263 | 263 | */ |
| 264 | - public function processRuleset($rulesetPath, $depth=0) |
|
| 264 | + public function processRuleset($rulesetPath, $depth = 0) |
|
| 265 | 265 | { |
| 266 | 266 | $rulesetPath = Util\Common::realpath($rulesetPath); |
| 267 | 267 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * |
| 507 | 507 | * @return array |
| 508 | 508 | */ |
| 509 | - private function expandSniffDirectory($directory, $depth=0) |
|
| 509 | + private function expandSniffDirectory($directory, $depth = 0) |
|
| 510 | 510 | { |
| 511 | 511 | $sniffs = array(); |
| 512 | 512 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | * @return array |
| 570 | 570 | * @throws RuntimeException If the reference is invalid. |
| 571 | 571 | */ |
| 572 | - private function expandRulesetReference($ref, $rulesetDir, $depth=0) |
|
| 572 | + private function expandRulesetReference($ref, $rulesetDir, $depth = 0) |
|
| 573 | 573 | { |
| 574 | 574 | // Ignore internal sniffs codes as they are used to only |
| 575 | 575 | // hide and change internal messages. |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | * @return void |
| 752 | 752 | * @throws RuntimeException If rule settings are invalid. |
| 753 | 753 | */ |
| 754 | - private function processRule($rule, $newSniffs, $depth=0) |
|
| 754 | + private function processRule($rule, $newSniffs, $depth = 0) |
|
| 755 | 755 | { |
| 756 | 756 | $ref = (string) $rule['ref']; |
| 757 | 757 | $todo = array($ref); |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | foreach (explode(',', $value) as $val) { |
| 862 | 862 | $v = ''; |
| 863 | 863 | |
| 864 | - list($k,$v) = explode('=>', $val.'=>'); |
|
| 864 | + list($k, $v) = explode('=>', $val.'=>'); |
|
| 865 | 865 | if ($v !== '') { |
| 866 | 866 | $values[$k] = $v; |
| 867 | 867 | } else { |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | * |
| 1167 | 1167 | * @return array |
| 1168 | 1168 | */ |
| 1169 | - public function getIgnorePatterns($listener=null) |
|
| 1169 | + public function getIgnorePatterns($listener = null) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | if ($listener === null) { |
| 1172 | 1172 | return $this->ignorePatterns; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | * |
| 1193 | 1193 | * @return array |
| 1194 | 1194 | */ |
| 1195 | - public function getIncludePatterns($listener=null) |
|
| 1195 | + public function getIncludePatterns($listener = null) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | if ($listener === null) { |
| 1198 | 1198 | return $this->includePatterns; |