@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | /** |
475 | 475 | * Sets the internal CLI object. |
476 | 476 | * |
477 | - * @param object $cli The CLI object controlling the run. |
|
477 | + * @param PHP_CodeSniffer_CLI $cli The CLI object controlling the run. |
|
478 | 478 | * |
479 | 479 | * @return void |
480 | 480 | */ |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param string|array $files The files and directories to process. For |
492 | 492 | * directories, each sub directory will also |
493 | 493 | * be traversed for source files. |
494 | - * @param string|array $standards The set of code sniffs we are testing |
|
494 | + * @param string $standards The set of code sniffs we are testing |
|
495 | 495 | * against. |
496 | 496 | * @param array $restrictions The sniff codes to restrict the |
497 | 497 | * violations to. |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | * |
2287 | 2287 | * @param string $standard The name of the coding standard. |
2288 | 2288 | * |
2289 | - * @return string|null |
|
2289 | + * @return string |
|
2290 | 2290 | */ |
2291 | 2291 | public static function getInstalledStandardPath($standard) |
2292 | 2292 | { |
@@ -2455,7 +2455,7 @@ discard block |
||
2455 | 2455 | * |
2456 | 2456 | * @param string $path The path to use. |
2457 | 2457 | * |
2458 | - * @return mixed |
|
2458 | + * @return boolean |
|
2459 | 2459 | */ |
2460 | 2460 | public static function isPharFile($path) |
2461 | 2461 | { |
@@ -2475,7 +2475,7 @@ discard block |
||
2475 | 2475 | * |
2476 | 2476 | * @param string $path The path to use. |
2477 | 2477 | * |
2478 | - * @return mixed |
|
2478 | + * @return string|false |
|
2479 | 2479 | */ |
2480 | 2480 | public static function realpath($path) |
2481 | 2481 | { |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | * @var array |
182 | 182 | */ |
183 | 183 | public $defaultFileExtensions = array( |
184 | - 'php' => 'PHP', |
|
185 | - 'inc' => 'PHP', |
|
186 | - 'js' => 'JS', |
|
187 | - 'css' => 'CSS', |
|
184 | + 'php' => 'PHP', |
|
185 | + 'inc' => 'PHP', |
|
186 | + 'js' => 'JS', |
|
187 | + 'css' => 'CSS', |
|
188 | 188 | ); |
189 | 189 | |
190 | 190 | /** |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | * @var array(string) |
194 | 194 | */ |
195 | 195 | public static $allowedTypes = array( |
196 | - 'array', |
|
197 | - 'boolean', |
|
198 | - 'float', |
|
199 | - 'integer', |
|
200 | - 'mixed', |
|
201 | - 'object', |
|
202 | - 'string', |
|
203 | - 'resource', |
|
204 | - 'callable', |
|
205 | - ); |
|
196 | + 'array', |
|
197 | + 'boolean', |
|
198 | + 'float', |
|
199 | + 'integer', |
|
200 | + 'mixed', |
|
201 | + 'object', |
|
202 | + 'string', |
|
203 | + 'resource', |
|
204 | + 'callable', |
|
205 | + ); |
|
206 | 206 | |
207 | 207 | |
208 | 208 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | |
1230 | 1230 | if (isset($this->ruleset[$code]) === false) { |
1231 | 1231 | $this->ruleset[$code] = array( |
1232 | - 'properties' => array(), |
|
1232 | + 'properties' => array(), |
|
1233 | 1233 | ); |
1234 | 1234 | } else if (isset($this->ruleset[$code]['properties']) === false) { |
1235 | 1235 | $this->ruleset[$code]['properties'] = array(); |
@@ -1457,8 +1457,8 @@ discard block |
||
1457 | 1457 | // While there is support for a type of each pattern |
1458 | 1458 | // (absolute or relative) we don't actually support it here. |
1459 | 1459 | $replacements = array( |
1460 | - '\\,' => ',', |
|
1461 | - '*' => '.*', |
|
1460 | + '\\,' => ',', |
|
1461 | + '*' => '.*', |
|
1462 | 1462 | ); |
1463 | 1463 | |
1464 | 1464 | $ignorePatterns[] = strtr($pattern, $replacements); |
@@ -1471,11 +1471,11 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | if (isset($this->_tokenListeners[$token][$listenerClass]) === false) { |
1473 | 1473 | $this->_tokenListeners[$token][$listenerClass] = array( |
1474 | - 'class' => $listenerClass, |
|
1475 | - 'source' => $listenerSource, |
|
1476 | - 'tokenizers' => $tokenizers, |
|
1477 | - 'ignore' => $ignorePatterns, |
|
1478 | - ); |
|
1474 | + 'class' => $listenerClass, |
|
1475 | + 'source' => $listenerSource, |
|
1476 | + 'tokenizers' => $tokenizers, |
|
1477 | + 'ignore' => $ignorePatterns, |
|
1478 | + ); |
|
1479 | 1479 | } |
1480 | 1480 | } |
1481 | 1481 | }//end foreach |
@@ -1655,8 +1655,8 @@ discard block |
||
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | $replacements = array( |
1658 | - '\\,' => ',', |
|
1659 | - '*' => '.*', |
|
1658 | + '\\,' => ',', |
|
1659 | + '*' => '.*', |
|
1660 | 1660 | ); |
1661 | 1661 | |
1662 | 1662 | // We assume a / directory separator, as do the exclude rules |
@@ -1802,18 +1802,18 @@ discard block |
||
1802 | 1802 | $input = trim($input); |
1803 | 1803 | |
1804 | 1804 | switch ($input) { |
1805 | - case 's': |
|
1806 | - break(2); |
|
1807 | - case 'q': |
|
1808 | - exit(0); |
|
1809 | - break; |
|
1810 | - default: |
|
1811 | - // Repopulate the sniffs because some of them save their state |
|
1812 | - // and only clear it when the file changes, but we are rechecking |
|
1813 | - // the same file. |
|
1814 | - $this->populateTokenListeners(); |
|
1815 | - $phpcsFile = $this->_processFile($file, $contents); |
|
1816 | - break; |
|
1805 | + case 's': |
|
1806 | + break(2); |
|
1807 | + case 'q': |
|
1808 | + exit(0); |
|
1809 | + break; |
|
1810 | + default: |
|
1811 | + // Repopulate the sniffs because some of them save their state |
|
1812 | + // and only clear it when the file changes, but we are rechecking |
|
1813 | + // the same file. |
|
1814 | + $this->populateTokenListeners(); |
|
1815 | + $phpcsFile = $this->_processFile($file, $contents); |
|
1816 | + break; |
|
1817 | 1817 | } |
1818 | 1818 | }//end while |
1819 | 1819 | |
@@ -2075,15 +2075,15 @@ discard block |
||
2075 | 2075 | } else { |
2076 | 2076 | $lowerVarType = strtolower($varType); |
2077 | 2077 | switch ($lowerVarType) { |
2078 | - case 'bool': |
|
2079 | - return 'boolean'; |
|
2080 | - case 'double': |
|
2081 | - case 'real': |
|
2082 | - return 'float'; |
|
2083 | - case 'int': |
|
2084 | - return 'integer'; |
|
2085 | - case 'array()': |
|
2086 | - return 'array'; |
|
2078 | + case 'bool': |
|
2079 | + return 'boolean'; |
|
2080 | + case 'double': |
|
2081 | + case 'real': |
|
2082 | + return 'float'; |
|
2083 | + case 'int': |
|
2084 | + return 'integer'; |
|
2085 | + case 'array()': |
|
2086 | + return 'array'; |
|
2087 | 2087 | }//end switch |
2088 | 2088 | |
2089 | 2089 | if (strpos($lowerVarType, 'array(') !== false) { |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @see process() |
226 | 226 | */ |
227 | 227 | public function __construct( |
228 | - $verbosity=0, |
|
229 | - $tabWidth=0, |
|
230 | - $encoding='iso-8859-1', |
|
231 | - $interactive=false |
|
228 | + $verbosity = 0, |
|
229 | + $tabWidth = 0, |
|
230 | + $encoding = 'iso-8859-1', |
|
231 | + $interactive = false |
|
232 | 232 | ) { |
233 | 233 | if ($verbosity !== null) { |
234 | 234 | $this->setVerbosity($verbosity); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return array |
458 | 458 | */ |
459 | - public function getIgnorePatterns($listener=null) |
|
459 | + public function getIgnorePatterns($listener = null) |
|
460 | 460 | { |
461 | 461 | if ($listener === null) { |
462 | 462 | return $this->ignorePatterns; |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @return void |
501 | 501 | */ |
502 | - public function process($files, $standards, array $restrictions=array(), $local=false) |
|
502 | + public function process($files, $standards, array $restrictions = array(), $local = false) |
|
503 | 503 | { |
504 | 504 | $files = (array) $files; |
505 | 505 | $this->initStandard($standards, $restrictions); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return void |
519 | 519 | */ |
520 | - public function initStandard($standards, array $restrictions=array()) |
|
520 | + public function initStandard($standards, array $restrictions = array()) |
|
521 | 521 | { |
522 | 522 | $standards = (array) $standards; |
523 | 523 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * @return void |
590 | 590 | * @throws PHP_CodeSniffer_Exception If files are invalid. |
591 | 591 | */ |
592 | - public function processFiles($files, $local=false) |
|
592 | + public function processFiles($files, $local = false) |
|
593 | 593 | { |
594 | 594 | $files = (array) $files; |
595 | 595 | $cliValues = $this->cli->getCommandLineValues(); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | * @return array |
697 | 697 | * @throws PHP_CodeSniffer_Exception If the ruleset path is invalid. |
698 | 698 | */ |
699 | - public function processRuleset($rulesetPath, $depth=0) |
|
699 | + public function processRuleset($rulesetPath, $depth = 0) |
|
700 | 700 | { |
701 | 701 | $rulesetPath = self::realpath($rulesetPath); |
702 | 702 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | * |
922 | 922 | * @return array |
923 | 923 | */ |
924 | - private function _expandSniffDirectory($directory, $depth=0) |
|
924 | + private function _expandSniffDirectory($directory, $depth = 0) |
|
925 | 925 | { |
926 | 926 | $sniffs = array(); |
927 | 927 | |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | * @return array |
990 | 990 | * @throws PHP_CodeSniffer_Exception If the reference is invalid. |
991 | 991 | */ |
992 | - private function _expandRulesetReference($ref, $rulesetDir, $depth=0) |
|
992 | + private function _expandRulesetReference($ref, $rulesetDir, $depth = 0) |
|
993 | 993 | { |
994 | 994 | // Ignore internal sniffs codes as they are used to only |
995 | 995 | // hide and change internal messages. |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | * |
1170 | 1170 | * @return void |
1171 | 1171 | */ |
1172 | - private function _processRule($rule, $depth=0) |
|
1172 | + private function _processRule($rule, $depth = 0) |
|
1173 | 1173 | { |
1174 | 1174 | $code = (string) $rule['ref']; |
1175 | 1175 | |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | foreach (explode(',', $value) as $val) { |
1245 | 1245 | $v = ''; |
1246 | 1246 | |
1247 | - list($k,$v) = explode('=>', $val.'=>'); |
|
1247 | + list($k, $v) = explode('=>', $val.'=>'); |
|
1248 | 1248 | if ($v !== '') { |
1249 | 1249 | $values[$k] = $v; |
1250 | 1250 | } else { |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | * |
1301 | 1301 | * @return bool |
1302 | 1302 | */ |
1303 | - private function _shouldProcessElement($element, $depth=0) |
|
1303 | + private function _shouldProcessElement($element, $depth = 0) |
|
1304 | 1304 | { |
1305 | 1305 | if (isset($element['phpcbf-only']) === false |
1306 | 1306 | && isset($element['phpcs-only']) === false |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | * @throws Exception If there was an error opening a directory. |
1530 | 1530 | * @see shouldProcessFile() |
1531 | 1531 | */ |
1532 | - public function getFilesToProcess($paths, $local=false) |
|
1532 | + public function getFilesToProcess($paths, $local = false) |
|
1533 | 1533 | { |
1534 | 1534 | $files = array(); |
1535 | 1535 | |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | * @throws PHP_CodeSniffer_Exception If the file could not be processed. |
1701 | 1701 | * @see _processFile() |
1702 | 1702 | */ |
1703 | - public function processFile($file, $contents=null) |
|
1703 | + public function processFile($file, $contents = null) |
|
1704 | 1704 | { |
1705 | 1705 | if ($contents === null && file_exists($file) === false) { |
1706 | 1706 | throw new PHP_CodeSniffer_Exception("Source file $file does not exist"); |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | * |
1894 | 1894 | * @return void |
1895 | 1895 | */ |
1896 | - public function generateDocs($standard, array $sniffs=array(), $generator='Text') |
|
1896 | + public function generateDocs($standard, array $sniffs = array(), $generator = 'Text') |
|
1897 | 1897 | { |
1898 | 1898 | if (class_exists('PHP_CodeSniffer_DocGenerators_'.$generator, true) === false) { |
1899 | 1899 | throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_'.$generator.' not found'); |
@@ -1953,9 +1953,9 @@ discard block |
||
1953 | 1953 | */ |
1954 | 1954 | public static function isCamelCaps( |
1955 | 1955 | $string, |
1956 | - $classFormat=false, |
|
1957 | - $public=true, |
|
1958 | - $strict=true |
|
1956 | + $classFormat = false, |
|
1957 | + $public = true, |
|
1958 | + $strict = true |
|
1959 | 1959 | ) { |
1960 | 1960 | // Check the first character first. |
1961 | 1961 | if ($classFormat === false) { |
@@ -2197,8 +2197,8 @@ discard block |
||
2197 | 2197 | * @see isInstalledStandard() |
2198 | 2198 | */ |
2199 | 2199 | public static function getInstalledStandards( |
2200 | - $includeGeneric=false, |
|
2201 | - $standardsDir='' |
|
2200 | + $includeGeneric = false, |
|
2201 | + $standardsDir = '' |
|
2202 | 2202 | ) { |
2203 | 2203 | $installedStandards = array(); |
2204 | 2204 | |
@@ -2356,7 +2356,7 @@ discard block |
||
2356 | 2356 | * @see getConfigData() |
2357 | 2357 | * @throws PHP_CodeSniffer_Exception If the config file can not be written. |
2358 | 2358 | */ |
2359 | - public static function setConfigData($key, $value, $temp=false) |
|
2359 | + public static function setConfigData($key, $value, $temp = false) |
|
2360 | 2360 | { |
2361 | 2361 | if ($temp === false) { |
2362 | 2362 | $path = ''; |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * The TOC is just an unordered list of bookmarks to sniffs on the page. |
159 | 159 | * |
160 | - * @param array $standardFiles An array of paths to the XML standard files. |
|
160 | + * @param string[] $standardFiles An array of paths to the XML standard files. |
|
161 | 161 | * |
162 | 162 | * @return void |
163 | 163 | */ |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | * @param string $error The error message. |
867 | 867 | * @param int $line The line on which the error occurred. |
868 | 868 | * @param string $code A violation code unique to the sniff message. |
869 | - * @param array $data Replacements for the error message. |
|
869 | + * @param string[] $data Replacements for the error message. |
|
870 | 870 | * @param int $severity The severity level for this error. A value of 0 will be converted into the default severity level. |
871 | 871 | * will be converted into the default severity level. |
872 | 872 | * |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | * @param string $warning The error message. |
891 | 891 | * @param int $line The line on which the warning occurred. |
892 | 892 | * @param string $code A violation code unique to the sniff message. |
893 | - * @param array $data Replacements for the warning message. |
|
893 | + * @param string[] $data Replacements for the warning message. |
|
894 | 894 | * @param int $severity The severity level for this warning. A value of 0 will be converted into the default severity level. |
895 | 895 | * will be converted into the default severity level. |
896 | 896 | * |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | // While there is support for a type of each pattern |
1046 | 1046 | // (absolute or relative) we don't actually support it here. |
1047 | 1047 | $replacements = array( |
1048 | - '\\,' => ',', |
|
1049 | - '*' => '.*', |
|
1048 | + '\\,' => ',', |
|
1049 | + '*' => '.*', |
|
1050 | 1050 | ); |
1051 | 1051 | |
1052 | 1052 | // We assume a / directory separator, as do the exclude rules |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | 'source' => $sniffCode, |
1102 | 1102 | 'severity' => $severity, |
1103 | 1103 | 'fixable' => $fixable, |
1104 | - ); |
|
1104 | + ); |
|
1105 | 1105 | |
1106 | 1106 | if (PHP_CODESNIFFER_VERBOSITY > 1 |
1107 | 1107 | && $this->fixer->enabled === true |
@@ -1192,8 +1192,8 @@ discard block |
||
1192 | 1192 | // While there is support for a type of each pattern |
1193 | 1193 | // (absolute or relative) we don't actually support it here. |
1194 | 1194 | $replacements = array( |
1195 | - '\\,' => ',', |
|
1196 | - '*' => '.*', |
|
1195 | + '\\,' => ',', |
|
1196 | + '*' => '.*', |
|
1197 | 1197 | ); |
1198 | 1198 | |
1199 | 1199 | // We assume a / directory separator, as do the exclude rules |
@@ -1244,11 +1244,11 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | $this->_warnings[$line][$column][] = array( |
1247 | - 'message' => $message, |
|
1248 | - 'source' => $sniffCode, |
|
1249 | - 'severity' => $severity, |
|
1250 | - 'fixable' => $fixable, |
|
1251 | - ); |
|
1247 | + 'message' => $message, |
|
1248 | + 'source' => $sniffCode, |
|
1249 | + 'severity' => $severity, |
|
1250 | + 'fixable' => $fixable, |
|
1251 | + ); |
|
1252 | 1252 | |
1253 | 1253 | if (PHP_CODESNIFFER_VERBOSITY > 1 |
1254 | 1254 | && $this->fixer->enabled === true |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | if (isset($this->_metrics[$metric]) === false) { |
1279 | 1279 | $this->_metrics[$metric] = array( |
1280 | 1280 | 'values' => array( |
1281 | - $value => array($stackPtr), |
|
1281 | + $value => array($stackPtr), |
|
1282 | 1282 | ), |
1283 | - ); |
|
1283 | + ); |
|
1284 | 1284 | } else { |
1285 | 1285 | if (isset($this->_metrics[$metric]['values'][$value]) === false) { |
1286 | 1286 | $this->_metrics[$metric]['values'][$value] = array($stackPtr); |
@@ -1487,17 +1487,17 @@ discard block |
||
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | $tokensWithTabs = array( |
1490 | - T_WHITESPACE => true, |
|
1491 | - T_COMMENT => true, |
|
1492 | - T_DOC_COMMENT => true, |
|
1493 | - T_DOC_COMMENT_WHITESPACE => true, |
|
1494 | - T_DOC_COMMENT_STRING => true, |
|
1495 | - T_CONSTANT_ENCAPSED_STRING => true, |
|
1496 | - T_DOUBLE_QUOTED_STRING => true, |
|
1497 | - T_HEREDOC => true, |
|
1498 | - T_NOWDOC => true, |
|
1499 | - T_INLINE_HTML => true, |
|
1500 | - ); |
|
1490 | + T_WHITESPACE => true, |
|
1491 | + T_COMMENT => true, |
|
1492 | + T_DOC_COMMENT => true, |
|
1493 | + T_DOC_COMMENT_WHITESPACE => true, |
|
1494 | + T_DOC_COMMENT_STRING => true, |
|
1495 | + T_CONSTANT_ENCAPSED_STRING => true, |
|
1496 | + T_DOUBLE_QUOTED_STRING => true, |
|
1497 | + T_HEREDOC => true, |
|
1498 | + T_NOWDOC => true, |
|
1499 | + T_INLINE_HTML => true, |
|
1500 | + ); |
|
1501 | 1501 | |
1502 | 1502 | $numTokens = count($tokens); |
1503 | 1503 | for ($i = 0; $i < $numTokens; $i++) { |
@@ -1997,7 +1997,7 @@ discard block |
||
1997 | 1997 | $todo = array( |
1998 | 1998 | $stackPtr, |
1999 | 1999 | $opener, |
2000 | - ); |
|
2000 | + ); |
|
2001 | 2001 | |
2002 | 2002 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
2003 | 2003 | $type = $tokens[$stackPtr]['type']; |
@@ -2906,16 +2906,16 @@ discard block |
||
2906 | 2906 | } |
2907 | 2907 | |
2908 | 2908 | $valid = array( |
2909 | - T_PUBLIC => T_PUBLIC, |
|
2910 | - T_PRIVATE => T_PRIVATE, |
|
2911 | - T_PROTECTED => T_PROTECTED, |
|
2912 | - T_STATIC => T_STATIC, |
|
2913 | - T_FINAL => T_FINAL, |
|
2914 | - T_ABSTRACT => T_ABSTRACT, |
|
2915 | - T_WHITESPACE => T_WHITESPACE, |
|
2916 | - T_COMMENT => T_COMMENT, |
|
2917 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
2918 | - ); |
|
2909 | + T_PUBLIC => T_PUBLIC, |
|
2910 | + T_PRIVATE => T_PRIVATE, |
|
2911 | + T_PROTECTED => T_PROTECTED, |
|
2912 | + T_STATIC => T_STATIC, |
|
2913 | + T_FINAL => T_FINAL, |
|
2914 | + T_ABSTRACT => T_ABSTRACT, |
|
2915 | + T_WHITESPACE => T_WHITESPACE, |
|
2916 | + T_COMMENT => T_COMMENT, |
|
2917 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
2918 | + ); |
|
2919 | 2919 | |
2920 | 2920 | $scope = 'public'; |
2921 | 2921 | $scopeSpecified = false; |
@@ -2961,7 +2961,7 @@ discard block |
||
2961 | 2961 | 'is_final' => $isFinal, |
2962 | 2962 | 'is_static' => $isStatic, |
2963 | 2963 | 'is_closure' => $isClosure, |
2964 | - ); |
|
2964 | + ); |
|
2965 | 2965 | |
2966 | 2966 | }//end getMethodProperties() |
2967 | 2967 | |
@@ -3019,16 +3019,16 @@ discard block |
||
3019 | 3019 | } |
3020 | 3020 | |
3021 | 3021 | $valid = array( |
3022 | - T_PUBLIC => T_PUBLIC, |
|
3023 | - T_PRIVATE => T_PRIVATE, |
|
3024 | - T_PROTECTED => T_PROTECTED, |
|
3025 | - T_STATIC => T_STATIC, |
|
3026 | - T_WHITESPACE => T_WHITESPACE, |
|
3027 | - T_COMMENT => T_COMMENT, |
|
3028 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
3029 | - T_VARIABLE => T_VARIABLE, |
|
3030 | - T_COMMA => T_COMMA, |
|
3031 | - ); |
|
3022 | + T_PUBLIC => T_PUBLIC, |
|
3023 | + T_PRIVATE => T_PRIVATE, |
|
3024 | + T_PROTECTED => T_PROTECTED, |
|
3025 | + T_STATIC => T_STATIC, |
|
3026 | + T_WHITESPACE => T_WHITESPACE, |
|
3027 | + T_COMMENT => T_COMMENT, |
|
3028 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
3029 | + T_VARIABLE => T_VARIABLE, |
|
3030 | + T_COMMA => T_COMMA, |
|
3031 | + ); |
|
3032 | 3032 | |
3033 | 3033 | $scope = 'public'; |
3034 | 3034 | $scopeSpecified = false; |
@@ -3062,7 +3062,7 @@ discard block |
||
3062 | 3062 | 'scope' => $scope, |
3063 | 3063 | 'scope_specified' => $scopeSpecified, |
3064 | 3064 | 'is_static' => $isStatic, |
3065 | - ); |
|
3065 | + ); |
|
3066 | 3066 | |
3067 | 3067 | }//end getMemberProperties() |
3068 | 3068 | |
@@ -3092,12 +3092,12 @@ discard block |
||
3092 | 3092 | } |
3093 | 3093 | |
3094 | 3094 | $valid = array( |
3095 | - T_FINAL => T_FINAL, |
|
3096 | - T_ABSTRACT => T_ABSTRACT, |
|
3097 | - T_WHITESPACE => T_WHITESPACE, |
|
3098 | - T_COMMENT => T_COMMENT, |
|
3099 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
3100 | - ); |
|
3095 | + T_FINAL => T_FINAL, |
|
3096 | + T_ABSTRACT => T_ABSTRACT, |
|
3097 | + T_WHITESPACE => T_WHITESPACE, |
|
3098 | + T_COMMENT => T_COMMENT, |
|
3099 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
3100 | + ); |
|
3101 | 3101 | |
3102 | 3102 | $isAbstract = false; |
3103 | 3103 | $isFinal = false; |
@@ -3121,7 +3121,7 @@ discard block |
||
3121 | 3121 | return array( |
3122 | 3122 | 'is_abstract' => $isAbstract, |
3123 | 3123 | 'is_final' => $isFinal, |
3124 | - ); |
|
3124 | + ); |
|
3125 | 3125 | |
3126 | 3126 | }//end getClassProperties() |
3127 | 3127 | |
@@ -3471,17 +3471,17 @@ discard block |
||
3471 | 3471 | public function findEndOfStatement($start, $ignore=null) |
3472 | 3472 | { |
3473 | 3473 | $endTokens = array( |
3474 | - T_COLON => true, |
|
3475 | - T_COMMA => true, |
|
3476 | - T_DOUBLE_ARROW => true, |
|
3477 | - T_SEMICOLON => true, |
|
3478 | - T_CLOSE_PARENTHESIS => true, |
|
3479 | - T_CLOSE_SQUARE_BRACKET => true, |
|
3480 | - T_CLOSE_CURLY_BRACKET => true, |
|
3481 | - T_CLOSE_SHORT_ARRAY => true, |
|
3482 | - T_OPEN_TAG => true, |
|
3483 | - T_CLOSE_TAG => true, |
|
3484 | - ); |
|
3474 | + T_COLON => true, |
|
3475 | + T_COMMA => true, |
|
3476 | + T_DOUBLE_ARROW => true, |
|
3477 | + T_SEMICOLON => true, |
|
3478 | + T_CLOSE_PARENTHESIS => true, |
|
3479 | + T_CLOSE_SQUARE_BRACKET => true, |
|
3480 | + T_CLOSE_CURLY_BRACKET => true, |
|
3481 | + T_CLOSE_SHORT_ARRAY => true, |
|
3482 | + T_OPEN_TAG => true, |
|
3483 | + T_CLOSE_TAG => true, |
|
3484 | + ); |
|
3485 | 3485 | |
3486 | 3486 | if ($ignore !== null) { |
3487 | 3487 | $ignore = (array) $ignore; |
@@ -3694,9 +3694,9 @@ discard block |
||
3694 | 3694 | } |
3695 | 3695 | |
3696 | 3696 | $find = array( |
3697 | - T_NS_SEPARATOR, |
|
3698 | - T_STRING, |
|
3699 | - T_WHITESPACE, |
|
3697 | + T_NS_SEPARATOR, |
|
3698 | + T_STRING, |
|
3699 | + T_WHITESPACE, |
|
3700 | 3700 | ); |
3701 | 3701 | |
3702 | 3702 | $end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true); |
@@ -1704,60 +1704,60 @@ discard block |
||
1704 | 1704 | */ |
1705 | 1705 | |
1706 | 1706 | switch ($tokens[$i]['code']) { |
1707 | - case T_OPEN_SQUARE_BRACKET: |
|
1708 | - $squareOpeners[] = $i; |
|
1709 | - |
|
1710 | - if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1711 | - echo str_repeat("\t", count($squareOpeners)); |
|
1712 | - echo str_repeat("\t", count($curlyOpeners)); |
|
1713 | - echo "=> Found square bracket opener at $i".PHP_EOL; |
|
1714 | - } |
|
1715 | - break; |
|
1716 | - case T_OPEN_CURLY_BRACKET: |
|
1717 | - if (isset($tokens[$i]['scope_closer']) === false) { |
|
1718 | - $curlyOpeners[] = $i; |
|
1707 | + case T_OPEN_SQUARE_BRACKET: |
|
1708 | + $squareOpeners[] = $i; |
|
1719 | 1709 | |
1720 | 1710 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
1721 | 1711 | echo str_repeat("\t", count($squareOpeners)); |
1722 | 1712 | echo str_repeat("\t", count($curlyOpeners)); |
1723 | - echo "=> Found curly bracket opener at $i".PHP_EOL; |
|
1713 | + echo "=> Found square bracket opener at $i".PHP_EOL; |
|
1724 | 1714 | } |
1725 | - } |
|
1726 | - break; |
|
1727 | - case T_CLOSE_SQUARE_BRACKET: |
|
1728 | - if (empty($squareOpeners) === false) { |
|
1729 | - $opener = array_pop($squareOpeners); |
|
1730 | - $tokens[$i]['bracket_opener'] = $opener; |
|
1731 | - $tokens[$i]['bracket_closer'] = $i; |
|
1732 | - $tokens[$opener]['bracket_opener'] = $opener; |
|
1733 | - $tokens[$opener]['bracket_closer'] = $i; |
|
1715 | + break; |
|
1716 | + case T_OPEN_CURLY_BRACKET: |
|
1717 | + if (isset($tokens[$i]['scope_closer']) === false) { |
|
1718 | + $curlyOpeners[] = $i; |
|
1734 | 1719 | |
1735 | - if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1736 | - echo str_repeat("\t", count($squareOpeners)); |
|
1737 | - echo str_repeat("\t", count($curlyOpeners)); |
|
1738 | - echo "\t=> Found square bracket closer at $i for $opener".PHP_EOL; |
|
1720 | + if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1721 | + echo str_repeat("\t", count($squareOpeners)); |
|
1722 | + echo str_repeat("\t", count($curlyOpeners)); |
|
1723 | + echo "=> Found curly bracket opener at $i".PHP_EOL; |
|
1724 | + } |
|
1739 | 1725 | } |
1740 | - } |
|
1741 | - break; |
|
1742 | - case T_CLOSE_CURLY_BRACKET: |
|
1743 | - if (empty($curlyOpeners) === false |
|
1744 | - && isset($tokens[$i]['scope_opener']) === false |
|
1745 | - ) { |
|
1746 | - $opener = array_pop($curlyOpeners); |
|
1747 | - $tokens[$i]['bracket_opener'] = $opener; |
|
1748 | - $tokens[$i]['bracket_closer'] = $i; |
|
1749 | - $tokens[$opener]['bracket_opener'] = $opener; |
|
1750 | - $tokens[$opener]['bracket_closer'] = $i; |
|
1726 | + break; |
|
1727 | + case T_CLOSE_SQUARE_BRACKET: |
|
1728 | + if (empty($squareOpeners) === false) { |
|
1729 | + $opener = array_pop($squareOpeners); |
|
1730 | + $tokens[$i]['bracket_opener'] = $opener; |
|
1731 | + $tokens[$i]['bracket_closer'] = $i; |
|
1732 | + $tokens[$opener]['bracket_opener'] = $opener; |
|
1733 | + $tokens[$opener]['bracket_closer'] = $i; |
|
1751 | 1734 | |
1752 | - if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1753 | - echo str_repeat("\t", count($squareOpeners)); |
|
1754 | - echo str_repeat("\t", count($curlyOpeners)); |
|
1755 | - echo "\t=> Found curly bracket closer at $i for $opener".PHP_EOL; |
|
1735 | + if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1736 | + echo str_repeat("\t", count($squareOpeners)); |
|
1737 | + echo str_repeat("\t", count($curlyOpeners)); |
|
1738 | + echo "\t=> Found square bracket closer at $i for $opener".PHP_EOL; |
|
1739 | + } |
|
1756 | 1740 | } |
1757 | - } |
|
1758 | - break; |
|
1759 | - default: |
|
1760 | - continue; |
|
1741 | + break; |
|
1742 | + case T_CLOSE_CURLY_BRACKET: |
|
1743 | + if (empty($curlyOpeners) === false |
|
1744 | + && isset($tokens[$i]['scope_opener']) === false |
|
1745 | + ) { |
|
1746 | + $opener = array_pop($curlyOpeners); |
|
1747 | + $tokens[$i]['bracket_opener'] = $opener; |
|
1748 | + $tokens[$i]['bracket_closer'] = $i; |
|
1749 | + $tokens[$opener]['bracket_opener'] = $opener; |
|
1750 | + $tokens[$opener]['bracket_closer'] = $i; |
|
1751 | + |
|
1752 | + if (PHP_CODESNIFFER_VERBOSITY > 1) { |
|
1753 | + echo str_repeat("\t", count($squareOpeners)); |
|
1754 | + echo str_repeat("\t", count($curlyOpeners)); |
|
1755 | + echo "\t=> Found curly bracket closer at $i for $opener".PHP_EOL; |
|
1756 | + } |
|
1757 | + } |
|
1758 | + break; |
|
1759 | + default: |
|
1760 | + continue; |
|
1761 | 1761 | }//end switch |
1762 | 1762 | }//end for |
1763 | 1763 | |
@@ -2787,88 +2787,88 @@ discard block |
||
2787 | 2787 | } |
2788 | 2788 | |
2789 | 2789 | switch ($this->_tokens[$i]['code']) { |
2790 | - case T_BITWISE_AND: |
|
2791 | - $passByReference = true; |
|
2792 | - break; |
|
2793 | - case T_VARIABLE: |
|
2794 | - $currVar = $i; |
|
2795 | - break; |
|
2796 | - case T_ELLIPSIS: |
|
2797 | - $variableLength = true; |
|
2798 | - break; |
|
2799 | - case T_ARRAY_HINT: |
|
2800 | - case T_CALLABLE: |
|
2801 | - $typeHint = $this->_tokens[$i]['content']; |
|
2802 | - break; |
|
2803 | - case T_STRING: |
|
2804 | - // This is a string, so it may be a type hint, but it could |
|
2805 | - // also be a constant used as a default value. |
|
2806 | - $prevComma = false; |
|
2807 | - for ($t = $i; $t >= $opener; $t--) { |
|
2808 | - if ($this->_tokens[$t]['code'] === T_COMMA) { |
|
2809 | - $prevComma = $t; |
|
2810 | - break; |
|
2790 | + case T_BITWISE_AND: |
|
2791 | + $passByReference = true; |
|
2792 | + break; |
|
2793 | + case T_VARIABLE: |
|
2794 | + $currVar = $i; |
|
2795 | + break; |
|
2796 | + case T_ELLIPSIS: |
|
2797 | + $variableLength = true; |
|
2798 | + break; |
|
2799 | + case T_ARRAY_HINT: |
|
2800 | + case T_CALLABLE: |
|
2801 | + $typeHint = $this->_tokens[$i]['content']; |
|
2802 | + break; |
|
2803 | + case T_STRING: |
|
2804 | + // This is a string, so it may be a type hint, but it could |
|
2805 | + // also be a constant used as a default value. |
|
2806 | + $prevComma = false; |
|
2807 | + for ($t = $i; $t >= $opener; $t--) { |
|
2808 | + if ($this->_tokens[$t]['code'] === T_COMMA) { |
|
2809 | + $prevComma = $t; |
|
2810 | + break; |
|
2811 | + } |
|
2811 | 2812 | } |
2812 | - } |
|
2813 | 2813 | |
2814 | - if ($prevComma !== false) { |
|
2815 | - $nextEquals = false; |
|
2816 | - for ($t = $prevComma; $t < $i; $t++) { |
|
2817 | - if ($this->_tokens[$t]['code'] === T_EQUAL) { |
|
2818 | - $nextEquals = $t; |
|
2814 | + if ($prevComma !== false) { |
|
2815 | + $nextEquals = false; |
|
2816 | + for ($t = $prevComma; $t < $i; $t++) { |
|
2817 | + if ($this->_tokens[$t]['code'] === T_EQUAL) { |
|
2818 | + $nextEquals = $t; |
|
2819 | + break; |
|
2820 | + } |
|
2821 | + } |
|
2822 | + |
|
2823 | + if ($nextEquals !== false) { |
|
2819 | 2824 | break; |
2820 | 2825 | } |
2821 | 2826 | } |
2822 | 2827 | |
2823 | - if ($nextEquals !== false) { |
|
2824 | - break; |
|
2828 | + if ($defaultStart === null) { |
|
2829 | + $typeHint .= $this->_tokens[$i]['content']; |
|
2830 | + } |
|
2831 | + break; |
|
2832 | + case T_NS_SEPARATOR: |
|
2833 | + // Part of a type hint or default value. |
|
2834 | + if ($defaultStart === null) { |
|
2835 | + $typeHint .= $this->_tokens[$i]['content']; |
|
2836 | + } |
|
2837 | + break; |
|
2838 | + case T_CLOSE_PARENTHESIS: |
|
2839 | + case T_COMMA: |
|
2840 | + // If it's null, then there must be no parameters for this |
|
2841 | + // method. |
|
2842 | + if ($currVar === null) { |
|
2843 | + continue; |
|
2825 | 2844 | } |
2826 | - } |
|
2827 | - |
|
2828 | - if ($defaultStart === null) { |
|
2829 | - $typeHint .= $this->_tokens[$i]['content']; |
|
2830 | - } |
|
2831 | - break; |
|
2832 | - case T_NS_SEPARATOR: |
|
2833 | - // Part of a type hint or default value. |
|
2834 | - if ($defaultStart === null) { |
|
2835 | - $typeHint .= $this->_tokens[$i]['content']; |
|
2836 | - } |
|
2837 | - break; |
|
2838 | - case T_CLOSE_PARENTHESIS: |
|
2839 | - case T_COMMA: |
|
2840 | - // If it's null, then there must be no parameters for this |
|
2841 | - // method. |
|
2842 | - if ($currVar === null) { |
|
2843 | - continue; |
|
2844 | - } |
|
2845 | 2845 | |
2846 | - $vars[$paramCount] = array(); |
|
2847 | - $vars[$paramCount]['name'] = $this->_tokens[$currVar]['content']; |
|
2846 | + $vars[$paramCount] = array(); |
|
2847 | + $vars[$paramCount]['name'] = $this->_tokens[$currVar]['content']; |
|
2848 | 2848 | |
2849 | - if ($defaultStart !== null) { |
|
2850 | - $vars[$paramCount]['default'] |
|
2851 | - = $this->getTokensAsString( |
|
2852 | - $defaultStart, |
|
2853 | - ($i - $defaultStart) |
|
2854 | - ); |
|
2855 | - } |
|
2849 | + if ($defaultStart !== null) { |
|
2850 | + $vars[$paramCount]['default'] |
|
2851 | + = $this->getTokensAsString( |
|
2852 | + $defaultStart, |
|
2853 | + ($i - $defaultStart) |
|
2854 | + ); |
|
2855 | + } |
|
2856 | 2856 | |
2857 | - $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
2858 | - $vars[$paramCount]['variable_length'] = $variableLength; |
|
2859 | - $vars[$paramCount]['type_hint'] = $typeHint; |
|
2857 | + $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
2858 | + $vars[$paramCount]['variable_length'] = $variableLength; |
|
2859 | + $vars[$paramCount]['type_hint'] = $typeHint; |
|
2860 | 2860 | |
2861 | - // Reset the vars, as we are about to process the next parameter. |
|
2862 | - $defaultStart = null; |
|
2863 | - $passByReference = false; |
|
2864 | - $variableLength = false; |
|
2865 | - $typeHint = ''; |
|
2861 | + // Reset the vars, as we are about to process the next parameter. |
|
2862 | + $defaultStart = null; |
|
2863 | + $passByReference = false; |
|
2864 | + $variableLength = false; |
|
2865 | + $typeHint = ''; |
|
2866 | 2866 | |
2867 | - $paramCount++; |
|
2868 | - break; |
|
2869 | - case T_EQUAL: |
|
2870 | - $defaultStart = ($i + 1); |
|
2871 | - break; |
|
2867 | + $paramCount++; |
|
2868 | + break; |
|
2869 | + case T_EQUAL: |
|
2870 | + $defaultStart = ($i + 1); |
|
2871 | + break; |
|
2872 | 2872 | }//end switch |
2873 | 2873 | }//end for |
2874 | 2874 | |
@@ -2930,27 +2930,27 @@ discard block |
||
2930 | 2930 | } |
2931 | 2931 | |
2932 | 2932 | switch ($this->_tokens[$i]['code']) { |
2933 | - case T_PUBLIC: |
|
2934 | - $scope = 'public'; |
|
2935 | - $scopeSpecified = true; |
|
2936 | - break; |
|
2937 | - case T_PRIVATE: |
|
2938 | - $scope = 'private'; |
|
2939 | - $scopeSpecified = true; |
|
2940 | - break; |
|
2941 | - case T_PROTECTED: |
|
2942 | - $scope = 'protected'; |
|
2943 | - $scopeSpecified = true; |
|
2944 | - break; |
|
2945 | - case T_ABSTRACT: |
|
2946 | - $isAbstract = true; |
|
2947 | - break; |
|
2948 | - case T_FINAL: |
|
2949 | - $isFinal = true; |
|
2950 | - break; |
|
2951 | - case T_STATIC: |
|
2952 | - $isStatic = true; |
|
2953 | - break; |
|
2933 | + case T_PUBLIC: |
|
2934 | + $scope = 'public'; |
|
2935 | + $scopeSpecified = true; |
|
2936 | + break; |
|
2937 | + case T_PRIVATE: |
|
2938 | + $scope = 'private'; |
|
2939 | + $scopeSpecified = true; |
|
2940 | + break; |
|
2941 | + case T_PROTECTED: |
|
2942 | + $scope = 'protected'; |
|
2943 | + $scopeSpecified = true; |
|
2944 | + break; |
|
2945 | + case T_ABSTRACT: |
|
2946 | + $isAbstract = true; |
|
2947 | + break; |
|
2948 | + case T_FINAL: |
|
2949 | + $isFinal = true; |
|
2950 | + break; |
|
2951 | + case T_STATIC: |
|
2952 | + $isStatic = true; |
|
2953 | + break; |
|
2954 | 2954 | }//end switch |
2955 | 2955 | }//end for |
2956 | 2956 | |
@@ -3040,21 +3040,21 @@ discard block |
||
3040 | 3040 | } |
3041 | 3041 | |
3042 | 3042 | switch ($this->_tokens[$i]['code']) { |
3043 | - case T_PUBLIC: |
|
3044 | - $scope = 'public'; |
|
3045 | - $scopeSpecified = true; |
|
3046 | - break; |
|
3047 | - case T_PRIVATE: |
|
3048 | - $scope = 'private'; |
|
3049 | - $scopeSpecified = true; |
|
3050 | - break; |
|
3051 | - case T_PROTECTED: |
|
3052 | - $scope = 'protected'; |
|
3053 | - $scopeSpecified = true; |
|
3054 | - break; |
|
3055 | - case T_STATIC: |
|
3056 | - $isStatic = true; |
|
3057 | - break; |
|
3043 | + case T_PUBLIC: |
|
3044 | + $scope = 'public'; |
|
3045 | + $scopeSpecified = true; |
|
3046 | + break; |
|
3047 | + case T_PRIVATE: |
|
3048 | + $scope = 'private'; |
|
3049 | + $scopeSpecified = true; |
|
3050 | + break; |
|
3051 | + case T_PROTECTED: |
|
3052 | + $scope = 'protected'; |
|
3053 | + $scopeSpecified = true; |
|
3054 | + break; |
|
3055 | + case T_STATIC: |
|
3056 | + $isStatic = true; |
|
3057 | + break; |
|
3058 | 3058 | } |
3059 | 3059 | }//end for |
3060 | 3060 | |
@@ -3108,13 +3108,13 @@ discard block |
||
3108 | 3108 | } |
3109 | 3109 | |
3110 | 3110 | switch ($this->_tokens[$i]['code']) { |
3111 | - case T_ABSTRACT: |
|
3112 | - $isAbstract = true; |
|
3113 | - break; |
|
3111 | + case T_ABSTRACT: |
|
3112 | + $isAbstract = true; |
|
3113 | + break; |
|
3114 | 3114 | |
3115 | - case T_FINAL: |
|
3116 | - $isFinal = true; |
|
3117 | - break; |
|
3115 | + case T_FINAL: |
|
3116 | + $isFinal = true; |
|
3117 | + break; |
|
3118 | 3118 | } |
3119 | 3119 | }//end for |
3120 | 3120 |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return void |
439 | 439 | */ |
440 | - public function start($contents=null) |
|
440 | + public function start($contents = null) |
|
441 | 441 | { |
442 | 442 | $this->_errors = array(); |
443 | 443 | $this->_warnings = array(); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | * |
645 | 645 | * @return void |
646 | 646 | */ |
647 | - private function _parse($contents=null) |
|
647 | + private function _parse($contents = null) |
|
648 | 648 | { |
649 | 649 | if ($contents === null && empty($this->_tokens) === false) { |
650 | 650 | // File has already been parsed. |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @return string |
748 | 748 | * @throws PHP_CodeSniffer_Exception If $file could not be opened. |
749 | 749 | */ |
750 | - public static function detectLineEndings($file, $contents=null) |
|
750 | + public static function detectLineEndings($file, $contents = null) |
|
751 | 751 | { |
752 | 752 | if ($contents === null) { |
753 | 753 | // Determine the newline character being used in this file. |
@@ -808,10 +808,10 @@ discard block |
||
808 | 808 | public function addError( |
809 | 809 | $error, |
810 | 810 | $stackPtr, |
811 | - $code='', |
|
812 | - $data=array(), |
|
813 | - $severity=0, |
|
814 | - $fixable=false |
|
811 | + $code = '', |
|
812 | + $data = array(), |
|
813 | + $severity = 0, |
|
814 | + $fixable = false |
|
815 | 815 | ) { |
816 | 816 | if ($stackPtr === null) { |
817 | 817 | $line = 1; |
@@ -842,10 +842,10 @@ discard block |
||
842 | 842 | public function addWarning( |
843 | 843 | $warning, |
844 | 844 | $stackPtr, |
845 | - $code='', |
|
846 | - $data=array(), |
|
847 | - $severity=0, |
|
848 | - $fixable=false |
|
845 | + $code = '', |
|
846 | + $data = array(), |
|
847 | + $severity = 0, |
|
848 | + $fixable = false |
|
849 | 849 | ) { |
850 | 850 | if ($stackPtr === null) { |
851 | 851 | $line = 1; |
@@ -875,9 +875,9 @@ discard block |
||
875 | 875 | public function addErrorOnLine( |
876 | 876 | $error, |
877 | 877 | $line, |
878 | - $code='', |
|
879 | - $data=array(), |
|
880 | - $severity=0 |
|
878 | + $code = '', |
|
879 | + $data = array(), |
|
880 | + $severity = 0 |
|
881 | 881 | ) { |
882 | 882 | return $this->_addError($error, $line, 1, $code, $data, $severity, false); |
883 | 883 | |
@@ -899,9 +899,9 @@ discard block |
||
899 | 899 | public function addWarningOnLine( |
900 | 900 | $warning, |
901 | 901 | $line, |
902 | - $code='', |
|
903 | - $data=array(), |
|
904 | - $severity=0 |
|
902 | + $code = '', |
|
903 | + $data = array(), |
|
904 | + $severity = 0 |
|
905 | 905 | ) { |
906 | 906 | return $this->_addWarning($warning, $line, 1, $code, $data, $severity, false); |
907 | 907 | |
@@ -925,9 +925,9 @@ discard block |
||
925 | 925 | public function addFixableError( |
926 | 926 | $error, |
927 | 927 | $stackPtr, |
928 | - $code='', |
|
929 | - $data=array(), |
|
930 | - $severity=0 |
|
928 | + $code = '', |
|
929 | + $data = array(), |
|
930 | + $severity = 0 |
|
931 | 931 | ) { |
932 | 932 | $recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true); |
933 | 933 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -956,9 +956,9 @@ discard block |
||
956 | 956 | public function addFixableWarning( |
957 | 957 | $warning, |
958 | 958 | $stackPtr, |
959 | - $code='', |
|
960 | - $data=array(), |
|
961 | - $severity=0 |
|
959 | + $code = '', |
|
960 | + $data = array(), |
|
961 | + $severity = 0 |
|
962 | 962 | ) { |
963 | 963 | $recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true); |
964 | 964 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | * @throws PHP_CodeSniffer_Exception If the file cannot be processed. |
1418 | 1418 | * @return array |
1419 | 1419 | */ |
1420 | - public static function tokenizeString($string, $tokenizer, $eolChar='\n', $tabWidth=null, $encoding=null) |
|
1420 | + public static function tokenizeString($string, $tokenizer, $eolChar = '\n', $tabWidth = null, $encoding = null) |
|
1421 | 1421 | { |
1422 | 1422 | // Minified files often have a very large number of characters per line |
1423 | 1423 | // and cause issues when tokenizing. |
@@ -1891,8 +1891,8 @@ discard block |
||
1891 | 1891 | $tokenizer, |
1892 | 1892 | $eolChar, |
1893 | 1893 | $stackPtr, |
1894 | - $depth=1, |
|
1895 | - &$ignore=0 |
|
1894 | + $depth = 1, |
|
1895 | + &$ignore = 0 |
|
1896 | 1896 | ) { |
1897 | 1897 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
1898 | 1898 | echo str_repeat("\t", $depth); |
@@ -3276,10 +3276,10 @@ discard block |
||
3276 | 3276 | public function findPrevious( |
3277 | 3277 | $types, |
3278 | 3278 | $start, |
3279 | - $end=null, |
|
3280 | - $exclude=false, |
|
3281 | - $value=null, |
|
3282 | - $local=false |
|
3279 | + $end = null, |
|
3280 | + $exclude = false, |
|
3281 | + $value = null, |
|
3282 | + $local = false |
|
3283 | 3283 | ) { |
3284 | 3284 | $types = (array) $types; |
3285 | 3285 | |
@@ -3357,10 +3357,10 @@ discard block |
||
3357 | 3357 | public function findNext( |
3358 | 3358 | $types, |
3359 | 3359 | $start, |
3360 | - $end=null, |
|
3361 | - $exclude=false, |
|
3362 | - $value=null, |
|
3363 | - $local=false |
|
3360 | + $end = null, |
|
3361 | + $exclude = false, |
|
3362 | + $value = null, |
|
3363 | + $local = false |
|
3364 | 3364 | ) { |
3365 | 3365 | $types = (array) $types; |
3366 | 3366 | |
@@ -3403,7 +3403,7 @@ discard block |
||
3403 | 3403 | * |
3404 | 3404 | * @return int |
3405 | 3405 | */ |
3406 | - public function findStartOfStatement($start, $ignore=null) |
|
3406 | + public function findStartOfStatement($start, $ignore = null) |
|
3407 | 3407 | { |
3408 | 3408 | $endTokens = PHP_CodeSniffer_Tokens::$blockOpeners; |
3409 | 3409 | |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | * |
3469 | 3469 | * @return int |
3470 | 3470 | */ |
3471 | - public function findEndOfStatement($start, $ignore=null) |
|
3471 | + public function findEndOfStatement($start, $ignore = null) |
|
3472 | 3472 | { |
3473 | 3473 | $endTokens = array( |
3474 | 3474 | T_COLON => true, |
@@ -3552,7 +3552,7 @@ discard block |
||
3552 | 3552 | * |
3553 | 3553 | * @return int | bool |
3554 | 3554 | */ |
3555 | - public function findFirstOnLine($types, $start, $exclude=false, $value=null) |
|
3555 | + public function findFirstOnLine($types, $start, $exclude = false, $value = null) |
|
3556 | 3556 | { |
3557 | 3557 | if (is_array($types) === false) { |
3558 | 3558 | $types = array($types); |
@@ -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 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param boolean $showSources Show sources? |
50 | 50 | * @param int $width Maximum allowed line width. |
51 | 51 | * |
52 | - * @return boolean |
|
52 | + * @return null|boolean |
|
53 | 53 | */ |
54 | 54 | public function generateFileReport( |
55 | 55 | $report, |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | public function generateFileReport( |
55 | 55 | $report, |
56 | 56 | PHP_CodeSniffer_File $phpcsFile, |
57 | - $showSources=false, |
|
58 | - $width=80 |
|
57 | + $showSources = false, |
|
58 | + $width = 80 |
|
59 | 59 | ) { |
60 | 60 | $cliValues = $phpcsFile->phpcs->cli->getCommandLineValues(); |
61 | 61 | $errors = $phpcsFile->getFixableCount(); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | $totalErrors, |
139 | 139 | $totalWarnings, |
140 | 140 | $totalFixable, |
141 | - $showSources=false, |
|
142 | - $width=80, |
|
143 | - $toScreen=true |
|
141 | + $showSources = false, |
|
142 | + $width = 80, |
|
143 | + $toScreen = true |
|
144 | 144 | ) { |
145 | 145 | echo $cachedData; |
146 | 146 | echo "Fixed $totalFiles files".PHP_EOL; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | /** |
52 | 52 | * Registers the tokens that this sniff wants to listen for. |
53 | 53 | * |
54 | - * @return int[] |
|
54 | + * @return integer[] |
|
55 | 55 | */ |
56 | 56 | public function register() |
57 | 57 | { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | /** |
44 | 44 | * Registers the tokens that this sniff wants to listen for. |
45 | 45 | * |
46 | - * @return int[] |
|
46 | + * @return integer[] |
|
47 | 47 | */ |
48 | 48 | public function register() |
49 | 49 | { |
@@ -128,7 +128,7 @@ |
||
128 | 128 | T_VARIABLE, |
129 | 129 | T_LNUMBER, |
130 | 130 | T_CONSTANT_ENCAPSED_STRING, |
131 | - ); |
|
131 | + ); |
|
132 | 132 | |
133 | 133 | $parameters = array(''); |
134 | 134 | $parenthesisCount = 1; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * Returns an array of tokens this test wants to listen for. |
42 | 42 | * |
43 | - * @return array |
|
43 | + * @return string[] |
|
44 | 44 | */ |
45 | 45 | public function register() |
46 | 46 | { |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @var array |
33 | 33 | */ |
34 | 34 | public $supportedTokenizers = array( |
35 | - 'PHP', |
|
36 | - 'JS', |
|
37 | - ); |
|
35 | + 'PHP', |
|
36 | + 'JS', |
|
37 | + ); |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $commentEnd = $tokens[$stackPtr]['comment_closer']; |
66 | 66 | |
67 | 67 | $empty = array( |
68 | - T_DOC_COMMENT_WHITESPACE, |
|
69 | - T_DOC_COMMENT_STAR, |
|
70 | - ); |
|
68 | + T_DOC_COMMENT_WHITESPACE, |
|
69 | + T_DOC_COMMENT_STAR, |
|
70 | + ); |
|
71 | 71 | |
72 | 72 | $short = $phpcsFile->findNext($empty, ($stackPtr + 1), $commentEnd, true); |
73 | 73 | if ($short === false) { |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | if ($padding !== $required) { |
311 | 311 | $error = 'Tag value indented incorrectly; expected %s spaces but found %s'; |
312 | 312 | $data = array( |
313 | - $required, |
|
314 | - $padding, |
|
315 | - ); |
|
313 | + $required, |
|
314 | + $padding, |
|
315 | + ); |
|
316 | 316 | |
317 | 317 | $fix = $phpcsFile->addFixableError($error, ($tag + 1), 'TagValueIndent', $data); |
318 | 318 | if ($fix === true) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Returns the token types that this sniff is interested in. |
57 | 57 | * |
58 | - * @return int[] |
|
58 | + * @return integer[] |
|
59 | 59 | */ |
60 | 60 | public function register() |
61 | 61 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param int $stackPtr The position in the stack where |
72 | 72 | * the token was found. |
73 | 73 | * |
74 | - * @return void |
|
74 | + * @return null|integer |
|
75 | 75 | * @throws PHP_CodeSniffer_Exception If jslint.js could not be run |
76 | 76 | */ |
77 | 77 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
@@ -110,7 +110,7 @@ |
||
110 | 110 | $data = array( |
111 | 111 | $code, |
112 | 112 | $error, |
113 | - ); |
|
113 | + ); |
|
114 | 114 | if (in_array($code, $this->errorCodes) === true) { |
115 | 115 | $phpcsFile->addErrorOnLine($message, $line, 'ExternalToolError', $data); |
116 | 116 | } else { |