@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | 38 | public $supportedTokenizers = array( |
| 39 | - 'PHP', |
|
| 40 | - 'JS', |
|
| 41 | - ); |
|
| 39 | + 'PHP', |
|
| 40 | + 'JS', |
|
| 41 | + ); |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | T_OPEN_SQUARE_BRACKET, |
| 139 | 139 | T_CLOSE_SQUARE_BRACKET, |
| 140 | 140 | T_MODULUS, |
| 141 | - ); |
|
| 141 | + ); |
|
| 142 | 142 | |
| 143 | 143 | for ($prev = ($stackPtr - 1); $prev > $bracket; $prev--) { |
| 144 | 144 | if (in_array($tokens[$prev]['code'], $allowed) === true) { |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | // A list of tokens that indicate that the token is not |
| 203 | 203 | // part of an arithmetic operation. |
| 204 | 204 | $invalidTokens = array( |
| 205 | - T_COMMA, |
|
| 206 | - T_COLON, |
|
| 207 | - T_OPEN_PARENTHESIS, |
|
| 208 | - T_OPEN_SQUARE_BRACKET, |
|
| 209 | - T_OPEN_SHORT_ARRAY, |
|
| 210 | - T_CASE, |
|
| 211 | - ); |
|
| 205 | + T_COMMA, |
|
| 206 | + T_COLON, |
|
| 207 | + T_OPEN_PARENTHESIS, |
|
| 208 | + T_OPEN_SQUARE_BRACKET, |
|
| 209 | + T_OPEN_SHORT_ARRAY, |
|
| 210 | + T_CASE, |
|
| 211 | + ); |
|
| 212 | 212 | |
| 213 | 213 | if (in_array($tokens[$previousToken]['code'], $invalidTokens) === false) { |
| 214 | 214 | $this->addMissingBracketsError($phpcsFile, $stackPtr); |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | // check is that we are not also enclosed in square brackets |
| 226 | 226 | // like this: ($array[$index + 1]), which is invalid. |
| 227 | 227 | $brackets = array( |
| 228 | - T_OPEN_SQUARE_BRACKET, |
|
| 229 | - T_CLOSE_SQUARE_BRACKET, |
|
| 228 | + T_OPEN_SQUARE_BRACKET, |
|
| 229 | + T_CLOSE_SQUARE_BRACKET, |
|
| 230 | 230 | ); |
| 231 | 231 | |
| 232 | 232 | $squareBracket = $phpcsFile->findPrevious($brackets, ($stackPtr - 1), $lastBracket); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | T_MODULUS => true, |
| 282 | 282 | T_ISSET => true, |
| 283 | 283 | T_ARRAY => true, |
| 284 | - ); |
|
| 284 | + ); |
|
| 285 | 285 | |
| 286 | 286 | // Find the first token in the expression. |
| 287 | 287 | for ($before = ($stackPtr - 1); $before > 0; $before--) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | private $_ignore = array( |
| 43 | 43 | T_WHITESPACE, |
| 44 | 44 | T_COMMENT, |
| 45 | - ); |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'http_response_header', |
| 73 | 73 | 'HTTP_RAW_POST_DATA', |
| 74 | 74 | 'php_errormsg', |
| 75 | - ); |
|
| 75 | + ); |
|
| 76 | 76 | |
| 77 | 77 | // If it's a php reserved var, then its ok. |
| 78 | 78 | if (in_array($varName, $phpReservedVars) === true) { |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | if (substr($varName, 0, 1) === '_') { |
| 164 | 164 | $error = '%s member variable "%s" must not contain a leading underscore'; |
| 165 | 165 | $data = array( |
| 166 | - ucfirst($memberProps['scope']), |
|
| 167 | - $errorData[0], |
|
| 168 | - ); |
|
| 166 | + ucfirst($memberProps['scope']), |
|
| 167 | + $errorData[0], |
|
| 168 | + ); |
|
| 169 | 169 | $phpcsFile->addError($error, $stackPtr, 'PublicHasUnderscore', $data); |
| 170 | 170 | return; |
| 171 | 171 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | 'http_response_header', |
| 212 | 212 | 'HTTP_RAW_POST_DATA', |
| 213 | 213 | 'php_errormsg', |
| 214 | - ); |
|
| 214 | + ); |
|
| 215 | 215 | |
| 216 | 216 | if (preg_match_all('|[^\\\]\${?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)|', $tokens[$stackPtr]['content'], $matches) !== 0) { |
| 217 | 217 | foreach ($matches[1] as $varName) { |
@@ -44,15 +44,15 @@ |
||
| 44 | 44 | * @var array(string => string|null) |
| 45 | 45 | */ |
| 46 | 46 | protected $forbiddenStyles = array( |
| 47 | - '-moz-border-radius' => 'border-radius', |
|
| 48 | - '-webkit-border-radius' => 'border-radius', |
|
| 49 | - '-moz-border-radius-topleft' => 'border-top-left-radius', |
|
| 50 | - '-moz-border-radius-topright' => 'border-top-right-radius', |
|
| 51 | - '-moz-border-radius-bottomright' => 'border-bottom-right-radius', |
|
| 52 | - '-moz-border-radius-bottomleft' => 'border-bottom-left-radius', |
|
| 53 | - '-moz-box-shadow' => 'box-shadow', |
|
| 54 | - '-webkit-box-shadow' => 'box-shadow', |
|
| 55 | - ); |
|
| 47 | + '-moz-border-radius' => 'border-radius', |
|
| 48 | + '-webkit-border-radius' => 'border-radius', |
|
| 49 | + '-moz-border-radius-topleft' => 'border-top-left-radius', |
|
| 50 | + '-moz-border-radius-topright' => 'border-top-right-radius', |
|
| 51 | + '-moz-border-radius-bottomright' => 'border-bottom-right-radius', |
|
| 52 | + '-moz-border-radius-bottomleft' => 'border-bottom-left-radius', |
|
| 53 | + '-moz-box-shadow' => 'box-shadow', |
|
| 54 | + '-webkit-box-shadow' => 'box-shadow', |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * A cache of forbidden style names, for faster lookups. |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | * |
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | - protected function addError($phpcsFile, $stackPtr, $style, $pattern=null) |
|
| 152 | + protected function addError($phpcsFile, $stackPtr, $style, $pattern = null) |
|
| 153 | 153 | { |
| 154 | 154 | $data = array($style); |
| 155 | 155 | $error = 'The use of style %s is '; |
@@ -70,10 +70,10 @@ |
||
| 70 | 70 | // Find the first blank line before this opening brace, unless we get |
| 71 | 71 | // to another style definition, comment or the start of the file. |
| 72 | 72 | $endTokens = array( |
| 73 | - T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET, |
|
| 74 | - T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET, |
|
| 75 | - T_OPEN_TAG => T_OPEN_TAG, |
|
| 76 | - ); |
|
| 73 | + T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET, |
|
| 74 | + T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET, |
|
| 75 | + T_OPEN_TAG => T_OPEN_TAG, |
|
| 76 | + ); |
|
| 77 | 77 | $endTokens += PHP_CodeSniffer_Tokens::$commentTokens; |
| 78 | 78 | |
| 79 | 79 | $prev = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | |
| 70 | 70 | // Find the first blank line before this opening brace, unless we get |
| 71 | 71 | // to another style definition, comment or the start of the file. |
| 72 | - $endTokens = array( |
|
| 72 | + $endTokens = array( |
|
| 73 | 73 | T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET, |
| 74 | 74 | T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET, |
| 75 | 75 | T_OPEN_TAG => T_OPEN_TAG, |
@@ -44,24 +44,24 @@ |
||
| 44 | 44 | * @var array |
| 45 | 45 | */ |
| 46 | 46 | public $colourNames = array( |
| 47 | - 'aqua' => 'aqua', |
|
| 48 | - 'black' => 'black', |
|
| 49 | - 'blue' => 'blue', |
|
| 50 | - 'fuchsia' => 'fuchsia', |
|
| 51 | - 'gray' => 'gray', |
|
| 52 | - 'green' => 'green', |
|
| 53 | - 'lime' => 'lime', |
|
| 54 | - 'maroon' => 'maroon', |
|
| 55 | - 'navy' => 'navy', |
|
| 56 | - 'olive' => 'olive', |
|
| 57 | - 'orange' => 'orange', |
|
| 58 | - 'purple' => 'purple', |
|
| 59 | - 'red' => 'red', |
|
| 60 | - 'silver' => 'silver', |
|
| 61 | - 'teal' => 'teal', |
|
| 62 | - 'white' => 'white', |
|
| 63 | - 'yellow' => 'yellow', |
|
| 64 | - ); |
|
| 47 | + 'aqua' => 'aqua', |
|
| 48 | + 'black' => 'black', |
|
| 49 | + 'blue' => 'blue', |
|
| 50 | + 'fuchsia' => 'fuchsia', |
|
| 51 | + 'gray' => 'gray', |
|
| 52 | + 'green' => 'green', |
|
| 53 | + 'lime' => 'lime', |
|
| 54 | + 'maroon' => 'maroon', |
|
| 55 | + 'navy' => 'navy', |
|
| 56 | + 'olive' => 'olive', |
|
| 57 | + 'orange' => 'orange', |
|
| 58 | + 'purple' => 'purple', |
|
| 59 | + 'red' => 'red', |
|
| 60 | + 'silver' => 'silver', |
|
| 61 | + 'teal' => 'teal', |
|
| 62 | + 'white' => 'white', |
|
| 63 | + 'yellow' => 'yellow', |
|
| 64 | + ); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -132,9 +132,9 @@ |
||
| 132 | 132 | } else if ($foundIndent !== $expectedIndent) { |
| 133 | 133 | $error = 'Line indented incorrectly; expected %s spaces, found %s'; |
| 134 | 134 | $data = array( |
| 135 | - $expectedIndent, |
|
| 136 | - $foundIndent, |
|
| 137 | - ); |
|
| 135 | + $expectedIndent, |
|
| 136 | + $foundIndent, |
|
| 137 | + ); |
|
| 138 | 138 | |
| 139 | 139 | $fix = $phpcsFile->addFixableError($error, $i, 'Incorrect', $data); |
| 140 | 140 | if ($fix === true) { |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | if ($colour !== $expected) { |
| 67 | 67 | $error = 'CSS colours must be defined in uppercase; expected %s but found %s'; |
| 68 | 68 | $data = array( |
| 69 | - $expected, |
|
| 70 | - $colour, |
|
| 71 | - ); |
|
| 69 | + $expected, |
|
| 70 | + $colour, |
|
| 71 | + ); |
|
| 72 | 72 | |
| 73 | 73 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotUpper', $data); |
| 74 | 74 | if ($fix === true) { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $expected = '#'.$colour{1}.$colour{3}.$colour{5}; |
| 86 | 86 | $error = 'CSS colours must use shorthand if available; expected %s but found %s'; |
| 87 | 87 | $data = array( |
| 88 | - $expected, |
|
| 89 | - $colour, |
|
| 88 | + $expected, |
|
| 89 | + $colour, |
|
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | 92 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Shorthand', $data); |
@@ -92,9 +92,9 @@ |
||
| 92 | 92 | if ($expected !== $tokens[$i]['content']) { |
| 93 | 93 | $error = 'Style definitions must be lowercase; expected %s but found %s'; |
| 94 | 94 | $data = array( |
| 95 | - $expected, |
|
| 96 | - $tokens[$i]['content'], |
|
| 97 | - ); |
|
| 95 | + $expected, |
|
| 96 | + $tokens[$i]['content'], |
|
| 97 | + ); |
|
| 98 | 98 | |
| 99 | 99 | $fix = $phpcsFile->addFixableError($error, $i, 'FoundUpper', $data); |
| 100 | 100 | if ($fix === true) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | T_REQUIRE, |
| 49 | 49 | T_REQUIRE_ONCE, |
| 50 | 50 | T_NEW, |
| 51 | - ); |
|
| 51 | + ); |
|
| 52 | 52 | |
| 53 | 53 | }//end register() |
| 54 | 54 | |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | } else { |
| 86 | 86 | $error = 'Language constructs must be followed by a single space; expected "%s" but found "%s"'; |
| 87 | 87 | $data = array( |
| 88 | - $tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'], |
|
| 89 | - $tokens[$stackPtr]['content'].$tokens[($stackPtr + 1)]['content'], |
|
| 90 | - ); |
|
| 88 | + $tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'], |
|
| 89 | + $tokens[$stackPtr]['content'].$tokens[($stackPtr + 1)]['content'], |
|
| 90 | + ); |
|
| 91 | 91 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); |
| 92 | 92 | if ($fix === true) { |
| 93 | 93 | $phpcsFile->fixer->addContent($stackPtr, ' '); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | $tokens[$stackPtr]['content'].' '.$tokens[($stackPtr + 1)]['content'], |
| 89 | 89 | $tokens[$stackPtr]['content'].$tokens[($stackPtr + 1)]['content'], |
| 90 | 90 | ); |
| 91 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); |
|
| 91 | + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data); |
|
| 92 | 92 | if ($fix === true) { |
| 93 | 93 | $phpcsFile->fixer->addContent($stackPtr, ' '); |
| 94 | 94 | } |