@@ -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 | * |
@@ -780,11 +780,11 @@ discard block |
||
780 | 780 | } |
781 | 781 | |
782 | 782 | $checkCodes = array( |
783 | - $sniffCode, |
|
784 | - $parts[0].'.'.$parts[1].'.'.$parts[2], |
|
785 | - $parts[0].'.'.$parts[1], |
|
786 | - $parts[0], |
|
787 | - ); |
|
783 | + $sniffCode, |
|
784 | + $parts[0].'.'.$parts[1].'.'.$parts[2], |
|
785 | + $parts[0].'.'.$parts[1], |
|
786 | + $parts[0], |
|
787 | + ); |
|
788 | 788 | }//end if |
789 | 789 | |
790 | 790 | // Filter out any messages for sniffs that shouldn't have run |
@@ -860,8 +860,8 @@ discard block |
||
860 | 860 | // While there is support for a type of each pattern |
861 | 861 | // (absolute or relative) we don't actually support it here. |
862 | 862 | $replacements = array( |
863 | - '\\,' => ',', |
|
864 | - '*' => '.*', |
|
863 | + '\\,' => ',', |
|
864 | + '*' => '.*', |
|
865 | 865 | ); |
866 | 866 | |
867 | 867 | // We assume a / directory separator, as do the exclude rules |
@@ -908,12 +908,12 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | $messages[$line][$column][] = array( |
911 | - 'message' => $message, |
|
912 | - 'source' => $sniffCode, |
|
913 | - 'listener' => $this->activeListener, |
|
914 | - 'severity' => $severity, |
|
915 | - 'fixable' => $fixable, |
|
916 | - ); |
|
911 | + 'message' => $message, |
|
912 | + 'source' => $sniffCode, |
|
913 | + 'listener' => $this->activeListener, |
|
914 | + 'severity' => $severity, |
|
915 | + 'fixable' => $fixable, |
|
916 | + ); |
|
917 | 917 | |
918 | 918 | if (PHP_CODESNIFFER_VERBOSITY > 1 |
919 | 919 | && $this->fixer->enabled === true |
@@ -1328,16 +1328,16 @@ discard block |
||
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | $valid = array( |
1331 | - T_PUBLIC => T_PUBLIC, |
|
1332 | - T_PRIVATE => T_PRIVATE, |
|
1333 | - T_PROTECTED => T_PROTECTED, |
|
1334 | - T_STATIC => T_STATIC, |
|
1335 | - T_FINAL => T_FINAL, |
|
1336 | - T_ABSTRACT => T_ABSTRACT, |
|
1337 | - T_WHITESPACE => T_WHITESPACE, |
|
1338 | - T_COMMENT => T_COMMENT, |
|
1339 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
1340 | - ); |
|
1331 | + T_PUBLIC => T_PUBLIC, |
|
1332 | + T_PRIVATE => T_PRIVATE, |
|
1333 | + T_PROTECTED => T_PROTECTED, |
|
1334 | + T_STATIC => T_STATIC, |
|
1335 | + T_FINAL => T_FINAL, |
|
1336 | + T_ABSTRACT => T_ABSTRACT, |
|
1337 | + T_WHITESPACE => T_WHITESPACE, |
|
1338 | + T_COMMENT => T_COMMENT, |
|
1339 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
1340 | + ); |
|
1341 | 1341 | |
1342 | 1342 | $scope = 'public'; |
1343 | 1343 | $scopeSpecified = false; |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | 'is_final' => $isFinal, |
1384 | 1384 | 'is_static' => $isStatic, |
1385 | 1385 | 'is_closure' => $isClosure, |
1386 | - ); |
|
1386 | + ); |
|
1387 | 1387 | |
1388 | 1388 | }//end getMethodProperties() |
1389 | 1389 | |
@@ -1441,16 +1441,16 @@ discard block |
||
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | $valid = array( |
1444 | - T_PUBLIC => T_PUBLIC, |
|
1445 | - T_PRIVATE => T_PRIVATE, |
|
1446 | - T_PROTECTED => T_PROTECTED, |
|
1447 | - T_STATIC => T_STATIC, |
|
1448 | - T_WHITESPACE => T_WHITESPACE, |
|
1449 | - T_COMMENT => T_COMMENT, |
|
1450 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
1451 | - T_VARIABLE => T_VARIABLE, |
|
1452 | - T_COMMA => T_COMMA, |
|
1453 | - ); |
|
1444 | + T_PUBLIC => T_PUBLIC, |
|
1445 | + T_PRIVATE => T_PRIVATE, |
|
1446 | + T_PROTECTED => T_PROTECTED, |
|
1447 | + T_STATIC => T_STATIC, |
|
1448 | + T_WHITESPACE => T_WHITESPACE, |
|
1449 | + T_COMMENT => T_COMMENT, |
|
1450 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
1451 | + T_VARIABLE => T_VARIABLE, |
|
1452 | + T_COMMA => T_COMMA, |
|
1453 | + ); |
|
1454 | 1454 | |
1455 | 1455 | $scope = 'public'; |
1456 | 1456 | $scopeSpecified = false; |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | 'scope' => $scope, |
1485 | 1485 | 'scope_specified' => $scopeSpecified, |
1486 | 1486 | 'is_static' => $isStatic, |
1487 | - ); |
|
1487 | + ); |
|
1488 | 1488 | |
1489 | 1489 | }//end getMemberProperties() |
1490 | 1490 | |
@@ -1514,12 +1514,12 @@ discard block |
||
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | $valid = array( |
1517 | - T_FINAL => T_FINAL, |
|
1518 | - T_ABSTRACT => T_ABSTRACT, |
|
1519 | - T_WHITESPACE => T_WHITESPACE, |
|
1520 | - T_COMMENT => T_COMMENT, |
|
1521 | - T_DOC_COMMENT => T_DOC_COMMENT, |
|
1522 | - ); |
|
1517 | + T_FINAL => T_FINAL, |
|
1518 | + T_ABSTRACT => T_ABSTRACT, |
|
1519 | + T_WHITESPACE => T_WHITESPACE, |
|
1520 | + T_COMMENT => T_COMMENT, |
|
1521 | + T_DOC_COMMENT => T_DOC_COMMENT, |
|
1522 | + ); |
|
1523 | 1523 | |
1524 | 1524 | $isAbstract = false; |
1525 | 1525 | $isFinal = false; |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | return array( |
1544 | 1544 | 'is_abstract' => $isAbstract, |
1545 | 1545 | 'is_final' => $isFinal, |
1546 | - ); |
|
1546 | + ); |
|
1547 | 1547 | |
1548 | 1548 | }//end getClassProperties() |
1549 | 1549 | |
@@ -1893,17 +1893,17 @@ discard block |
||
1893 | 1893 | public function findEndOfStatement($start, $ignore=null) |
1894 | 1894 | { |
1895 | 1895 | $endTokens = array( |
1896 | - T_COLON => true, |
|
1897 | - T_COMMA => true, |
|
1898 | - T_DOUBLE_ARROW => true, |
|
1899 | - T_SEMICOLON => true, |
|
1900 | - T_CLOSE_PARENTHESIS => true, |
|
1901 | - T_CLOSE_SQUARE_BRACKET => true, |
|
1902 | - T_CLOSE_CURLY_BRACKET => true, |
|
1903 | - T_CLOSE_SHORT_ARRAY => true, |
|
1904 | - T_OPEN_TAG => true, |
|
1905 | - T_CLOSE_TAG => true, |
|
1906 | - ); |
|
1896 | + T_COLON => true, |
|
1897 | + T_COMMA => true, |
|
1898 | + T_DOUBLE_ARROW => true, |
|
1899 | + T_SEMICOLON => true, |
|
1900 | + T_CLOSE_PARENTHESIS => true, |
|
1901 | + T_CLOSE_SQUARE_BRACKET => true, |
|
1902 | + T_CLOSE_CURLY_BRACKET => true, |
|
1903 | + T_CLOSE_SHORT_ARRAY => true, |
|
1904 | + T_OPEN_TAG => true, |
|
1905 | + T_CLOSE_TAG => true, |
|
1906 | + ); |
|
1907 | 1907 | |
1908 | 1908 | if ($ignore !== null) { |
1909 | 1909 | $ignore = (array) $ignore; |
@@ -2116,9 +2116,9 @@ discard block |
||
2116 | 2116 | } |
2117 | 2117 | |
2118 | 2118 | $find = array( |
2119 | - T_NS_SEPARATOR, |
|
2120 | - T_STRING, |
|
2121 | - T_WHITESPACE, |
|
2119 | + T_NS_SEPARATOR, |
|
2120 | + T_STRING, |
|
2121 | + T_WHITESPACE, |
|
2122 | 2122 | ); |
2123 | 2123 | |
2124 | 2124 | $end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true); |
@@ -1209,88 +1209,88 @@ discard block |
||
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | switch ($this->tokens[$i]['code']) { |
1212 | - case T_BITWISE_AND: |
|
1213 | - $passByReference = true; |
|
1214 | - break; |
|
1215 | - case T_VARIABLE: |
|
1216 | - $currVar = $i; |
|
1217 | - break; |
|
1218 | - case T_ELLIPSIS: |
|
1219 | - $variableLength = true; |
|
1220 | - break; |
|
1221 | - case T_ARRAY_HINT: |
|
1222 | - case T_CALLABLE: |
|
1223 | - $typeHint = $this->tokens[$i]['content']; |
|
1224 | - break; |
|
1225 | - case T_STRING: |
|
1226 | - // This is a string, so it may be a type hint, but it could |
|
1227 | - // also be a constant used as a default value. |
|
1228 | - $prevComma = false; |
|
1229 | - for ($t = $i; $t >= $opener; $t--) { |
|
1230 | - if ($this->tokens[$t]['code'] === T_COMMA) { |
|
1231 | - $prevComma = $t; |
|
1232 | - break; |
|
1212 | + case T_BITWISE_AND: |
|
1213 | + $passByReference = true; |
|
1214 | + break; |
|
1215 | + case T_VARIABLE: |
|
1216 | + $currVar = $i; |
|
1217 | + break; |
|
1218 | + case T_ELLIPSIS: |
|
1219 | + $variableLength = true; |
|
1220 | + break; |
|
1221 | + case T_ARRAY_HINT: |
|
1222 | + case T_CALLABLE: |
|
1223 | + $typeHint = $this->tokens[$i]['content']; |
|
1224 | + break; |
|
1225 | + case T_STRING: |
|
1226 | + // This is a string, so it may be a type hint, but it could |
|
1227 | + // also be a constant used as a default value. |
|
1228 | + $prevComma = false; |
|
1229 | + for ($t = $i; $t >= $opener; $t--) { |
|
1230 | + if ($this->tokens[$t]['code'] === T_COMMA) { |
|
1231 | + $prevComma = $t; |
|
1232 | + break; |
|
1233 | + } |
|
1233 | 1234 | } |
1234 | - } |
|
1235 | 1235 | |
1236 | - if ($prevComma !== false) { |
|
1237 | - $nextEquals = false; |
|
1238 | - for ($t = $prevComma; $t < $i; $t++) { |
|
1239 | - if ($this->tokens[$t]['code'] === T_EQUAL) { |
|
1240 | - $nextEquals = $t; |
|
1236 | + if ($prevComma !== false) { |
|
1237 | + $nextEquals = false; |
|
1238 | + for ($t = $prevComma; $t < $i; $t++) { |
|
1239 | + if ($this->tokens[$t]['code'] === T_EQUAL) { |
|
1240 | + $nextEquals = $t; |
|
1241 | + break; |
|
1242 | + } |
|
1243 | + } |
|
1244 | + |
|
1245 | + if ($nextEquals !== false) { |
|
1241 | 1246 | break; |
1242 | 1247 | } |
1243 | 1248 | } |
1244 | 1249 | |
1245 | - if ($nextEquals !== false) { |
|
1246 | - break; |
|
1250 | + if ($defaultStart === null) { |
|
1251 | + $typeHint .= $this->tokens[$i]['content']; |
|
1252 | + } |
|
1253 | + break; |
|
1254 | + case T_NS_SEPARATOR: |
|
1255 | + // Part of a type hint or default value. |
|
1256 | + if ($defaultStart === null) { |
|
1257 | + $typeHint .= $this->tokens[$i]['content']; |
|
1258 | + } |
|
1259 | + break; |
|
1260 | + case T_CLOSE_PARENTHESIS: |
|
1261 | + case T_COMMA: |
|
1262 | + // If it's null, then there must be no parameters for this |
|
1263 | + // method. |
|
1264 | + if ($currVar === null) { |
|
1265 | + continue; |
|
1247 | 1266 | } |
1248 | - } |
|
1249 | - |
|
1250 | - if ($defaultStart === null) { |
|
1251 | - $typeHint .= $this->tokens[$i]['content']; |
|
1252 | - } |
|
1253 | - break; |
|
1254 | - case T_NS_SEPARATOR: |
|
1255 | - // Part of a type hint or default value. |
|
1256 | - if ($defaultStart === null) { |
|
1257 | - $typeHint .= $this->tokens[$i]['content']; |
|
1258 | - } |
|
1259 | - break; |
|
1260 | - case T_CLOSE_PARENTHESIS: |
|
1261 | - case T_COMMA: |
|
1262 | - // If it's null, then there must be no parameters for this |
|
1263 | - // method. |
|
1264 | - if ($currVar === null) { |
|
1265 | - continue; |
|
1266 | - } |
|
1267 | 1267 | |
1268 | - $vars[$paramCount] = array(); |
|
1269 | - $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; |
|
1268 | + $vars[$paramCount] = array(); |
|
1269 | + $vars[$paramCount]['name'] = $this->tokens[$currVar]['content']; |
|
1270 | 1270 | |
1271 | - if ($defaultStart !== null) { |
|
1272 | - $vars[$paramCount]['default'] |
|
1273 | - = $this->getTokensAsString( |
|
1274 | - $defaultStart, |
|
1275 | - ($i - $defaultStart) |
|
1276 | - ); |
|
1277 | - } |
|
1271 | + if ($defaultStart !== null) { |
|
1272 | + $vars[$paramCount]['default'] |
|
1273 | + = $this->getTokensAsString( |
|
1274 | + $defaultStart, |
|
1275 | + ($i - $defaultStart) |
|
1276 | + ); |
|
1277 | + } |
|
1278 | 1278 | |
1279 | - $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
1280 | - $vars[$paramCount]['variable_length'] = $variableLength; |
|
1281 | - $vars[$paramCount]['type_hint'] = $typeHint; |
|
1279 | + $vars[$paramCount]['pass_by_reference'] = $passByReference; |
|
1280 | + $vars[$paramCount]['variable_length'] = $variableLength; |
|
1281 | + $vars[$paramCount]['type_hint'] = $typeHint; |
|
1282 | 1282 | |
1283 | - // Reset the vars, as we are about to process the next parameter. |
|
1284 | - $defaultStart = null; |
|
1285 | - $passByReference = false; |
|
1286 | - $variableLength = false; |
|
1287 | - $typeHint = ''; |
|
1283 | + // Reset the vars, as we are about to process the next parameter. |
|
1284 | + $defaultStart = null; |
|
1285 | + $passByReference = false; |
|
1286 | + $variableLength = false; |
|
1287 | + $typeHint = ''; |
|
1288 | 1288 | |
1289 | - $paramCount++; |
|
1290 | - break; |
|
1291 | - case T_EQUAL: |
|
1292 | - $defaultStart = ($i + 1); |
|
1293 | - break; |
|
1289 | + $paramCount++; |
|
1290 | + break; |
|
1291 | + case T_EQUAL: |
|
1292 | + $defaultStart = ($i + 1); |
|
1293 | + break; |
|
1294 | 1294 | }//end switch |
1295 | 1295 | }//end for |
1296 | 1296 | |
@@ -1352,27 +1352,27 @@ discard block |
||
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | switch ($this->tokens[$i]['code']) { |
1355 | - case T_PUBLIC: |
|
1356 | - $scope = 'public'; |
|
1357 | - $scopeSpecified = true; |
|
1358 | - break; |
|
1359 | - case T_PRIVATE: |
|
1360 | - $scope = 'private'; |
|
1361 | - $scopeSpecified = true; |
|
1362 | - break; |
|
1363 | - case T_PROTECTED: |
|
1364 | - $scope = 'protected'; |
|
1365 | - $scopeSpecified = true; |
|
1366 | - break; |
|
1367 | - case T_ABSTRACT: |
|
1368 | - $isAbstract = true; |
|
1369 | - break; |
|
1370 | - case T_FINAL: |
|
1371 | - $isFinal = true; |
|
1372 | - break; |
|
1373 | - case T_STATIC: |
|
1374 | - $isStatic = true; |
|
1375 | - break; |
|
1355 | + case T_PUBLIC: |
|
1356 | + $scope = 'public'; |
|
1357 | + $scopeSpecified = true; |
|
1358 | + break; |
|
1359 | + case T_PRIVATE: |
|
1360 | + $scope = 'private'; |
|
1361 | + $scopeSpecified = true; |
|
1362 | + break; |
|
1363 | + case T_PROTECTED: |
|
1364 | + $scope = 'protected'; |
|
1365 | + $scopeSpecified = true; |
|
1366 | + break; |
|
1367 | + case T_ABSTRACT: |
|
1368 | + $isAbstract = true; |
|
1369 | + break; |
|
1370 | + case T_FINAL: |
|
1371 | + $isFinal = true; |
|
1372 | + break; |
|
1373 | + case T_STATIC: |
|
1374 | + $isStatic = true; |
|
1375 | + break; |
|
1376 | 1376 | }//end switch |
1377 | 1377 | }//end for |
1378 | 1378 | |
@@ -1462,21 +1462,21 @@ discard block |
||
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | switch ($this->tokens[$i]['code']) { |
1465 | - case T_PUBLIC: |
|
1466 | - $scope = 'public'; |
|
1467 | - $scopeSpecified = true; |
|
1468 | - break; |
|
1469 | - case T_PRIVATE: |
|
1470 | - $scope = 'private'; |
|
1471 | - $scopeSpecified = true; |
|
1472 | - break; |
|
1473 | - case T_PROTECTED: |
|
1474 | - $scope = 'protected'; |
|
1475 | - $scopeSpecified = true; |
|
1476 | - break; |
|
1477 | - case T_STATIC: |
|
1478 | - $isStatic = true; |
|
1479 | - break; |
|
1465 | + case T_PUBLIC: |
|
1466 | + $scope = 'public'; |
|
1467 | + $scopeSpecified = true; |
|
1468 | + break; |
|
1469 | + case T_PRIVATE: |
|
1470 | + $scope = 'private'; |
|
1471 | + $scopeSpecified = true; |
|
1472 | + break; |
|
1473 | + case T_PROTECTED: |
|
1474 | + $scope = 'protected'; |
|
1475 | + $scopeSpecified = true; |
|
1476 | + break; |
|
1477 | + case T_STATIC: |
|
1478 | + $isStatic = true; |
|
1479 | + break; |
|
1480 | 1480 | } |
1481 | 1481 | }//end for |
1482 | 1482 | |
@@ -1530,13 +1530,13 @@ discard block |
||
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | switch ($this->tokens[$i]['code']) { |
1533 | - case T_ABSTRACT: |
|
1534 | - $isAbstract = true; |
|
1535 | - break; |
|
1533 | + case T_ABSTRACT: |
|
1534 | + $isAbstract = true; |
|
1535 | + break; |
|
1536 | 1536 | |
1537 | - case T_FINAL: |
|
1538 | - $isFinal = true; |
|
1539 | - break; |
|
1537 | + case T_FINAL: |
|
1538 | + $isFinal = true; |
|
1539 | + break; |
|
1540 | 1540 | } |
1541 | 1541 | }//end for |
1542 | 1542 |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | $error, |
573 | 573 | $stackPtr, |
574 | 574 | $code, |
575 | - $data=array(), |
|
576 | - $severity=0, |
|
577 | - $fixable=false |
|
575 | + $data = array(), |
|
576 | + $severity = 0, |
|
577 | + $fixable = false |
|
578 | 578 | ) { |
579 | 579 | if ($stackPtr === null) { |
580 | 580 | $line = 1; |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | $warning, |
607 | 607 | $stackPtr, |
608 | 608 | $code, |
609 | - $data=array(), |
|
610 | - $severity=0, |
|
611 | - $fixable=false |
|
609 | + $data = array(), |
|
610 | + $severity = 0, |
|
611 | + $fixable = false |
|
612 | 612 | ) { |
613 | 613 | if ($stackPtr === null) { |
614 | 614 | $line = 1; |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | $error, |
640 | 640 | $line, |
641 | 641 | $code, |
642 | - $data=array(), |
|
643 | - $severity=0 |
|
642 | + $data = array(), |
|
643 | + $severity = 0 |
|
644 | 644 | ) { |
645 | 645 | return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false); |
646 | 646 | |
@@ -663,8 +663,8 @@ discard block |
||
663 | 663 | $warning, |
664 | 664 | $line, |
665 | 665 | $code, |
666 | - $data=array(), |
|
667 | - $severity=0 |
|
666 | + $data = array(), |
|
667 | + $severity = 0 |
|
668 | 668 | ) { |
669 | 669 | return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false); |
670 | 670 | |
@@ -689,8 +689,8 @@ discard block |
||
689 | 689 | $error, |
690 | 690 | $stackPtr, |
691 | 691 | $code, |
692 | - $data=array(), |
|
693 | - $severity=0 |
|
692 | + $data = array(), |
|
693 | + $severity = 0 |
|
694 | 694 | ) { |
695 | 695 | $recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true); |
696 | 696 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | $warning, |
721 | 721 | $stackPtr, |
722 | 722 | $code, |
723 | - $data=array(), |
|
724 | - $severity=0 |
|
723 | + $data = array(), |
|
724 | + $severity = 0 |
|
725 | 725 | ) { |
726 | 726 | $recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true); |
727 | 727 | if ($recorded === true && $this->fixer->enabled === true) { |
@@ -1698,10 +1698,10 @@ discard block |
||
1698 | 1698 | public function findPrevious( |
1699 | 1699 | $types, |
1700 | 1700 | $start, |
1701 | - $end=null, |
|
1702 | - $exclude=false, |
|
1703 | - $value=null, |
|
1704 | - $local=false |
|
1701 | + $end = null, |
|
1702 | + $exclude = false, |
|
1703 | + $value = null, |
|
1704 | + $local = false |
|
1705 | 1705 | ) { |
1706 | 1706 | $types = (array) $types; |
1707 | 1707 | |
@@ -1779,10 +1779,10 @@ discard block |
||
1779 | 1779 | public function findNext( |
1780 | 1780 | $types, |
1781 | 1781 | $start, |
1782 | - $end=null, |
|
1783 | - $exclude=false, |
|
1784 | - $value=null, |
|
1785 | - $local=false |
|
1782 | + $end = null, |
|
1783 | + $exclude = false, |
|
1784 | + $value = null, |
|
1785 | + $local = false |
|
1786 | 1786 | ) { |
1787 | 1787 | $types = (array) $types; |
1788 | 1788 | |
@@ -1825,7 +1825,7 @@ discard block |
||
1825 | 1825 | * |
1826 | 1826 | * @return int |
1827 | 1827 | */ |
1828 | - public function findStartOfStatement($start, $ignore=null) |
|
1828 | + public function findStartOfStatement($start, $ignore = null) |
|
1829 | 1829 | { |
1830 | 1830 | $endTokens = Util\Tokens::$blockOpeners; |
1831 | 1831 | |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | * |
1891 | 1891 | * @return int |
1892 | 1892 | */ |
1893 | - public function findEndOfStatement($start, $ignore=null) |
|
1893 | + public function findEndOfStatement($start, $ignore = null) |
|
1894 | 1894 | { |
1895 | 1895 | $endTokens = array( |
1896 | 1896 | T_COLON => true, |
@@ -1974,7 +1974,7 @@ discard block |
||
1974 | 1974 | * |
1975 | 1975 | * @return int | bool |
1976 | 1976 | */ |
1977 | - public function findFirstOnLine($types, $start, $exclude=false, $value=null) |
|
1977 | + public function findFirstOnLine($types, $start, $exclude = false, $value = null) |
|
1978 | 1978 | { |
1979 | 1979 | if (is_array($types) === false) { |
1980 | 1980 | $types = array($types); |
@@ -193,7 +193,7 @@ |
||
193 | 193 | /** |
194 | 194 | * Return the file path of the current file being processed. |
195 | 195 | * |
196 | - * @return void |
|
196 | + * @return string |
|
197 | 197 | */ |
198 | 198 | function key() |
199 | 199 | { |
@@ -106,7 +106,7 @@ |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | - public function addFile($path, $file=null) |
|
109 | + public function addFile($path, $file = null) |
|
110 | 110 | { |
111 | 111 | // No filtering is done for STDIN. |
112 | 112 | if ($path === 'STDIN' |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace PHP_CodeSniffer\Reports; |
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Files\File; |
13 | -use PHP_CodeSniffer\Util; |
|
14 | 13 | |
15 | 14 | class Diff implements Report |
16 | 15 | { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Start recording actions for a changeset. |
358 | 358 | * |
359 | - * @return void |
|
359 | + * @return false|null |
|
360 | 360 | */ |
361 | 361 | public function beginChangeset() |
362 | 362 | { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * Stop recording actions for a changeset, and apply logged changes. |
385 | 385 | * |
386 | - * @return boolean |
|
386 | + * @return false|null |
|
387 | 387 | */ |
388 | 388 | public function endChangeset() |
389 | 389 | { |
@@ -529,9 +529,9 @@ |
||
529 | 529 | |
530 | 530 | if (isset($this->_oldTokenValues[$stackPtr]) === false) { |
531 | 531 | $this->_oldTokenValues[$stackPtr] = array( |
532 | - 'curr' => $content, |
|
533 | - 'prev' => $this->_tokens[$stackPtr], |
|
534 | - 'loop' => $this->loops, |
|
532 | + 'curr' => $content, |
|
533 | + 'prev' => $this->_tokens[$stackPtr], |
|
534 | + 'loop' => $this->loops, |
|
535 | 535 | ); |
536 | 536 | } else { |
537 | 537 | if ($this->_oldTokenValues[$stackPtr]['prev'] === $content |
@@ -283,14 +283,14 @@ |
||
283 | 283 | foreach ($diffLines as $line) { |
284 | 284 | if (isset($line[0]) === true) { |
285 | 285 | switch ($line[0]) { |
286 | - case '-': |
|
287 | - $diff[] = "\033[31m$line\033[0m"; |
|
288 | - break; |
|
289 | - case '+': |
|
290 | - $diff[] = "\033[32m$line\033[0m"; |
|
291 | - break; |
|
292 | - default: |
|
293 | - $diff[] = $line; |
|
286 | + case '-': |
|
287 | + $diff[] = "\033[31m$line\033[0m"; |
|
288 | + break; |
|
289 | + case '+': |
|
290 | + $diff[] = "\033[32m$line\033[0m"; |
|
291 | + break; |
|
292 | + default: |
|
293 | + $diff[] = $line; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string |
239 | 239 | */ |
240 | - public function generateDiff($filePath=null, $colors=true) |
|
240 | + public function generateDiff($filePath = null, $colors = true) |
|
241 | 241 | { |
242 | 242 | if ($filePath === null) { |
243 | 243 | $filePath = $this->_currentFile->getFilename(); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * |
655 | 655 | * @return bool If the change was accepted. |
656 | 656 | */ |
657 | - public function substrToken($stackPtr, $start, $length=null) |
|
657 | + public function substrToken($stackPtr, $start, $length = null) |
|
658 | 658 | { |
659 | 659 | $current = $this->getTokenContent($stackPtr); |
660 | 660 |
@@ -14,7 +14,6 @@ |
||
14 | 14 | |
15 | 15 | use PHP_CodeSniffer\Ruleset; |
16 | 16 | use PHP_CodeSniffer\Autoload; |
17 | -use PHP_CodeSniffer\Util\Common; |
|
18 | 17 | |
19 | 18 | abstract class Generator |
20 | 19 | { |
@@ -27,11 +27,11 @@ |
||
27 | 27 | * its data should be counted in the grand totals. |
28 | 28 | * |
29 | 29 | * @param array $report Prepared report data. |
30 | - * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on. |
|
30 | + * @param File $phpcsFile The file being reported on. |
|
31 | 31 | * @param bool $showSources Show sources? |
32 | 32 | * @param int $width Maximum allowed line width. |
33 | 33 | * |
34 | - * @return bool |
|
34 | + * @return null|boolean |
|
35 | 35 | */ |
36 | 36 | public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
37 | 37 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
|
33 | + public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) |
|
34 | 34 | { |
35 | 35 | if ($report['errors'] === 0 && $report['warnings'] === 0) { |
36 | 36 | // Nothing to print. |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | $totalErrors, |
334 | 334 | $totalWarnings, |
335 | 335 | $totalFixable, |
336 | - $showSources=false, |
|
337 | - $width=80, |
|
338 | - $interactive=false, |
|
339 | - $toScreen=true |
|
336 | + $showSources = false, |
|
337 | + $width = 80, |
|
338 | + $interactive = false, |
|
339 | + $toScreen = true |
|
340 | 340 | ) { |
341 | 341 | if ($cachedData === '') { |
342 | 342 | return; |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace PHP_CodeSniffer\Reports; |
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Files\File; |
13 | -use PHP_CodeSniffer\Util; |
|
14 | 13 | |
15 | 14 | class Diff implements Report |
16 | 15 | { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * its data should be counted in the grand totals. |
25 | 25 | * |
26 | 26 | * @param array $report Prepared report data. |
27 | - * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on. |
|
27 | + * @param File $phpcsFile The file being reported on. |
|
28 | 28 | * @param bool $showSources Show sources? |
29 | 29 | * @param int $width Maximum allowed line width. |
30 | 30 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
|
33 | + public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) |
|
34 | 34 | { |
35 | 35 | if ($report['errors'] === 0 && $report['warnings'] === 0) { |
36 | 36 | // Nothing to print. |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | $totalErrors, |
334 | 334 | $totalWarnings, |
335 | 335 | $totalFixable, |
336 | - $showSources=false, |
|
337 | - $width=80, |
|
338 | - $interactive=false, |
|
339 | - $toScreen=true |
|
336 | + $showSources = false, |
|
337 | + $width = 80, |
|
338 | + $interactive = false, |
|
339 | + $toScreen = true |
|
340 | 340 | ) { |
341 | 341 | if ($cachedData === '') { |
342 | 342 | return; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * its data should be counted in the grand totals. |
25 | 25 | * |
26 | 26 | * @param array $report Prepared report data. |
27 | - * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on. |
|
27 | + * @param File $phpcsFile The file being reported on. |
|
28 | 28 | * @param bool $showSources Show sources? |
29 | 29 | * @param int $width Maximum allowed line width. |
30 | 30 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool |
32 | 32 | */ |
33 | - public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80) |
|
33 | + public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) |
|
34 | 34 | { |
35 | 35 | if ($report['errors'] === 0 && $report['warnings'] === 0) { |
36 | 36 | // Nothing to print. |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | $totalErrors, |
334 | 334 | $totalWarnings, |
335 | 335 | $totalFixable, |
336 | - $showSources=false, |
|
337 | - $width=80, |
|
338 | - $interactive=false, |
|
339 | - $toScreen=true |
|
336 | + $showSources = false, |
|
337 | + $width = 80, |
|
338 | + $interactive = false, |
|
339 | + $toScreen = true |
|
340 | 340 | ) { |
341 | 341 | if ($cachedData === '') { |
342 | 342 | return; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Processes the test. |
179 | 179 | * |
180 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the |
|
180 | + * @param File $phpcsFile The PHP_CodeSniffer file where the |
|
181 | 181 | * token occurred. |
182 | 182 | * @param int $stackPtr The position in the tokens stack |
183 | 183 | * where the listening token type was |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * for checking, which includes are |
248 | 248 | * parsed token representation of the |
249 | 249 | * pattern. |
250 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the |
|
250 | + * @param File $phpcsFile The PHP_CodeSniffer file where the |
|
251 | 251 | * token occurred. |
252 | 252 | * @param int $stackPtr The position in the tokens stack where |
253 | 253 | * the listening token type was found. |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | /** |
747 | 747 | * Processes any tokens registered with registerSupplementary(). |
748 | 748 | * |
749 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
749 | + * @param File $phpcsFile The PHP_CodeSniffer file where to |
|
750 | 750 | * process the skip. |
751 | 751 | * @param int $stackPtr The position in the tokens stack to |
752 | 752 | * process. |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace PHP_CodeSniffer\Sniffs; |
11 | 11 | |
12 | 12 | use PHP_CodeSniffer\Files\File; |
13 | -use PHP_CodeSniffer\Config; |
|
14 | 13 | use PHP_CodeSniffer\Util\Tokens; |
15 | 14 | use PHP_CodeSniffer\Tokenizers\PHP; |
16 | 15 | use PHP_CodeSniffer\Exceptions\RuntimeException; |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $listenTypes[] = $tokenType; |
115 | 115 | |
116 | 116 | $patternArray = array( |
117 | - 'listen_pos' => $pos, |
|
118 | - 'pattern' => $parsedPattern, |
|
119 | - 'pattern_code' => $pattern, |
|
117 | + 'listen_pos' => $pos, |
|
118 | + 'pattern' => $parsedPattern, |
|
119 | + 'pattern_code' => $pattern, |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | if (isset($this->_parsedPatterns[$tokenType]) === false) { |
@@ -763,17 +763,17 @@ discard block |
||
763 | 763 | }//end registerSupplementary() |
764 | 764 | |
765 | 765 | |
766 | - /** |
|
767 | - * Processes any tokens registered with registerSupplementary(). |
|
768 | - * |
|
769 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
770 | - * process the skip. |
|
771 | - * @param int $stackPtr The position in the tokens stack to |
|
772 | - * process. |
|
773 | - * |
|
774 | - * @return void |
|
775 | - * @see registerSupplementary() |
|
776 | - */ |
|
766 | + /** |
|
767 | + * Processes any tokens registered with registerSupplementary(). |
|
768 | + * |
|
769 | + * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where to |
|
770 | + * process the skip. |
|
771 | + * @param int $stackPtr The position in the tokens stack to |
|
772 | + * process. |
|
773 | + * |
|
774 | + * @return void |
|
775 | + * @see registerSupplementary() |
|
776 | + */ |
|
777 | 777 | protected function processSupplementary( |
778 | 778 | PHP_CodeSniffer_File $phpcsFile, |
779 | 779 | $stackPtr |
@@ -948,10 +948,10 @@ discard block |
||
948 | 948 | $patterns = array(); |
949 | 949 | foreach ($tokens as $patternInfo) { |
950 | 950 | $patterns[] = array( |
951 | - 'type' => 'token', |
|
952 | - 'token' => $patternInfo['code'], |
|
953 | - 'value' => $patternInfo['content'], |
|
954 | - ); |
|
951 | + 'type' => 'token', |
|
952 | + 'token' => $patternInfo['code'], |
|
953 | + 'value' => $patternInfo['content'], |
|
954 | + ); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | return $patterns; |
@@ -890,26 +890,26 @@ |
||
890 | 890 | $nestedBraces = 0; |
891 | 891 | for ($start = $from; $start >= 0; $start--) { |
892 | 892 | switch ($pattern[$start]) { |
893 | - case '(': |
|
894 | - if ($nestedParenthesis === 0) { |
|
895 | - $skip['to'] = 'parenthesis_closer'; |
|
896 | - } |
|
893 | + case '(': |
|
894 | + if ($nestedParenthesis === 0) { |
|
895 | + $skip['to'] = 'parenthesis_closer'; |
|
896 | + } |
|
897 | 897 | |
898 | - $nestedParenthesis--; |
|
899 | - break; |
|
900 | - case '{': |
|
901 | - if ($nestedBraces === 0) { |
|
902 | - $skip['to'] = 'scope_closer'; |
|
903 | - } |
|
898 | + $nestedParenthesis--; |
|
899 | + break; |
|
900 | + case '{': |
|
901 | + if ($nestedBraces === 0) { |
|
902 | + $skip['to'] = 'scope_closer'; |
|
903 | + } |
|
904 | 904 | |
905 | - $nestedBraces--; |
|
906 | - break; |
|
907 | - case '}': |
|
908 | - $nestedBraces++; |
|
909 | - break; |
|
910 | - case ')': |
|
911 | - $nestedParenthesis++; |
|
912 | - break; |
|
905 | + $nestedBraces--; |
|
906 | + break; |
|
907 | + case '}': |
|
908 | + $nestedBraces++; |
|
909 | + break; |
|
910 | + case ')': |
|
911 | + $nestedParenthesis++; |
|
912 | + break; |
|
913 | 913 | }//end switch |
914 | 914 | |
915 | 915 | if (isset($skip['to']) === true) { |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * |
79 | 79 | * @param boolean $ignoreComments If true, comments will be ignored. |
80 | 80 | */ |
81 | - public function __construct($ignoreComments=null) |
|
81 | + public function __construct($ignoreComments = null) |
|
82 | 82 | { |
83 | 83 | // This is here for backwards compatibility. |
84 | 84 | if ($ignoreComments !== null) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Processes the token in the specified PHP_CodeSniffer_File. |
71 | 71 | * |
72 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
72 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
73 | 73 | * token was found. |
74 | 74 | * @param int $stackPtr The position where the token was found. |
75 | 75 | * @param array $currScope The current scope opener token. |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Processes the token outside the scope in the file. |
145 | 145 | * |
146 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
146 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
147 | 147 | * token was found. |
148 | 148 | * @param int $stackPtr The position where the token was found. |
149 | 149 | * |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Called to process class member vars. |
173 | 173 | * |
174 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
174 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
175 | 175 | * token was found. |
176 | 176 | * @param int $stackPtr The position where the token was found. |
177 | 177 | * |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * Called to process normal member vars. |
185 | 185 | * |
186 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
186 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
187 | 187 | * token was found. |
188 | 188 | * @param int $stackPtr The position where the token was found. |
189 | 189 | * |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * Note that there may be more than one variable in the string, which will |
199 | 199 | * result only in one call for the string or one call per line for heredocs. |
200 | 200 | * |
201 | - * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this |
|
201 | + * @param File $phpcsFile The PHP_CodeSniffer file where this |
|
202 | 202 | * token was found. |
203 | 203 | * @param int $stackPtr The position where the double quoted |
204 | 204 | * string was found. |
@@ -16,7 +16,6 @@ |
||
16 | 16 | namespace PHP_CodeSniffer\Sniffs; |
17 | 17 | |
18 | 18 | use PHP_CodeSniffer\Files\File; |
19 | -use PHP_CodeSniffer\Exceptions\RuntimeException; |
|
20 | 19 | |
21 | 20 | abstract class AbstractVariableSniff extends AbstractScopeSniff |
22 | 21 | { |
@@ -67,17 +67,17 @@ |
||
67 | 67 | public function __construct() |
68 | 68 | { |
69 | 69 | $scopes = array( |
70 | - T_CLASS, |
|
71 | - T_TRAIT, |
|
72 | - T_INTERFACE, |
|
73 | - ); |
|
70 | + T_CLASS, |
|
71 | + T_TRAIT, |
|
72 | + T_INTERFACE, |
|
73 | + ); |
|
74 | 74 | |
75 | 75 | $listen = array( |
76 | - T_FUNCTION, |
|
77 | - T_VARIABLE, |
|
78 | - T_DOUBLE_QUOTED_STRING, |
|
79 | - T_HEREDOC, |
|
80 | - ); |
|
76 | + T_FUNCTION, |
|
77 | + T_VARIABLE, |
|
78 | + T_DOUBLE_QUOTED_STRING, |
|
79 | + T_HEREDOC, |
|
80 | + ); |
|
81 | 81 | |
82 | 82 | parent::__construct($scopes, $listen, true); |
83 | 83 |