@@ -28,52 +28,52 @@ |
||
| 28 | 28 | public function getErrorList($testFile='') |
| 29 | 29 | { |
| 30 | 30 | switch ($testFile) { |
| 31 | - case 'UseDeclarationUnitTest.2.inc': |
|
| 32 | - return [ |
|
| 33 | - 4 => 1, |
|
| 34 | - 5 => 1, |
|
| 35 | - 6 => 1, |
|
| 36 | - 7 => 1, |
|
| 37 | - 9 => 1, |
|
| 38 | - 10 => 1, |
|
| 39 | - 11 => 1, |
|
| 40 | - 16 => 1, |
|
| 41 | - ]; |
|
| 42 | - case 'UseDeclarationUnitTest.3.inc': |
|
| 43 | - return [ |
|
| 44 | - 4 => 1, |
|
| 45 | - 6 => 1, |
|
| 46 | - ]; |
|
| 47 | - case 'UseDeclarationUnitTest.5.inc': |
|
| 48 | - return [ |
|
| 49 | - 5 => 1, |
|
| 50 | - 6 => 1, |
|
| 51 | - 8 => 1, |
|
| 52 | - 14 => 1, |
|
| 53 | - 17 => 1, |
|
| 54 | - 18 => 1, |
|
| 55 | - 19 => 1, |
|
| 56 | - 21 => 1, |
|
| 57 | - 28 => 1, |
|
| 58 | - 30 => 1, |
|
| 59 | - 35 => 1, |
|
| 60 | - ]; |
|
| 61 | - case 'UseDeclarationUnitTest.10.inc': |
|
| 62 | - case 'UseDeclarationUnitTest.11.inc': |
|
| 63 | - case 'UseDeclarationUnitTest.12.inc': |
|
| 64 | - case 'UseDeclarationUnitTest.13.inc': |
|
| 65 | - case 'UseDeclarationUnitTest.14.inc': |
|
| 66 | - case 'UseDeclarationUnitTest.16.inc': |
|
| 67 | - case 'UseDeclarationUnitTest.17.inc': |
|
| 68 | - return [2 => 1]; |
|
| 69 | - case 'UseDeclarationUnitTest.15.inc': |
|
| 70 | - return [ |
|
| 71 | - 3 => 1, |
|
| 72 | - 4 => 1, |
|
| 73 | - 5 => 1, |
|
| 74 | - ]; |
|
| 75 | - default: |
|
| 76 | - return []; |
|
| 31 | + case 'UseDeclarationUnitTest.2.inc': |
|
| 32 | + return [ |
|
| 33 | + 4 => 1, |
|
| 34 | + 5 => 1, |
|
| 35 | + 6 => 1, |
|
| 36 | + 7 => 1, |
|
| 37 | + 9 => 1, |
|
| 38 | + 10 => 1, |
|
| 39 | + 11 => 1, |
|
| 40 | + 16 => 1, |
|
| 41 | + ]; |
|
| 42 | + case 'UseDeclarationUnitTest.3.inc': |
|
| 43 | + return [ |
|
| 44 | + 4 => 1, |
|
| 45 | + 6 => 1, |
|
| 46 | + ]; |
|
| 47 | + case 'UseDeclarationUnitTest.5.inc': |
|
| 48 | + return [ |
|
| 49 | + 5 => 1, |
|
| 50 | + 6 => 1, |
|
| 51 | + 8 => 1, |
|
| 52 | + 14 => 1, |
|
| 53 | + 17 => 1, |
|
| 54 | + 18 => 1, |
|
| 55 | + 19 => 1, |
|
| 56 | + 21 => 1, |
|
| 57 | + 28 => 1, |
|
| 58 | + 30 => 1, |
|
| 59 | + 35 => 1, |
|
| 60 | + ]; |
|
| 61 | + case 'UseDeclarationUnitTest.10.inc': |
|
| 62 | + case 'UseDeclarationUnitTest.11.inc': |
|
| 63 | + case 'UseDeclarationUnitTest.12.inc': |
|
| 64 | + case 'UseDeclarationUnitTest.13.inc': |
|
| 65 | + case 'UseDeclarationUnitTest.14.inc': |
|
| 66 | + case 'UseDeclarationUnitTest.16.inc': |
|
| 67 | + case 'UseDeclarationUnitTest.17.inc': |
|
| 68 | + return [2 => 1]; |
|
| 69 | + case 'UseDeclarationUnitTest.15.inc': |
|
| 70 | + return [ |
|
| 71 | + 3 => 1, |
|
| 72 | + 4 => 1, |
|
| 73 | + 5 => 1, |
|
| 74 | + ]; |
|
| 75 | + default: |
|
| 76 | + return []; |
|
| 77 | 77 | }//end switch |
| 78 | 78 | |
| 79 | 79 | }//end getErrorList() |
@@ -155,14 +155,14 @@ |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | switch ($this->allowOnly) { |
| 158 | - case 'first': |
|
| 159 | - $error = 'Boolean operators between conditions must be at the beginning of the line'; |
|
| 160 | - break; |
|
| 161 | - case 'last': |
|
| 162 | - $error = 'Boolean operators between conditions must be at the end of the line'; |
|
| 163 | - break; |
|
| 164 | - default: |
|
| 165 | - $error = 'Boolean operators between conditions must be at the beginning or end of the line, but not both'; |
|
| 158 | + case 'first': |
|
| 159 | + $error = 'Boolean operators between conditions must be at the beginning of the line'; |
|
| 160 | + break; |
|
| 161 | + case 'last': |
|
| 162 | + $error = 'Boolean operators between conditions must be at the end of the line'; |
|
| 163 | + break; |
|
| 164 | + default: |
|
| 165 | + $error = 'Boolean operators between conditions must be at the beginning or end of the line, but not both'; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'FoundMixed'); |
@@ -159,96 +159,96 @@ |
||
| 159 | 159 | |
| 160 | 160 | do { |
| 161 | 161 | switch ($tokens[$next]['code']) { |
| 162 | - case T_DOC_COMMENT_OPEN_TAG: |
|
| 163 | - if ($foundDocblock === true) { |
|
| 164 | - // Found a second docblock, so start of code. |
|
| 165 | - break(2); |
|
| 166 | - } |
|
| 162 | + case T_DOC_COMMENT_OPEN_TAG: |
|
| 163 | + if ($foundDocblock === true) { |
|
| 164 | + // Found a second docblock, so start of code. |
|
| 165 | + break(2); |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - // Make sure this is not a code-level docblock. |
|
| 169 | - $end = $tokens[$next]['comment_closer']; |
|
| 170 | - $docToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true); |
|
| 168 | + // Make sure this is not a code-level docblock. |
|
| 169 | + $end = $tokens[$next]['comment_closer']; |
|
| 170 | + $docToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true); |
|
| 171 | 171 | |
| 172 | - if (isset($commentOpeners[$tokens[$docToken]['code']]) === false |
|
| 173 | - && isset(Tokens::$methodPrefixes[$tokens[$docToken]['code']]) === false |
|
| 174 | - ) { |
|
| 175 | - // Check for an @var annotation. |
|
| 176 | - $annotation = false; |
|
| 177 | - for ($i = $next; $i < $end; $i++) { |
|
| 178 | - if ($tokens[$i]['code'] === T_DOC_COMMENT_TAG |
|
| 179 | - && strtolower($tokens[$i]['content']) === '@var' |
|
| 180 | - ) { |
|
| 181 | - $annotation = true; |
|
| 182 | - break; |
|
| 172 | + if (isset($commentOpeners[$tokens[$docToken]['code']]) === false |
|
| 173 | + && isset(Tokens::$methodPrefixes[$tokens[$docToken]['code']]) === false |
|
| 174 | + ) { |
|
| 175 | + // Check for an @var annotation. |
|
| 176 | + $annotation = false; |
|
| 177 | + for ($i = $next; $i < $end; $i++) { |
|
| 178 | + if ($tokens[$i]['code'] === T_DOC_COMMENT_TAG |
|
| 179 | + && strtolower($tokens[$i]['content']) === '@var' |
|
| 180 | + ) { |
|
| 181 | + $annotation = true; |
|
| 182 | + break; |
|
| 183 | + } |
|
| 183 | 184 | } |
| 184 | - } |
|
| 185 | 185 | |
| 186 | - if ($annotation === false) { |
|
| 187 | - $foundDocblock = true; |
|
| 188 | - $headerLines[] = [ |
|
| 189 | - 'type' => 'docblock', |
|
| 190 | - 'start' => $next, |
|
| 191 | - 'end' => $end, |
|
| 192 | - ]; |
|
| 193 | - } |
|
| 194 | - }//end if |
|
| 186 | + if ($annotation === false) { |
|
| 187 | + $foundDocblock = true; |
|
| 188 | + $headerLines[] = [ |
|
| 189 | + 'type' => 'docblock', |
|
| 190 | + 'start' => $next, |
|
| 191 | + 'end' => $end, |
|
| 192 | + ]; |
|
| 193 | + } |
|
| 194 | + }//end if |
|
| 195 | 195 | |
| 196 | - $next = $end; |
|
| 197 | - break; |
|
| 198 | - case T_DECLARE: |
|
| 199 | - case T_NAMESPACE: |
|
| 200 | - if (isset($tokens[$next]['scope_opener']) === true) { |
|
| 201 | - // If this statement is using bracketed syntax, it doesn't |
|
| 202 | - // apply to the entire files and so is not part of header. |
|
| 203 | - // The header has now ended and the main code block begins. |
|
| 204 | - break(2); |
|
| 205 | - } |
|
| 196 | + $next = $end; |
|
| 197 | + break; |
|
| 198 | + case T_DECLARE: |
|
| 199 | + case T_NAMESPACE: |
|
| 200 | + if (isset($tokens[$next]['scope_opener']) === true) { |
|
| 201 | + // If this statement is using bracketed syntax, it doesn't |
|
| 202 | + // apply to the entire files and so is not part of header. |
|
| 203 | + // The header has now ended and the main code block begins. |
|
| 204 | + break(2); |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - $end = $phpcsFile->findEndOfStatement($next); |
|
| 207 | + $end = $phpcsFile->findEndOfStatement($next); |
|
| 208 | 208 | |
| 209 | - $headerLines[] = [ |
|
| 210 | - 'type' => substr(strtolower($tokens[$next]['type']), 2), |
|
| 211 | - 'start' => $next, |
|
| 212 | - 'end' => $end, |
|
| 213 | - ]; |
|
| 209 | + $headerLines[] = [ |
|
| 210 | + 'type' => substr(strtolower($tokens[$next]['type']), 2), |
|
| 211 | + 'start' => $next, |
|
| 212 | + 'end' => $end, |
|
| 213 | + ]; |
|
| 214 | 214 | |
| 215 | - $next = $end; |
|
| 216 | - break; |
|
| 217 | - case T_USE: |
|
| 218 | - $type = 'use'; |
|
| 219 | - $useType = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true); |
|
| 220 | - if ($useType !== false && $tokens[$useType]['code'] === T_STRING) { |
|
| 221 | - $content = strtolower($tokens[$useType]['content']); |
|
| 222 | - if ($content === 'function' || $content === 'const') { |
|
| 223 | - $type .= ' '.$content; |
|
| 215 | + $next = $end; |
|
| 216 | + break; |
|
| 217 | + case T_USE: |
|
| 218 | + $type = 'use'; |
|
| 219 | + $useType = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true); |
|
| 220 | + if ($useType !== false && $tokens[$useType]['code'] === T_STRING) { |
|
| 221 | + $content = strtolower($tokens[$useType]['content']); |
|
| 222 | + if ($content === 'function' || $content === 'const') { |
|
| 223 | + $type .= ' '.$content; |
|
| 224 | + } |
|
| 224 | 225 | } |
| 225 | - } |
|
| 226 | 226 | |
| 227 | - $end = $phpcsFile->findEndOfStatement($next); |
|
| 228 | - |
|
| 229 | - $headerLines[] = [ |
|
| 230 | - 'type' => $type, |
|
| 231 | - 'start' => $next, |
|
| 232 | - 'end' => $end, |
|
| 233 | - ]; |
|
| 227 | + $end = $phpcsFile->findEndOfStatement($next); |
|
| 234 | 228 | |
| 235 | - $next = $end; |
|
| 236 | - break; |
|
| 237 | - default: |
|
| 238 | - // Skip comments as PSR-12 doesn't say if these are allowed or not. |
|
| 239 | - if (isset(Tokens::$commentTokens[$tokens[$next]['code']]) === true) { |
|
| 240 | - $next = $phpcsFile->findNext(Tokens::$commentTokens, ($next + 1), null, true); |
|
| 241 | - if ($next === false) { |
|
| 242 | - // We reached the end of the file. |
|
| 243 | - break(2); |
|
| 244 | - } |
|
| 229 | + $headerLines[] = [ |
|
| 230 | + 'type' => $type, |
|
| 231 | + 'start' => $next, |
|
| 232 | + 'end' => $end, |
|
| 233 | + ]; |
|
| 245 | 234 | |
| 246 | - $next--; |
|
| 235 | + $next = $end; |
|
| 247 | 236 | break; |
| 248 | - } |
|
| 237 | + default: |
|
| 238 | + // Skip comments as PSR-12 doesn't say if these are allowed or not. |
|
| 239 | + if (isset(Tokens::$commentTokens[$tokens[$next]['code']]) === true) { |
|
| 240 | + $next = $phpcsFile->findNext(Tokens::$commentTokens, ($next + 1), null, true); |
|
| 241 | + if ($next === false) { |
|
| 242 | + // We reached the end of the file. |
|
| 243 | + break(2); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + $next--; |
|
| 247 | + break; |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - // We found the start of the main code block. |
|
| 251 | - break(2); |
|
| 250 | + // We found the start of the main code block. |
|
| 251 | + break(2); |
|
| 252 | 252 | }//end switch |
| 253 | 253 | |
| 254 | 254 | $next = $phpcsFile->findNext(T_WHITESPACE, ($next + 1), null, true); |
@@ -28,37 +28,37 @@ |
||
| 28 | 28 | public function getErrorList($testFile='') |
| 29 | 29 | { |
| 30 | 30 | switch ($testFile) { |
| 31 | - case 'FileHeaderUnitTest.2.inc': |
|
| 32 | - return [ |
|
| 33 | - 1 => 1, |
|
| 34 | - 6 => 1, |
|
| 35 | - 7 => 1, |
|
| 36 | - 18 => 1, |
|
| 37 | - 20 => 1, |
|
| 38 | - 24 => 1, |
|
| 39 | - ]; |
|
| 40 | - case 'FileHeaderUnitTest.3.inc': |
|
| 41 | - return [ |
|
| 42 | - 9 => 1, |
|
| 43 | - 18 => 1, |
|
| 44 | - ]; |
|
| 45 | - case 'FileHeaderUnitTest.4.inc': |
|
| 46 | - return [ |
|
| 47 | - 1 => 1, |
|
| 48 | - 2 => 1, |
|
| 49 | - 3 => 1, |
|
| 50 | - 7 => 1, |
|
| 51 | - ]; |
|
| 52 | - case 'FileHeaderUnitTest.5.inc': |
|
| 53 | - return [4 => 1]; |
|
| 54 | - case 'FileHeaderUnitTest.7.inc': |
|
| 55 | - case 'FileHeaderUnitTest.10.inc': |
|
| 56 | - case 'FileHeaderUnitTest.11.inc': |
|
| 57 | - return [1 => 1]; |
|
| 58 | - case 'FileHeaderUnitTest.12.inc': |
|
| 59 | - return [4 => 2]; |
|
| 60 | - default: |
|
| 61 | - return []; |
|
| 31 | + case 'FileHeaderUnitTest.2.inc': |
|
| 32 | + return [ |
|
| 33 | + 1 => 1, |
|
| 34 | + 6 => 1, |
|
| 35 | + 7 => 1, |
|
| 36 | + 18 => 1, |
|
| 37 | + 20 => 1, |
|
| 38 | + 24 => 1, |
|
| 39 | + ]; |
|
| 40 | + case 'FileHeaderUnitTest.3.inc': |
|
| 41 | + return [ |
|
| 42 | + 9 => 1, |
|
| 43 | + 18 => 1, |
|
| 44 | + ]; |
|
| 45 | + case 'FileHeaderUnitTest.4.inc': |
|
| 46 | + return [ |
|
| 47 | + 1 => 1, |
|
| 48 | + 2 => 1, |
|
| 49 | + 3 => 1, |
|
| 50 | + 7 => 1, |
|
| 51 | + ]; |
|
| 52 | + case 'FileHeaderUnitTest.5.inc': |
|
| 53 | + return [4 => 1]; |
|
| 54 | + case 'FileHeaderUnitTest.7.inc': |
|
| 55 | + case 'FileHeaderUnitTest.10.inc': |
|
| 56 | + case 'FileHeaderUnitTest.11.inc': |
|
| 57 | + return [1 => 1]; |
|
| 58 | + case 'FileHeaderUnitTest.12.inc': |
|
| 59 | + return [4 => 2]; |
|
| 60 | + default: |
|
| 61 | + return []; |
|
| 62 | 62 | }//end switch |
| 63 | 63 | |
| 64 | 64 | }//end getErrorList() |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | public function getErrorList($testFile='') |
| 29 | 29 | { |
| 30 | 30 | switch ($testFile) { |
| 31 | - case 'OpenTagUnitTest.2.inc': |
|
| 32 | - return [1 => 1]; |
|
| 33 | - default: |
|
| 34 | - return []; |
|
| 31 | + case 'OpenTagUnitTest.2.inc': |
|
| 32 | + return [1 => 1]; |
|
| 33 | + default: |
|
| 34 | + return []; |
|
| 35 | 35 | }//end switch |
| 36 | 36 | |
| 37 | 37 | }//end getErrorList() |
@@ -50,110 +50,110 @@ |
||
| 50 | 50 | |
| 51 | 51 | switch ($tokens[$stackPtr]['type']) { |
| 52 | 52 | // Detect `something();;`. |
| 53 | - case 'T_SEMICOLON': |
|
| 54 | - $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
| 55 | - |
|
| 56 | - if ($prevNonEmpty === false) { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - if ($tokens[$prevNonEmpty]['code'] !== T_SEMICOLON |
|
| 61 | - && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG |
|
| 62 | - && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO |
|
| 63 | - ) { |
|
| 64 | - if (isset($tokens[$prevNonEmpty]['scope_condition']) === false) { |
|
| 53 | + case 'T_SEMICOLON': |
|
| 54 | + $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
| 55 | + |
|
| 56 | + if ($prevNonEmpty === false) { |
|
| 65 | 57 | return; |
| 66 | 58 | } |
| 67 | 59 | |
| 68 | - if ($tokens[$prevNonEmpty]['scope_opener'] !== $prevNonEmpty |
|
| 69 | - && $tokens[$prevNonEmpty]['code'] !== T_CLOSE_CURLY_BRACKET |
|
| 60 | + if ($tokens[$prevNonEmpty]['code'] !== T_SEMICOLON |
|
| 61 | + && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG |
|
| 62 | + && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO |
|
| 70 | 63 | ) { |
| 71 | - return; |
|
| 72 | - } |
|
| 64 | + if (isset($tokens[$prevNonEmpty]['scope_condition']) === false) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 73 | 67 | |
| 74 | - $scopeOwner = $tokens[$tokens[$prevNonEmpty]['scope_condition']]['code']; |
|
| 75 | - if ($scopeOwner === T_CLOSURE || $scopeOwner === T_ANON_CLASS) { |
|
| 76 | - return; |
|
| 77 | - } |
|
| 68 | + if ($tokens[$prevNonEmpty]['scope_opener'] !== $prevNonEmpty |
|
| 69 | + && $tokens[$prevNonEmpty]['code'] !== T_CLOSE_CURLY_BRACKET |
|
| 70 | + ) { |
|
| 71 | + return; |
|
| 72 | + } |
|
| 78 | 73 | |
| 79 | - // Else, it's something like `if (foo) {};` and the semi-colon is not needed. |
|
| 80 | - } |
|
| 74 | + $scopeOwner = $tokens[$tokens[$prevNonEmpty]['scope_condition']]['code']; |
|
| 75 | + if ($scopeOwner === T_CLOSURE || $scopeOwner === T_ANON_CLASS) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 81 | 78 | |
| 82 | - if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { |
|
| 83 | - $nested = $tokens[$stackPtr]['nested_parenthesis']; |
|
| 84 | - $lastCloser = array_pop($nested); |
|
| 85 | - if (isset($tokens[$lastCloser]['parenthesis_owner']) === true |
|
| 86 | - && $tokens[$tokens[$lastCloser]['parenthesis_owner']]['code'] === T_FOR |
|
| 87 | - ) { |
|
| 88 | - // Empty for() condition. |
|
| 89 | - return; |
|
| 79 | + // Else, it's something like `if (foo) {};` and the semi-colon is not needed. |
|
| 90 | 80 | } |
| 91 | - } |
|
| 92 | - |
|
| 93 | - $fix = $phpcsFile->addFixableWarning( |
|
| 94 | - 'Empty PHP statement detected: superfluous semi-colon.', |
|
| 95 | - $stackPtr, |
|
| 96 | - 'SemicolonWithoutCodeDetected' |
|
| 97 | - ); |
|
| 98 | - if ($fix === true) { |
|
| 99 | - $phpcsFile->fixer->beginChangeset(); |
|
| 100 | - |
|
| 101 | - if ($tokens[$prevNonEmpty]['code'] === T_OPEN_TAG |
|
| 102 | - || $tokens[$prevNonEmpty]['code'] === T_OPEN_TAG_WITH_ECHO |
|
| 103 | - ) { |
|
| 104 | - // Check for superfluous whitespace after the semi-colon which will be |
|
| 105 | - // removed as the `<?php ` open tag token already contains whitespace, |
|
| 106 | - // either a space or a new line. |
|
| 107 | - if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { |
|
| 108 | - $replacement = str_replace(' ', '', $tokens[($stackPtr + 1)]['content']); |
|
| 109 | - $phpcsFile->fixer->replaceToken(($stackPtr + 1), $replacement); |
|
| 81 | + |
|
| 82 | + if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) { |
|
| 83 | + $nested = $tokens[$stackPtr]['nested_parenthesis']; |
|
| 84 | + $lastCloser = array_pop($nested); |
|
| 85 | + if (isset($tokens[$lastCloser]['parenthesis_owner']) === true |
|
| 86 | + && $tokens[$tokens[$lastCloser]['parenthesis_owner']]['code'] === T_FOR |
|
| 87 | + ) { |
|
| 88 | + // Empty for() condition. |
|
| 89 | + return; |
|
| 110 | 90 | } |
| 111 | 91 | } |
| 112 | 92 | |
| 113 | - for ($i = $stackPtr; $i > $prevNonEmpty; $i--) { |
|
| 114 | - if ($tokens[$i]['code'] !== T_SEMICOLON |
|
| 115 | - && $tokens[$i]['code'] !== T_WHITESPACE |
|
| 93 | + $fix = $phpcsFile->addFixableWarning( |
|
| 94 | + 'Empty PHP statement detected: superfluous semi-colon.', |
|
| 95 | + $stackPtr, |
|
| 96 | + 'SemicolonWithoutCodeDetected' |
|
| 97 | + ); |
|
| 98 | + if ($fix === true) { |
|
| 99 | + $phpcsFile->fixer->beginChangeset(); |
|
| 100 | + |
|
| 101 | + if ($tokens[$prevNonEmpty]['code'] === T_OPEN_TAG |
|
| 102 | + || $tokens[$prevNonEmpty]['code'] === T_OPEN_TAG_WITH_ECHO |
|
| 116 | 103 | ) { |
| 117 | - break; |
|
| 104 | + // Check for superfluous whitespace after the semi-colon which will be |
|
| 105 | + // removed as the `<?php ` open tag token already contains whitespace, |
|
| 106 | + // either a space or a new line. |
|
| 107 | + if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) { |
|
| 108 | + $replacement = str_replace(' ', '', $tokens[($stackPtr + 1)]['content']); |
|
| 109 | + $phpcsFile->fixer->replaceToken(($stackPtr + 1), $replacement); |
|
| 110 | + } |
|
| 118 | 111 | } |
| 119 | 112 | |
| 120 | - $phpcsFile->fixer->replaceToken($i, ''); |
|
| 121 | - } |
|
| 113 | + for ($i = $stackPtr; $i > $prevNonEmpty; $i--) { |
|
| 114 | + if ($tokens[$i]['code'] !== T_SEMICOLON |
|
| 115 | + && $tokens[$i]['code'] !== T_WHITESPACE |
|
| 116 | + ) { |
|
| 117 | + break; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + $phpcsFile->fixer->replaceToken($i, ''); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + $phpcsFile->fixer->endChangeset(); |
|
| 124 | + }//end if |
|
| 125 | + break; |
|
| 126 | + |
|
| 127 | + // Detect `<?php ? >`. |
|
| 128 | + case 'T_CLOSE_TAG': |
|
| 129 | + $prevNonEmpty = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
|
| 122 | 130 | |
| 123 | - $phpcsFile->fixer->endChangeset(); |
|
| 124 | - }//end if |
|
| 125 | - break; |
|
| 126 | - |
|
| 127 | - // Detect `<?php ? >`. |
|
| 128 | - case 'T_CLOSE_TAG': |
|
| 129 | - $prevNonEmpty = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
|
| 130 | - |
|
| 131 | - if ($prevNonEmpty === false |
|
| 132 | - || ($tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG |
|
| 133 | - && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO) |
|
| 134 | - ) { |
|
| 135 | - return; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $fix = $phpcsFile->addFixableWarning( |
|
| 139 | - 'Empty PHP open/close tag combination detected.', |
|
| 140 | - $prevNonEmpty, |
|
| 141 | - 'EmptyPHPOpenCloseTagsDetected' |
|
| 142 | - ); |
|
| 143 | - if ($fix === true) { |
|
| 144 | - $phpcsFile->fixer->beginChangeset(); |
|
| 145 | - |
|
| 146 | - for ($i = $prevNonEmpty; $i <= $stackPtr; $i++) { |
|
| 147 | - $phpcsFile->fixer->replaceToken($i, ''); |
|
| 131 | + if ($prevNonEmpty === false |
|
| 132 | + || ($tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG |
|
| 133 | + && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO) |
|
| 134 | + ) { |
|
| 135 | + return; |
|
| 148 | 136 | } |
| 149 | 137 | |
| 150 | - $phpcsFile->fixer->endChangeset(); |
|
| 151 | - } |
|
| 152 | - break; |
|
| 138 | + $fix = $phpcsFile->addFixableWarning( |
|
| 139 | + 'Empty PHP open/close tag combination detected.', |
|
| 140 | + $prevNonEmpty, |
|
| 141 | + 'EmptyPHPOpenCloseTagsDetected' |
|
| 142 | + ); |
|
| 143 | + if ($fix === true) { |
|
| 144 | + $phpcsFile->fixer->beginChangeset(); |
|
| 145 | + |
|
| 146 | + for ($i = $prevNonEmpty; $i <= $stackPtr; $i++) { |
|
| 147 | + $phpcsFile->fixer->replaceToken($i, ''); |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + $phpcsFile->fixer->endChangeset(); |
|
| 151 | + } |
|
| 152 | + break; |
|
| 153 | 153 | |
| 154 | - default: |
|
| 155 | - // Deliberately left empty. |
|
| 156 | - break; |
|
| 154 | + default: |
|
| 155 | + // Deliberately left empty. |
|
| 156 | + break; |
|
| 157 | 157 | }//end switch |
| 158 | 158 | |
| 159 | 159 | }//end process() |
@@ -95,18 +95,18 @@ |
||
| 95 | 95 | if ($fix === true) { |
| 96 | 96 | $tokens = $phpcsFile->getTokens(); |
| 97 | 97 | switch ($this->eolChar) { |
| 98 | - case '\n': |
|
| 99 | - $eolChar = "\n"; |
|
| 100 | - break; |
|
| 101 | - case '\r': |
|
| 102 | - $eolChar = "\r"; |
|
| 103 | - break; |
|
| 104 | - case '\r\n': |
|
| 105 | - $eolChar = "\r\n"; |
|
| 106 | - break; |
|
| 107 | - default: |
|
| 108 | - $eolChar = $this->eolChar; |
|
| 109 | - break; |
|
| 98 | + case '\n': |
|
| 99 | + $eolChar = "\n"; |
|
| 100 | + break; |
|
| 101 | + case '\r': |
|
| 102 | + $eolChar = "\r"; |
|
| 103 | + break; |
|
| 104 | + case '\r\n': |
|
| 105 | + $eolChar = "\r\n"; |
|
| 106 | + break; |
|
| 107 | + default: |
|
| 108 | + $eolChar = $this->eolChar; |
|
| 109 | + break; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | for ($i = 0; $i < $phpcsFile->numTokens; $i++) { |
@@ -77,141 +77,141 @@ |
||
| 77 | 77 | if ($phpcsFile->tokenizerType !== 'JS') { |
| 78 | 78 | switch ($tokens[$i]['code']) { |
| 79 | 79 | // Check for first non-comment, non-heredoc/nowdoc, non-inline HTML merge conflict opener. |
| 80 | - case T_SL: |
|
| 81 | - if (isset($tokens[($i + 1)], $tokens[($i + 2)]) !== false |
|
| 82 | - && $tokens[($i + 1)]['code'] === T_SL |
|
| 83 | - && $tokens[($i + 2)]['code'] === T_STRING |
|
| 84 | - && trim($tokens[($i + 2)]['content']) === '<<< HEAD' |
|
| 85 | - ) { |
|
| 86 | - $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 87 | - $i += 2; |
|
| 88 | - } |
|
| 89 | - break; |
|
| 90 | - |
|
| 91 | - // Check for merge conflict closer which was opened in a heredoc/nowdoc. |
|
| 92 | - case T_SR: |
|
| 93 | - if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)]) !== false |
|
| 94 | - && $tokens[($i + 1)]['code'] === T_SR |
|
| 95 | - && $tokens[($i + 2)]['code'] === T_SR |
|
| 96 | - && $tokens[($i + 3)]['code'] === T_GREATER_THAN |
|
| 97 | - && $tokens[($i + 4)]['code'] === T_WHITESPACE |
|
| 98 | - && $tokens[($i + 4)]['content'] === ' ' |
|
| 99 | - ) { |
|
| 100 | - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 101 | - $i += 4; |
|
| 102 | - } |
|
| 103 | - break; |
|
| 104 | - |
|
| 105 | - // Check for merge conflict delimiter which opened in a CSS comment and closed outside. |
|
| 106 | - case T_IS_IDENTICAL: |
|
| 107 | - if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false |
|
| 108 | - && $tokens[($i + 1)]['code'] === T_IS_IDENTICAL |
|
| 109 | - && $tokens[($i + 2)]['code'] === T_EQUAL |
|
| 110 | - && $tokens[($i + 3)]['code'] === T_WHITESPACE |
|
| 111 | - && $tokens[($i + 3)]['content'] === "\n" |
|
| 112 | - ) { |
|
| 113 | - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 114 | - $i += 3; |
|
| 115 | - } |
|
| 116 | - break; |
|
| 117 | - |
|
| 118 | - // - Check for delimiters and closers. |
|
| 119 | - // - Inspect heredoc/nowdoc content, comments and inline HTML. |
|
| 120 | - // - Check for subsequent merge conflict openers after the first broke the tokenizer. |
|
| 121 | - case T_ENCAPSED_AND_WHITESPACE: |
|
| 122 | - case T_COMMENT: |
|
| 123 | - case T_DOC_COMMENT_STRING: |
|
| 124 | - case T_INLINE_HTML: |
|
| 125 | - case T_HEREDOC: |
|
| 126 | - case T_NOWDOC: |
|
| 127 | - if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { |
|
| 128 | - $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 80 | + case T_SL: |
|
| 81 | + if (isset($tokens[($i + 1)], $tokens[($i + 2)]) !== false |
|
| 82 | + && $tokens[($i + 1)]['code'] === T_SL |
|
| 83 | + && $tokens[($i + 2)]['code'] === T_STRING |
|
| 84 | + && trim($tokens[($i + 2)]['content']) === '<<< HEAD' |
|
| 85 | + ) { |
|
| 86 | + $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 87 | + $i += 2; |
|
| 88 | + } |
|
| 129 | 89 | break; |
| 130 | - } else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { |
|
| 131 | - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 90 | + |
|
| 91 | + // Check for merge conflict closer which was opened in a heredoc/nowdoc. |
|
| 92 | + case T_SR: |
|
| 93 | + if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)]) !== false |
|
| 94 | + && $tokens[($i + 1)]['code'] === T_SR |
|
| 95 | + && $tokens[($i + 2)]['code'] === T_SR |
|
| 96 | + && $tokens[($i + 3)]['code'] === T_GREATER_THAN |
|
| 97 | + && $tokens[($i + 4)]['code'] === T_WHITESPACE |
|
| 98 | + && $tokens[($i + 4)]['content'] === ' ' |
|
| 99 | + ) { |
|
| 100 | + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 101 | + $i += 4; |
|
| 102 | + } |
|
| 132 | 103 | break; |
| 133 | - } |
|
| 134 | 104 | |
| 135 | - if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { |
|
| 136 | - if ($tokens[$i]['content'] === '=======' |
|
| 137 | - && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE |
|
| 105 | + // Check for merge conflict delimiter which opened in a CSS comment and closed outside. |
|
| 106 | + case T_IS_IDENTICAL: |
|
| 107 | + if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false |
|
| 108 | + && $tokens[($i + 1)]['code'] === T_IS_IDENTICAL |
|
| 109 | + && $tokens[($i + 2)]['code'] === T_EQUAL |
|
| 110 | + && $tokens[($i + 3)]['code'] === T_WHITESPACE |
|
| 111 | + && $tokens[($i + 3)]['content'] === "\n" |
|
| 138 | 112 | ) { |
| 139 | 113 | $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
| 114 | + $i += 3; |
|
| 115 | + } |
|
| 116 | + break; |
|
| 117 | + |
|
| 118 | + // - Check for delimiters and closers. |
|
| 119 | + // - Inspect heredoc/nowdoc content, comments and inline HTML. |
|
| 120 | + // - Check for subsequent merge conflict openers after the first broke the tokenizer. |
|
| 121 | + case T_ENCAPSED_AND_WHITESPACE: |
|
| 122 | + case T_COMMENT: |
|
| 123 | + case T_DOC_COMMENT_STRING: |
|
| 124 | + case T_INLINE_HTML: |
|
| 125 | + case T_HEREDOC: |
|
| 126 | + case T_NOWDOC: |
|
| 127 | + if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { |
|
| 128 | + $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 129 | + break; |
|
| 130 | + } else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { |
|
| 131 | + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 140 | 132 | break; |
| 141 | 133 | } |
| 142 | - } else { |
|
| 143 | - if ($tokens[$i]['content'] === "=======\n") { |
|
| 144 | - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 134 | + |
|
| 135 | + if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { |
|
| 136 | + if ($tokens[$i]['content'] === '=======' |
|
| 137 | + && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE |
|
| 138 | + ) { |
|
| 139 | + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 140 | + break; |
|
| 141 | + } |
|
| 142 | + } else { |
|
| 143 | + if ($tokens[$i]['content'] === "=======\n") { |
|
| 144 | + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 145 | + } |
|
| 145 | 146 | } |
| 146 | - } |
|
| 147 | - break; |
|
| 147 | + break; |
|
| 148 | 148 | }//end switch |
| 149 | 149 | } else { |
| 150 | 150 | // Javascript file. |
| 151 | 151 | switch ($tokens[$i]['code']) { |
| 152 | 152 | // Merge conflict opener. |
| 153 | - case T_SL: |
|
| 154 | - if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)], $tokens[($i + 5)]) !== false |
|
| 155 | - && $tokens[($i + 1)]['code'] === T_SL |
|
| 156 | - && $tokens[($i + 2)]['code'] === T_SL |
|
| 157 | - && $tokens[($i + 3)]['code'] === T_LESS_THAN |
|
| 158 | - && $tokens[($i + 4)]['code'] === T_WHITESPACE |
|
| 159 | - && trim($tokens[($i + 5)]['content']) === 'HEAD' |
|
| 160 | - ) { |
|
| 161 | - $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 162 | - $i += 5; |
|
| 163 | - } |
|
| 164 | - break; |
|
| 165 | - |
|
| 166 | - // Check for merge conflict delimiter. |
|
| 167 | - case T_IS_IDENTICAL: |
|
| 168 | - if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false |
|
| 169 | - && $tokens[($i + 1)]['code'] === T_IS_IDENTICAL |
|
| 170 | - && $tokens[($i + 2)]['code'] === T_EQUAL |
|
| 171 | - && $tokens[($i + 3)]['code'] === T_WHITESPACE |
|
| 172 | - && $tokens[($i + 3)]['content'] === "\n" |
|
| 173 | - ) { |
|
| 174 | - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 175 | - $i += 3; |
|
| 176 | - } |
|
| 177 | - break; |
|
| 178 | - |
|
| 179 | - // Merge conflict closer. |
|
| 180 | - case T_ZSR: |
|
| 181 | - if ($tokens[$i]['code'] === T_ZSR |
|
| 182 | - && isset($tokens[($i + 1)], $tokens[($i + 2)]) === true |
|
| 183 | - && $tokens[($i + 1)]['code'] === T_ZSR |
|
| 184 | - && $tokens[($i + 2)]['code'] === T_GREATER_THAN |
|
| 185 | - ) { |
|
| 186 | - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 187 | - $i += 2; |
|
| 188 | - } |
|
| 189 | - break; |
|
| 190 | - |
|
| 191 | - // Check for merge conflicts in all comments. |
|
| 192 | - case T_COMMENT: |
|
| 193 | - case T_DOC_COMMENT_STRING: |
|
| 194 | - if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { |
|
| 195 | - $phpcsFile->addError($error, $i, 'OpenerFound'); |
|
| 196 | - break; |
|
| 197 | - } else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { |
|
| 198 | - $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 153 | + case T_SL: |
|
| 154 | + if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)], $tokens[($i + 4)], $tokens[($i + 5)]) !== false |
|
| 155 | + && $tokens[($i + 1)]['code'] === T_SL |
|
| 156 | + && $tokens[($i + 2)]['code'] === T_SL |
|
| 157 | + && $tokens[($i + 3)]['code'] === T_LESS_THAN |
|
| 158 | + && $tokens[($i + 4)]['code'] === T_WHITESPACE |
|
| 159 | + && trim($tokens[($i + 5)]['content']) === 'HEAD' |
|
| 160 | + ) { |
|
| 161 | + $phpcsFile->addError($error, $i, 'OpenerFound', ['opener']); |
|
| 162 | + $i += 5; |
|
| 163 | + } |
|
| 199 | 164 | break; |
| 200 | - } |
|
| 201 | 165 | |
| 202 | - if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { |
|
| 203 | - if ($tokens[$i]['content'] === '=======' |
|
| 204 | - && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE |
|
| 166 | + // Check for merge conflict delimiter. |
|
| 167 | + case T_IS_IDENTICAL: |
|
| 168 | + if (isset($tokens[($i + 1)], $tokens[($i + 2)], $tokens[($i + 3)]) !== false |
|
| 169 | + && $tokens[($i + 1)]['code'] === T_IS_IDENTICAL |
|
| 170 | + && $tokens[($i + 2)]['code'] === T_EQUAL |
|
| 171 | + && $tokens[($i + 3)]['code'] === T_WHITESPACE |
|
| 172 | + && $tokens[($i + 3)]['content'] === "\n" |
|
| 205 | 173 | ) { |
| 206 | 174 | $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
| 175 | + $i += 3; |
|
| 176 | + } |
|
| 177 | + break; |
|
| 178 | + |
|
| 179 | + // Merge conflict closer. |
|
| 180 | + case T_ZSR: |
|
| 181 | + if ($tokens[$i]['code'] === T_ZSR |
|
| 182 | + && isset($tokens[($i + 1)], $tokens[($i + 2)]) === true |
|
| 183 | + && $tokens[($i + 1)]['code'] === T_ZSR |
|
| 184 | + && $tokens[($i + 2)]['code'] === T_GREATER_THAN |
|
| 185 | + ) { |
|
| 186 | + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 187 | + $i += 2; |
|
| 188 | + } |
|
| 189 | + break; |
|
| 190 | + |
|
| 191 | + // Check for merge conflicts in all comments. |
|
| 192 | + case T_COMMENT: |
|
| 193 | + case T_DOC_COMMENT_STRING: |
|
| 194 | + if (substr($tokens[$i]['content'], 0, 12) === '<<<<<<< HEAD') { |
|
| 195 | + $phpcsFile->addError($error, $i, 'OpenerFound'); |
|
| 196 | + break; |
|
| 197 | + } else if (substr($tokens[$i]['content'], 0, 8) === '>>>>>>> ') { |
|
| 198 | + $phpcsFile->addError($error, $i, 'CloserFound', ['closer']); |
|
| 207 | 199 | break; |
| 208 | 200 | } |
| 209 | - } else { |
|
| 210 | - if ($tokens[$i]['content'] === "=======\n") { |
|
| 211 | - $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 201 | + |
|
| 202 | + if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) { |
|
| 203 | + if ($tokens[$i]['content'] === '=======' |
|
| 204 | + && $tokens[($i + 1)]['code'] === T_DOC_COMMENT_WHITESPACE |
|
| 205 | + ) { |
|
| 206 | + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 207 | + break; |
|
| 208 | + } |
|
| 209 | + } else { |
|
| 210 | + if ($tokens[$i]['content'] === "=======\n") { |
|
| 211 | + $phpcsFile->addError($error, $i, 'DelimiterFound', ['delimiter']); |
|
| 212 | + } |
|
| 212 | 213 | } |
| 213 | - } |
|
| 214 | - break; |
|
| 214 | + break; |
|
| 215 | 215 | }//end switch |
| 216 | 216 | }//end if |
| 217 | 217 | }//end for |
@@ -28,22 +28,22 @@ |
||
| 28 | 28 | public function getErrorList($testFile='') |
| 29 | 29 | { |
| 30 | 30 | switch ($testFile) { |
| 31 | - case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
| 32 | - return [ |
|
| 33 | - 2 => 1, |
|
| 34 | - 4 => 1, |
|
| 35 | - 6 => 1, |
|
| 36 | - 7 => 1, |
|
| 37 | - 12 => 1, |
|
| 38 | - 13 => 1, |
|
| 39 | - ]; |
|
| 40 | - case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
| 41 | - return [ |
|
| 42 | - 2 => 1, |
|
| 43 | - 9 => 1, |
|
| 44 | - ]; |
|
| 45 | - default: |
|
| 46 | - return []; |
|
| 31 | + case 'DisallowLongArraySyntaxUnitTest.1.inc': |
|
| 32 | + return [ |
|
| 33 | + 2 => 1, |
|
| 34 | + 4 => 1, |
|
| 35 | + 6 => 1, |
|
| 36 | + 7 => 1, |
|
| 37 | + 12 => 1, |
|
| 38 | + 13 => 1, |
|
| 39 | + ]; |
|
| 40 | + case 'DisallowLongArraySyntaxUnitTest.2.inc': |
|
| 41 | + return [ |
|
| 42 | + 2 => 1, |
|
| 43 | + 9 => 1, |
|
| 44 | + ]; |
|
| 45 | + default: |
|
| 46 | + return []; |
|
| 47 | 47 | }//end switch |
| 48 | 48 | |
| 49 | 49 | }//end getErrorList() |