@@ -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 = ''; |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | * |
| 100 | 100 | * @return void |
| 101 | 101 | */ |
| 102 | -function buildFromNode(&$phar, $node, $prefix='') |
|
| 102 | +function buildFromNode(&$phar, $node, $prefix = '') |
|
| 103 | 103 | { |
| 104 | 104 | $nodeName = $node->nodeName; |
| 105 | 105 | if ($nodeName !== 'dir' && $nodeName !== 'file') { |
@@ -260,7 +260,7 @@ |
||
| 260 | 260 | * |
| 261 | 261 | * @return array |
| 262 | 262 | */ |
| 263 | - public function tokenizeString($string, $eolChar='\n') |
|
| 263 | + public function tokenizeString($string, $eolChar = '\n') |
|
| 264 | 264 | { |
| 265 | 265 | if (PHP_CODESNIFFER_VERBOSITY > 1) { |
| 266 | 266 | echo "\t*** START JS TOKENIZING ***".PHP_EOL; |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * |
| 60 | 60 | * @see generate() |
| 61 | 61 | */ |
| 62 | - public function __construct($standard, array $sniffs=array()) |
|
| 62 | + public function __construct($standard, array $sniffs = array()) |
|
| 63 | 63 | { |
| 64 | 64 | $this->_standard = $standard; |
| 65 | 65 | $this->_sniffs = $sniffs; |
@@ -220,8 +220,8 @@ |
||
| 220 | 220 | $report, |
| 221 | 221 | $showSources, |
| 222 | 222 | array $cliValues, |
| 223 | - $reportFile='', |
|
| 224 | - $reportWidth=80 |
|
| 223 | + $reportFile = '', |
|
| 224 | + $reportWidth = 80 |
|
| 225 | 225 | ) { |
| 226 | 226 | $reportClass = $this->factory($report); |
| 227 | 227 | $report = get_class($reportClass); |
@@ -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 | |
@@ -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); |
@@ -322,7 +322,7 @@ |
||
| 322 | 322 | $expected, |
| 323 | 323 | $found, |
| 324 | 324 | ); |
| 325 | - $fix = $phpcsFile->addFixableError($error, $className, 'InterfaceWrongIndent', $data); |
|
| 325 | + $fix = $phpcsFile->addFixableError($error, $className, 'InterfaceWrongIndent', $data); |
|
| 326 | 326 | if ($fix === true) { |
| 327 | 327 | $padding = str_repeat(' ', $expected); |
| 328 | 328 | if ($found === 0) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->requiredSpacesAfterOpen, |
| 108 | 108 | $spaceAfterOpen, |
| 109 | 109 | ); |
| 110 | - $fix = $phpcsFile->addFixableError($error, ($parenOpener + 1), 'SpacingAfterOpenBrace', $data); |
|
| 110 | + $fix = $phpcsFile->addFixableError($error, ($parenOpener + 1), 'SpacingAfterOpenBrace', $data); |
|
| 111 | 111 | if ($fix === true) { |
| 112 | 112 | $padding = str_repeat(' ', $this->requiredSpacesAfterOpen); |
| 113 | 113 | if ($spaceAfterOpen === 0) { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->requiredSpacesBeforeClose, |
| 135 | 135 | $spaceBeforeClose, |
| 136 | 136 | ); |
| 137 | - $fix = $phpcsFile->addFixableError($error, ($parenCloser - 1), 'SpaceBeforeCloseBrace', $data); |
|
| 137 | + $fix = $phpcsFile->addFixableError($error, ($parenCloser - 1), 'SpaceBeforeCloseBrace', $data); |
|
| 138 | 138 | if ($fix === true) { |
| 139 | 139 | $padding = str_repeat(' ', $this->requiredSpacesBeforeClose); |
| 140 | 140 | if ($spaceBeforeClose === 0) { |