Version Description
- Updated the PHPCompatibility library to latest version.
- Whitelisted TablePress.
Download this release
Release Info
Developer | wpengine |
Plugin | PHP Compatibility Checker |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- readme.txt +8 -3
- src/wpephpcompat.php +2 -1
- vendor/autoload.php +1 -1
- vendor/squizlabs/php_codesniffer/CodeSniffer.conf +0 -4
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/README.md +1 -1
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniff.php +75 -8
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php +136 -7
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php +20 -1
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php +111 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php +60 -9
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/LongArraysSniff.php +45 -3
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewConstVisibilitySniff.php +68 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php +25 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php +34 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewIniDirectivesSniff.php +9 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewKeywordsSniff.php +4 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewMultiCatchSniff.php +73 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewNullableTypesSniff.php +120 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewScalarReturnTypeDeclarationsSniff.php +11 -7
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php +4 -0
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php +14 -10
- vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/RemovedExtensionsSniff.php +5 -0
- vendor/wimg/php-compatibility/README.md +1 -1
- vendor/wimg/php-compatibility/Sniff.php +75 -8
- vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php +136 -7
- vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php +20 -1
- vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php +111 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesSniff.php +60 -9
- vendor/wimg/php-compatibility/Sniffs/PHP/LongArraysSniff.php +45 -3
- vendor/wimg/php-compatibility/Sniffs/PHP/NewConstVisibilitySniff.php +68 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionParametersSniff.php +25 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionsSniff.php +34 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewIniDirectivesSniff.php +9 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewKeywordsSniff.php +4 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewMultiCatchSniff.php +73 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewNullableTypesSniff.php +120 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/NewScalarReturnTypeDeclarationsSniff.php +11 -7
- vendor/wimg/php-compatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php +4 -0
- vendor/wimg/php-compatibility/Sniffs/PHP/PregReplaceEModifierSniff.php +14 -10
- vendor/wimg/php-compatibility/Sniffs/PHP/RemovedExtensionsSniff.php +5 -0
- wpengine-phpcompat.php +1 -1
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross
|
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -114,6 +114,10 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
117 |
= 1.2.2 =
|
118 |
- Whitelisted UpdraftPlus and Max Mega Menu.
|
119 |
|
@@ -165,5 +169,6 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
165 |
|
166 |
== Upgrade Notice ==
|
167 |
|
168 |
-
= 1.2.
|
169 |
-
-
|
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 1.2.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 1.2.3 =
|
118 |
+
- Updated the PHPCompatibility library to latest version.
|
119 |
+
- Whitelisted TablePress.
|
120 |
+
|
121 |
= 1.2.2 =
|
122 |
- Whitelisted UpdraftPlus and Max Mega Menu.
|
123 |
|
169 |
|
170 |
== Upgrade Notice ==
|
171 |
|
172 |
+
= 1.2.3 =
|
173 |
+
- Updated the PHPCompatibility library to latest version.
|
174 |
+
- Whitelisted TablePress.
|
src/wpephpcompat.php
CHANGED
@@ -72,6 +72,7 @@ class WPEPHPCompat {
|
|
72 |
'*/easy-digital-downloads/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#easy-digital-downloads
|
73 |
'*/updraftplus/*' => '7.0',
|
74 |
'*/megamenu/*' => '7.0',
|
|
|
75 |
);
|
76 |
|
77 |
/**
|
@@ -465,7 +466,7 @@ class WPEPHPCompat {
|
|
465 |
* @return boolean Returns true if the request came from the command line.
|
466 |
*/
|
467 |
private function is_command_line() {
|
468 |
-
return defined( 'WP_CLI' ) || defined( 'PHPUNIT_TEST' )
|
469 |
}
|
470 |
|
471 |
/**
|
72 |
'*/easy-digital-downloads/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#easy-digital-downloads
|
73 |
'*/updraftplus/*' => '7.0',
|
74 |
'*/megamenu/*' => '7.0',
|
75 |
+
'*/tablepress/*' => '7.0',
|
76 |
);
|
77 |
|
78 |
/**
|
466 |
* @return boolean Returns true if the request came from the command line.
|
467 |
*/
|
468 |
private function is_command_line() {
|
469 |
+
return defined( 'WP_CLI' ) || defined( 'PHPUNIT_TEST' ) || php_sapi_name() == 'cli';
|
470 |
}
|
471 |
|
472 |
/**
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit2367dae34adf6a8d0e7cfee72a091612::getLoader();
|
vendor/squizlabs/php_codesniffer/CodeSniffer.conf
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$phpCodeSnifferConfig = array (
|
3 |
-
)
|
4 |
-
?>
|
|
|
|
|
|
|
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/README.md
CHANGED
@@ -46,8 +46,8 @@ Installation in Composer project (method 2)
|
|
46 |
"squizlabs/php_codesniffer": "*",
|
47 |
"wimg/php-compatibility": "*",
|
48 |
"simplyadmire/composer-plugins" : "@dev",
|
49 |
-
"prefer-stable" : true
|
50 |
},
|
|
|
51 |
|
52 |
```
|
53 |
* Run `composer update --lock` to install both phpcs and PHPCompatibility coding standard.
|
46 |
"squizlabs/php_codesniffer": "*",
|
47 |
"wimg/php-compatibility": "*",
|
48 |
"simplyadmire/composer-plugins" : "@dev",
|
|
|
49 |
},
|
50 |
+
"prefer-stable" : true
|
51 |
|
52 |
```
|
53 |
* Run `composer update --lock` to install both phpcs and PHPCompatibility coding standard.
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniff.php
CHANGED
@@ -408,6 +408,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
408 |
* @param int $stackPtr The position of the token.
|
409 |
* @param array|int $validScopes Optional. Array of valid scopes
|
410 |
* or int value of a valid scope.
|
|
|
|
|
411 |
*
|
412 |
* @return bool Without the optional $scopeTypes: True if within a scope, false otherwise.
|
413 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
@@ -443,8 +445,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
443 |
}
|
444 |
|
445 |
// Check for required scope types.
|
446 |
-
foreach ($tokens[$stackPtr]['conditions'] as $pointer => $
|
447 |
-
if (in_array($
|
448 |
return true;
|
449 |
}
|
450 |
}
|
@@ -476,6 +478,53 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
476 |
}
|
477 |
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
/**
|
480 |
* Returns the fully qualified class name for a new class instantiation.
|
481 |
*
|
@@ -787,6 +836,9 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
787 |
* 'name' => '$var', // The variable name.
|
788 |
* 'pass_by_reference' => false, // Passed by reference.
|
789 |
* 'type_hint' => string, // Type hint for array or custom type
|
|
|
|
|
|
|
790 |
* )
|
791 |
* </code>
|
792 |
*
|
@@ -794,14 +846,20 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
794 |
* 'default' with the value of the default as a string.
|
795 |
*
|
796 |
* {@internal Duplicate of same method as contained in the `PHP_CodeSniffer_File`
|
797 |
-
* class, but with some improvements which
|
|
|
|
|
|
|
798 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
799 |
* that, this method can be removed and calls to it replaced with
|
800 |
-
* `$phpcsFile->getMethodParameters($stackPtr)` calls.
|
|
|
|
|
801 |
*
|
802 |
* @param PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
803 |
-
* @param int
|
804 |
-
*
|
|
|
805 |
*
|
806 |
* @return array|false
|
807 |
* @throws PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
@@ -831,6 +889,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
831 |
$passByReference = false;
|
832 |
$variableLength = false;
|
833 |
$typeHint = '';
|
|
|
834 |
|
835 |
for ($i = $paramStart; $i <= $closer; $i++) {
|
836 |
// Check to see if this token has a parenthesis or bracket opener. If it does
|
@@ -869,7 +928,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
869 |
case T_PARENT:
|
870 |
case T_STATIC:
|
871 |
// Self is valid, the others invalid, but were probably intended as type hints.
|
872 |
-
if (
|
873 |
$typeHint = $tokens[$i]['content'];
|
874 |
}
|
875 |
break;
|
@@ -908,6 +967,12 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
908 |
$typeHint .= $tokens[$i]['content'];
|
909 |
}
|
910 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
case T_CLOSE_PARENTHESIS:
|
912 |
case T_COMMA:
|
913 |
// If it's null, then there must be no parameters for this
|
@@ -932,7 +997,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
932 |
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
933 |
$vars[$paramCount]['variable_length'] = $variableLength;
|
934 |
$vars[$paramCount]['type_hint'] = $typeHint;
|
935 |
-
$vars[$paramCount]['
|
|
|
936 |
|
937 |
// Reset the vars, as we are about to process the next parameter.
|
938 |
$defaultStart = null;
|
@@ -940,6 +1006,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
940 |
$passByReference = false;
|
941 |
$variableLength = false;
|
942 |
$typeHint = '';
|
|
|
943 |
|
944 |
$paramCount++;
|
945 |
break;
|
408 |
* @param int $stackPtr The position of the token.
|
409 |
* @param array|int $validScopes Optional. Array of valid scopes
|
410 |
* or int value of a valid scope.
|
411 |
+
* Pass the T_.. constant(s) for the
|
412 |
+
* desired scope to this parameter.
|
413 |
*
|
414 |
* @return bool Without the optional $scopeTypes: True if within a scope, false otherwise.
|
415 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
445 |
}
|
446 |
|
447 |
// Check for required scope types.
|
448 |
+
foreach ($tokens[$stackPtr]['conditions'] as $pointer => $tokenCode) {
|
449 |
+
if (in_array($tokenCode, $validScopes, true)) {
|
450 |
return true;
|
451 |
}
|
452 |
}
|
478 |
}
|
479 |
|
480 |
|
481 |
+
/**
|
482 |
+
* Verify whether a token is within a scoped use statement.
|
483 |
+
*
|
484 |
+
* PHPCS cross-version compatibility method.
|
485 |
+
*
|
486 |
+
* In PHPCS 1.x no conditions are set for a scoped use statement.
|
487 |
+
* This method works around that limitation.
|
488 |
+
*
|
489 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
490 |
+
* @param int $stackPtr The position of the token.
|
491 |
+
*
|
492 |
+
* @return bool True if within use scope, false otherwise.
|
493 |
+
*/
|
494 |
+
public function inUseScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
495 |
+
{
|
496 |
+
static $isLowPHPCS, $ignoreTokens;
|
497 |
+
|
498 |
+
if (isset($isLowPHPCS) === false) {
|
499 |
+
$isLowPHPCS = version_compare(PHP_CodeSniffer::VERSION, '2.0', '<');
|
500 |
+
}
|
501 |
+
if (isset($ignoreTokens) === false) {
|
502 |
+
$ignoreTokens = PHP_CodeSniffer_Tokens::$emptyTokens;
|
503 |
+
$ignoreTokens[T_STRING] = T_STRING;
|
504 |
+
$ignoreTokens[T_AS] = T_AS;
|
505 |
+
$ignoreTokens[T_PUBLIC] = T_PUBLIC;
|
506 |
+
$ignoreTokens[T_PROTECTED] = T_PROTECTED;
|
507 |
+
$ignoreTokens[T_PRIVATE] = T_PRIVATE;
|
508 |
+
}
|
509 |
+
|
510 |
+
// PHPCS 2.0.
|
511 |
+
if ($isLowPHPCS === false) {
|
512 |
+
return $this->tokenHasScope($phpcsFile, $stackPtr, T_USE);
|
513 |
+
} else {
|
514 |
+
// PHPCS 1.x.
|
515 |
+
$tokens = $phpcsFile->getTokens();
|
516 |
+
$maybeCurlyOpen = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
|
517 |
+
if ($tokens[$maybeCurlyOpen]['code'] === T_OPEN_CURLY_BRACKET) {
|
518 |
+
$maybeUseStatement = $phpcsFile->findPrevious($ignoreTokens, ($maybeCurlyOpen - 1), null, true);
|
519 |
+
if ($tokens[$maybeUseStatement]['code'] === T_USE) {
|
520 |
+
return true;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
}
|
526 |
+
|
527 |
+
|
528 |
/**
|
529 |
* Returns the fully qualified class name for a new class instantiation.
|
530 |
*
|
836 |
* 'name' => '$var', // The variable name.
|
837 |
* 'pass_by_reference' => false, // Passed by reference.
|
838 |
* 'type_hint' => string, // Type hint for array or custom type
|
839 |
+
* 'nullable_type' => bool, // Whether the type given in the type hint is nullable
|
840 |
+
* 'type_hint' => string, // Type hint for array or custom type
|
841 |
+
* 'raw' => string, // Raw content of the tokens for the parameter
|
842 |
* )
|
843 |
* </code>
|
844 |
*
|
846 |
* 'default' with the value of the default as a string.
|
847 |
*
|
848 |
* {@internal Duplicate of same method as contained in the `PHP_CodeSniffer_File`
|
849 |
+
* class, but with some improvements which will probably be introduced in
|
850 |
+
* PHPCS 2.7.1/2.8. {@see https://github.com/squizlabs/PHP_CodeSniffer/pull/1117}
|
851 |
+
* and {@see https://github.com/squizlabs/PHP_CodeSniffer/pull/1193}
|
852 |
+
*
|
853 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
854 |
* that, this method can be removed and calls to it replaced with
|
855 |
+
* `$phpcsFile->getMethodParameters($stackPtr)` calls.
|
856 |
+
*
|
857 |
+
* Last synced with PHPCS version: PHPCS 2.7.}}
|
858 |
*
|
859 |
* @param PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
860 |
+
* @param int $stackPtr The position in the stack of the
|
861 |
+
* T_FUNCTION token to acquire the
|
862 |
+
* parameters for.
|
863 |
*
|
864 |
* @return array|false
|
865 |
* @throws PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
889 |
$passByReference = false;
|
890 |
$variableLength = false;
|
891 |
$typeHint = '';
|
892 |
+
$nullableType = false;
|
893 |
|
894 |
for ($i = $paramStart; $i <= $closer; $i++) {
|
895 |
// Check to see if this token has a parenthesis or bracket opener. If it does
|
928 |
case T_PARENT:
|
929 |
case T_STATIC:
|
930 |
// Self is valid, the others invalid, but were probably intended as type hints.
|
931 |
+
if ($defaultStart === null) {
|
932 |
$typeHint = $tokens[$i]['content'];
|
933 |
}
|
934 |
break;
|
967 |
$typeHint .= $tokens[$i]['content'];
|
968 |
}
|
969 |
break;
|
970 |
+
case T_INLINE_THEN:
|
971 |
+
if ($defaultStart === null) {
|
972 |
+
$nullableType = true;
|
973 |
+
$typeHint .= $tokens[$i]['content'];
|
974 |
+
}
|
975 |
+
break;
|
976 |
case T_CLOSE_PARENTHESIS:
|
977 |
case T_COMMA:
|
978 |
// If it's null, then there must be no parameters for this
|
997 |
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
998 |
$vars[$paramCount]['variable_length'] = $variableLength;
|
999 |
$vars[$paramCount]['type_hint'] = $typeHint;
|
1000 |
+
$vars[$paramCount]['nullable_type'] = $nullableType;
|
1001 |
+
$vars[$paramCount]['raw'] = $rawContent;
|
1002 |
|
1003 |
// Reset the vars, as we are about to process the next parameter.
|
1004 |
$defaultStart = null;
|
1006 |
$passByReference = false;
|
1007 |
$variableLength = false;
|
1008 |
$typeHint = '';
|
1009 |
+
$nullableType = false;
|
1010 |
|
1011 |
$paramCount++;
|
1012 |
break;
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php
CHANGED
@@ -626,15 +626,144 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
|
|
626 |
'5.4' => true,
|
627 |
'alternative' => null
|
628 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
);
|
630 |
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
protected $forbiddenFunctionNames = array();
|
639 |
|
640 |
/**
|
626 |
'5.4' => true,
|
627 |
'alternative' => null
|
628 |
),
|
629 |
+
|
630 |
+
'mcrypt_create_iv' => array(
|
631 |
+
'7.1' => false,
|
632 |
+
'alternative' => 'OpenSSL'
|
633 |
+
),
|
634 |
+
'mcrypt_decrypt' => array(
|
635 |
+
'7.1' => false,
|
636 |
+
'alternative' => 'OpenSSL'
|
637 |
+
),
|
638 |
+
'mcrypt_enc_get_algorithms_name' => array(
|
639 |
+
'7.1' => false,
|
640 |
+
'alternative' => 'OpenSSL'
|
641 |
+
),
|
642 |
+
'mcrypt_enc_get_block_size' => array(
|
643 |
+
'7.1' => false,
|
644 |
+
'alternative' => 'OpenSSL'
|
645 |
+
),
|
646 |
+
'mcrypt_enc_get_iv_size' => array(
|
647 |
+
'7.1' => false,
|
648 |
+
'alternative' => 'OpenSSL'
|
649 |
+
),
|
650 |
+
'mcrypt_enc_get_key_size' => array(
|
651 |
+
'7.1' => false,
|
652 |
+
'alternative' => 'OpenSSL'
|
653 |
+
),
|
654 |
+
'mcrypt_enc_get_modes_name' => array(
|
655 |
+
'7.1' => false,
|
656 |
+
'alternative' => 'OpenSSL'
|
657 |
+
),
|
658 |
+
'mcrypt_enc_get_supported_key_sizes' => array(
|
659 |
+
'7.1' => false,
|
660 |
+
'alternative' => 'OpenSSL'
|
661 |
+
),
|
662 |
+
'mcrypt_enc_is_block_algorithm_mode' => array(
|
663 |
+
'7.1' => false,
|
664 |
+
'alternative' => 'OpenSSL'
|
665 |
+
),
|
666 |
+
'mcrypt_enc_is_block_algorithm' => array(
|
667 |
+
'7.1' => false,
|
668 |
+
'alternative' => 'OpenSSL'
|
669 |
+
),
|
670 |
+
'mcrypt_enc_is_block_mode' => array(
|
671 |
+
'7.1' => false,
|
672 |
+
'alternative' => 'OpenSSL'
|
673 |
+
),
|
674 |
+
'mcrypt_enc_self_test' => array(
|
675 |
+
'7.1' => false,
|
676 |
+
'alternative' => 'OpenSSL'
|
677 |
+
),
|
678 |
+
'mcrypt_encrypt' => array(
|
679 |
+
'7.1' => false,
|
680 |
+
'alternative' => 'OpenSSL'
|
681 |
+
),
|
682 |
+
'mcrypt_generic_deinit' => array(
|
683 |
+
'7.1' => false,
|
684 |
+
'alternative' => 'OpenSSL'
|
685 |
+
),
|
686 |
+
'mcrypt_generic_init' => array(
|
687 |
+
'7.1' => false,
|
688 |
+
'alternative' => 'OpenSSL'
|
689 |
+
),
|
690 |
+
'mcrypt_generic' => array(
|
691 |
+
'7.1' => false,
|
692 |
+
'alternative' => 'OpenSSL'
|
693 |
+
),
|
694 |
+
'mcrypt_get_block_size' => array(
|
695 |
+
'7.1' => false,
|
696 |
+
'alternative' => 'OpenSSL'
|
697 |
+
),
|
698 |
+
'mcrypt_get_cipher_name' => array(
|
699 |
+
'7.1' => false,
|
700 |
+
'alternative' => 'OpenSSL'
|
701 |
+
),
|
702 |
+
'mcrypt_get_iv_size' => array(
|
703 |
+
'7.1' => false,
|
704 |
+
'alternative' => 'OpenSSL'
|
705 |
+
),
|
706 |
+
'mcrypt_get_key_size' => array(
|
707 |
+
'7.1' => false,
|
708 |
+
'alternative' => 'OpenSSL'
|
709 |
+
),
|
710 |
+
'mcrypt_list_algorithms' => array(
|
711 |
+
'7.1' => false,
|
712 |
+
'alternative' => 'OpenSSL'
|
713 |
+
),
|
714 |
+
'mcrypt_list_modes' => array(
|
715 |
+
'7.1' => false,
|
716 |
+
'alternative' => 'OpenSSL'
|
717 |
+
),
|
718 |
+
'mcrypt_module_close' => array(
|
719 |
+
'7.1' => false,
|
720 |
+
'alternative' => 'OpenSSL'
|
721 |
+
),
|
722 |
+
'mcrypt_module_get_algo_block_size' => array(
|
723 |
+
'7.1' => false,
|
724 |
+
'alternative' => 'OpenSSL'
|
725 |
+
),
|
726 |
+
'mcrypt_module_get_algo_key_size' => array(
|
727 |
+
'7.1' => false,
|
728 |
+
'alternative' => 'OpenSSL'
|
729 |
+
),
|
730 |
+
'mcrypt_module_get_supported_key_sizes' => array(
|
731 |
+
'7.1' => false,
|
732 |
+
'alternative' => 'OpenSSL'
|
733 |
+
),
|
734 |
+
'mcrypt_module_is_block_algorithm_mode' => array(
|
735 |
+
'7.1' => false,
|
736 |
+
'alternative' => 'OpenSSL'
|
737 |
+
),
|
738 |
+
'mcrypt_module_is_block_algorithm' => array(
|
739 |
+
'7.1' => false,
|
740 |
+
'alternative' => 'OpenSSL'
|
741 |
+
),
|
742 |
+
'mcrypt_module_is_block_mode' => array(
|
743 |
+
'7.1' => false,
|
744 |
+
'alternative' => 'OpenSSL'
|
745 |
+
),
|
746 |
+
'mcrypt_module_open' => array(
|
747 |
+
'7.1' => false,
|
748 |
+
'alternative' => 'OpenSSL'
|
749 |
+
),
|
750 |
+
'mcrypt_module_self_test' => array(
|
751 |
+
'7.1' => false,
|
752 |
+
'alternative' => 'OpenSSL'
|
753 |
+
),
|
754 |
+
'mdecrypt_generic' => array(
|
755 |
+
'7.1' => false,
|
756 |
+
'alternative' => 'OpenSSL'
|
757 |
+
),
|
758 |
);
|
759 |
|
760 |
+
/**
|
761 |
+
* List of just the function names.
|
762 |
+
*
|
763 |
+
* Will be set automatically in the register() method.
|
764 |
+
*
|
765 |
+
* @var array
|
766 |
+
*/
|
767 |
protected $forbiddenFunctionNames = array();
|
768 |
|
769 |
/**
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php
CHANGED
@@ -179,7 +179,26 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedIniDirectivesSniff extends PHPCompat
|
|
179 |
),
|
180 |
'xsl.security_prefs' => array(
|
181 |
'7.0' => true
|
182 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
);
|
184 |
|
185 |
/**
|
179 |
),
|
180 |
'xsl.security_prefs' => array(
|
181 |
'7.0' => true
|
182 |
+
),
|
183 |
+
|
184 |
+
'mcrypt.algorithms_dir' => array(
|
185 |
+
'7.1' => false
|
186 |
+
),
|
187 |
+
'mcrypt.modes_dir' => array(
|
188 |
+
'7.1' => false
|
189 |
+
),
|
190 |
+
'session.entropy_file' => array(
|
191 |
+
'7.1' => true
|
192 |
+
),
|
193 |
+
'session.entropy_length' => array(
|
194 |
+
'7.1' => true
|
195 |
+
),
|
196 |
+
'session.hash_function' => array(
|
197 |
+
'7.1' => true
|
198 |
+
),
|
199 |
+
'session.hash_bits_per_character' => array(
|
200 |
+
'7.1' => true
|
201 |
+
),
|
202 |
);
|
203 |
|
204 |
/**
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoop.
|
4 |
+
*
|
5 |
+
* PHP version 7
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoop.
|
14 |
+
*
|
15 |
+
* Forbids use of break or continue statements outside of looping structures.
|
16 |
+
*
|
17 |
+
* PHP version 7
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoopSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Token codes of control structure in which usage of break/continue is valid.
|
28 |
+
*
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
protected $validLoopStructures = array(
|
32 |
+
T_FOR => true,
|
33 |
+
T_FOREACH => true,
|
34 |
+
T_WHILE => true,
|
35 |
+
T_DO => true,
|
36 |
+
T_SWITCH => true,
|
37 |
+
);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Token codes which did not correctly get a condition assigned in older PHPCS versions.
|
41 |
+
*
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected $backCompat = array(
|
45 |
+
T_CASE => true,
|
46 |
+
T_DEFAULT => true,
|
47 |
+
);
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Returns an array of tokens this test wants to listen for.
|
51 |
+
*
|
52 |
+
* @return array
|
53 |
+
*/
|
54 |
+
public function register()
|
55 |
+
{
|
56 |
+
return array(
|
57 |
+
T_BREAK,
|
58 |
+
T_CONTINUE,
|
59 |
+
);
|
60 |
+
|
61 |
+
}//end register()
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Processes this test, when one of its tokens is encountered.
|
65 |
+
*
|
66 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
67 |
+
* @param int $stackPtr The position of the current token in the
|
68 |
+
* stack passed in $tokens.
|
69 |
+
*
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
73 |
+
{
|
74 |
+
$tokens = $phpcsFile->getTokens();
|
75 |
+
$token = $tokens[$stackPtr];
|
76 |
+
|
77 |
+
// Check if the break/continue is within a valid loop structure.
|
78 |
+
if (empty($token['conditions']) === false) {
|
79 |
+
foreach ($token['conditions'] as $tokenCode) {
|
80 |
+
if (isset($this->validLoopStructures[$tokenCode]) === true) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
// Deal with older PHPCS versions.
|
87 |
+
if (isset($token['scope_condition']) === true && isset($this->backCompat[$tokens[$token['scope_condition']]['code']]) === true) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
// If we're still here, no valid loop structure container has been found, so throw an error.
|
93 |
+
$error = "Using '%s' outside of a loop or switch structure is invalid";
|
94 |
+
$isError = false;
|
95 |
+
$data = array(
|
96 |
+
$token['content'],
|
97 |
+
);
|
98 |
+
if ($this->supportsAbove('7.0')) {
|
99 |
+
$isError = true;
|
100 |
+
$error .= ' and will throw a fatal error since PHP 7.0';
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($isError === true) {
|
104 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
105 |
+
} else {
|
106 |
+
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
107 |
+
}
|
108 |
+
|
109 |
+
}//end process()
|
110 |
+
|
111 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php
CHANGED
@@ -112,6 +112,13 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
112 |
'function' => true,
|
113 |
);
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
/**
|
116 |
* targetedTokens
|
117 |
*
|
@@ -137,6 +144,8 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
137 |
*/
|
138 |
public function register()
|
139 |
{
|
|
|
|
|
140 |
$tokens = $this->targetedTokens;
|
141 |
if (defined('T_ANON_CLASS')) {
|
142 |
$tokens[] = constant('T_ANON_CLASS');
|
@@ -158,7 +167,7 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
158 |
$tokens = $phpcsFile->getTokens();
|
159 |
|
160 |
/**
|
161 |
-
* We distinguish between the class, function and namespace names
|
162 |
*/
|
163 |
if ($tokens[$stackPtr]['type'] === 'T_STRING') {
|
164 |
$this->processString($phpcsFile, $stackPtr, $tokens);
|
@@ -185,16 +194,44 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
185 |
return;
|
186 |
}
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
197 |
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
return;
|
199 |
}
|
200 |
|
@@ -236,7 +273,8 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
236 |
// Special case for 5.3 where we want to find usage of traits, but
|
237 |
// trait is not a token.
|
238 |
if ($tokenContentLc === 'trait') {
|
239 |
-
|
|
|
240 |
}
|
241 |
|
242 |
// Look for any define/defined tokens (both T_STRING ones, blame Tokenizer).
|
@@ -263,4 +301,17 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
263 |
}
|
264 |
}//end processString()
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}//end class
|
112 |
'function' => true,
|
113 |
);
|
114 |
|
115 |
+
/**
|
116 |
+
* Whether PHPCS 1.x is used or not.
|
117 |
+
*
|
118 |
+
* @var bool
|
119 |
+
*/
|
120 |
+
protected $isLowPHPCS = false;
|
121 |
+
|
122 |
/**
|
123 |
* targetedTokens
|
124 |
*
|
144 |
*/
|
145 |
public function register()
|
146 |
{
|
147 |
+
$this->isLowPHPCS = version_compare(PHP_CodeSniffer::VERSION, '2.0', '<');
|
148 |
+
|
149 |
$tokens = $this->targetedTokens;
|
150 |
if (defined('T_ANON_CLASS')) {
|
151 |
$tokens[] = constant('T_ANON_CLASS');
|
167 |
$tokens = $phpcsFile->getTokens();
|
168 |
|
169 |
/**
|
170 |
+
* We distinguish between the class, function and namespace names vs the define statements.
|
171 |
*/
|
172 |
if ($tokens[$stackPtr]['type'] === 'T_STRING') {
|
173 |
$this->processString($phpcsFile, $stackPtr, $tokens);
|
194 |
return;
|
195 |
}
|
196 |
|
197 |
+
/*
|
198 |
+
* PHP 5.6 allows for use const and use function, but only if followed by the function/constant name.
|
199 |
+
* - `use function HelloWorld` => move to the next token (HelloWorld) to verify.
|
200 |
+
* - `use const HelloWorld` => move to the next token (HelloWorld) to verify.
|
201 |
+
*/
|
202 |
+
if ($tokens[$stackPtr]['type'] === 'T_USE'
|
203 |
+
&& isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === true
|
204 |
+
&& $this->supportsAbove('5.6')
|
205 |
+
) {
|
206 |
+
$maybeUseNext = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
|
207 |
+
if ($maybeUseNext !== false && $this->isEndOfUseStatement($tokens[$maybeUseNext]) === false) {
|
208 |
+
// Prevent duplicate messages: `const` is T_CONST in PHPCS 1.x and T_STRING in PHPCS 2.x.
|
209 |
+
if ($this->isLowPHPCS === true) {
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
$nextNonEmpty = $maybeUseNext;
|
213 |
+
}
|
214 |
}
|
215 |
|
216 |
+
/*
|
217 |
+
* Deal with visibility modifiers.
|
218 |
+
* - `use HelloWorld { sayHello as protected; }` => valid, bow out.
|
219 |
+
* - `use HelloWorld { sayHello as private myPrivateHello; }` => move to the next token to verify.
|
220 |
+
*/
|
221 |
+
else if ($tokens[$stackPtr]['type'] === 'T_AS'
|
222 |
+
&& in_array($tokens[$nextNonEmpty]['code'], PHP_CodeSniffer_Tokens::$scopeModifiers, true) === true
|
223 |
+
&& $this->inUseScope($phpcsFile, $stackPtr) === true
|
224 |
) {
|
225 |
+
$maybeUseNext = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
|
226 |
+
if ($maybeUseNext === false || $this->isEndOfUseStatement($tokens[$maybeUseNext]) === true) {
|
227 |
+
return;
|
228 |
+
}
|
229 |
+
|
230 |
+
$nextNonEmpty = $maybeUseNext;
|
231 |
+
}
|
232 |
+
|
233 |
+
$nextContentLc = strtolower($tokens[$nextNonEmpty]['content']);
|
234 |
+
if (isset($this->invalidNames[$nextContentLc]) === false) {
|
235 |
return;
|
236 |
}
|
237 |
|
273 |
// Special case for 5.3 where we want to find usage of traits, but
|
274 |
// trait is not a token.
|
275 |
if ($tokenContentLc === 'trait') {
|
276 |
+
$this->processNonString($phpcsFile, $stackPtr, $tokens);
|
277 |
+
return;
|
278 |
}
|
279 |
|
280 |
// Look for any define/defined tokens (both T_STRING ones, blame Tokenizer).
|
301 |
}
|
302 |
}//end processString()
|
303 |
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Check if the current token code is for a token which can be considered
|
307 |
+
* the end of a (partial) use statement.
|
308 |
+
*
|
309 |
+
* @param int $token The current token information.
|
310 |
+
*
|
311 |
+
* @return bool
|
312 |
+
*/
|
313 |
+
protected function isEndOfUseStatement($token)
|
314 |
+
{
|
315 |
+
return in_array($token['code'], array(T_CLOSE_CURLY_BRACKET, T_SEMICOLON, T_COMMA), true);
|
316 |
+
}
|
317 |
}//end class
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/LongArraysSniff.php
CHANGED
@@ -65,9 +65,51 @@ class PHPCompatibility_Sniffs_PHP_LongArraysSniff extends PHPCompatibility_Sniff
|
|
65 |
}
|
66 |
|
67 |
$tokens = $phpcsFile->getTokens();
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
72 |
}
|
73 |
}
|
65 |
}
|
66 |
|
67 |
$tokens = $phpcsFile->getTokens();
|
68 |
+
|
69 |
+
// Check if the variable name is in our blacklist.
|
70 |
+
if (in_array(substr($tokens[$stackPtr]['content'], 1), $this->deprecated, true) === false) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($this->inClassScope($phpcsFile, $stackPtr, false) === true) {
|
75 |
+
/*
|
76 |
+
* Check for class property definitions.
|
77 |
+
*/
|
78 |
+
$properties = array();
|
79 |
+
try {
|
80 |
+
$properties = $phpcsFile->getMemberProperties($stackPtr);
|
81 |
+
} catch ( PHP_CodeSniffer_Exception $e) {
|
82 |
+
// If it's not an expected exception, throw it.
|
83 |
+
if ($e->getMessage() !== '$stackPtr is not a class member var') {
|
84 |
+
throw $e;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if (isset($properties['scope'])) {
|
89 |
+
// Ok, so this was a class property declaration, not our concern.
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
/*
|
94 |
+
* Check for static usage of class properties shadowing the long arrays.
|
95 |
+
*/
|
96 |
+
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
97 |
+
if ($tokens[$prevToken]['code'] === T_DOUBLE_COLON) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// Still here, so throw an error/warning.
|
103 |
+
$error = "The use of long predefined variables has been deprecated in 5.3%s; Found '%s'";
|
104 |
+
$isError = $this->supportsAbove('5.4');
|
105 |
+
$data = array(
|
106 |
+
($isError ? ' and removed in 5.4' : ''),
|
107 |
+
$tokens[$stackPtr]['content']
|
108 |
+
);
|
109 |
+
|
110 |
+
if ($isError === true) {
|
111 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
112 |
+
} else {
|
113 |
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
114 |
}
|
115 |
}
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewConstVisibilitySniff.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewConstVisibility.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewConstVisibility.
|
14 |
+
*
|
15 |
+
* Visibility for class constants is available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewConstVisibilitySniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
return array(T_CONST);
|
33 |
+
|
34 |
+
}//end register()
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Processes this test, when one of its tokens is encountered.
|
38 |
+
*
|
39 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
40 |
+
* @param int $stackPtr The position of the current token
|
41 |
+
* in the stack passed in $tokens.
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
46 |
+
{
|
47 |
+
$tokens = $phpcsFile->getTokens();
|
48 |
+
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
49 |
+
|
50 |
+
if ($prevToken === false) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
// Is the previous token a visibility indicator ?
|
55 |
+
if (in_array($tokens[$prevToken]['code'], PHP_CodeSniffer_Tokens::$scopeModifiers, true) === false) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
if ($this->tokenHasScope($phpcsFile, $stackPtr, array(T_CLASS, T_INTERFACE)) === true && $this->supportsBelow('7.0') === true) {
|
60 |
+
$error = 'Visibility indicators for class constants are not supported in PHP 7.0 or earlier. Found "%s const"';
|
61 |
+
$data = array($tokens[$prevToken]['content']);
|
62 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
}//end process()
|
67 |
+
|
68 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php
CHANGED
@@ -439,6 +439,16 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
|
|
439 |
'5.3.2' => false,
|
440 |
'5.3.3' => true
|
441 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
),
|
443 |
'openssl_encrypt' => array(
|
444 |
4 => array(
|
@@ -446,6 +456,21 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
|
|
446 |
'5.3.2' => false,
|
447 |
'5.3.3' => true
|
448 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
),
|
450 |
'openssl_pkcs7_verify' => array(
|
451 |
5 => array(
|
439 |
'5.3.2' => false,
|
440 |
'5.3.3' => true
|
441 |
),
|
442 |
+
5 => array(
|
443 |
+
'name' => 'tag',
|
444 |
+
'7.0' => false,
|
445 |
+
'7.1' => true
|
446 |
+
),
|
447 |
+
6 => array(
|
448 |
+
'name' => 'aad',
|
449 |
+
'7.0' => false,
|
450 |
+
'7.1' => true
|
451 |
+
),
|
452 |
),
|
453 |
'openssl_encrypt' => array(
|
454 |
4 => array(
|
456 |
'5.3.2' => false,
|
457 |
'5.3.3' => true
|
458 |
),
|
459 |
+
5 => array(
|
460 |
+
'name' => 'tag',
|
461 |
+
'7.0' => false,
|
462 |
+
'7.1' => true
|
463 |
+
),
|
464 |
+
6 => array(
|
465 |
+
'name' => 'aad',
|
466 |
+
'7.0' => false,
|
467 |
+
'7.1' => true
|
468 |
+
),
|
469 |
+
7 => array(
|
470 |
+
'name' => 'tag_length',
|
471 |
+
'7.0' => false,
|
472 |
+
'7.1' => true
|
473 |
+
),
|
474 |
),
|
475 |
'openssl_pkcs7_verify' => array(
|
476 |
5 => array(
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php
CHANGED
@@ -1205,6 +1205,40 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
|
|
1205 |
'5.6' => false,
|
1206 |
'7.0' => true
|
1207 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1208 |
);
|
1209 |
|
1210 |
|
1205 |
'5.6' => false,
|
1206 |
'7.0' => true
|
1207 |
),
|
1208 |
+
|
1209 |
+
'socket_export_stream' => array(
|
1210 |
+
'7.0.6' => false,
|
1211 |
+
'7.0.7' => true
|
1212 |
+
),
|
1213 |
+
|
1214 |
+
'curl_multi_errno' => array(
|
1215 |
+
'7.0' => false,
|
1216 |
+
'7.1' => true
|
1217 |
+
),
|
1218 |
+
'curl_share_errno' => array(
|
1219 |
+
'7.0' => false,
|
1220 |
+
'7.1' => true
|
1221 |
+
),
|
1222 |
+
'curl_share_strerror' => array(
|
1223 |
+
'7.0' => false,
|
1224 |
+
'7.1' => true
|
1225 |
+
),
|
1226 |
+
'is_iterable' => array(
|
1227 |
+
'7.0' => false,
|
1228 |
+
'7.1' => true
|
1229 |
+
),
|
1230 |
+
'pcntl_async_signals' => array(
|
1231 |
+
'7.0' => false,
|
1232 |
+
'7.1' => true
|
1233 |
+
),
|
1234 |
+
'session_create_id' => array(
|
1235 |
+
'7.0' => false,
|
1236 |
+
'7.1' => true
|
1237 |
+
),
|
1238 |
+
'session_gc' => array(
|
1239 |
+
'7.0' => false,
|
1240 |
+
'7.1' => true
|
1241 |
+
),
|
1242 |
);
|
1243 |
|
1244 |
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewIniDirectivesSniff.php
CHANGED
@@ -448,6 +448,15 @@ class PHPCompatibility_Sniffs_PHP_NewIniDirectivesSniff extends PHPCompatibility
|
|
448 |
'5.6' => false,
|
449 |
'7.0' => true,
|
450 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
);
|
452 |
|
453 |
/**
|
448 |
'5.6' => false,
|
449 |
'7.0' => true,
|
450 |
),
|
451 |
+
|
452 |
+
'session.sid_length' => array(
|
453 |
+
'7.0' => false,
|
454 |
+
'7.1' => true,
|
455 |
+
),
|
456 |
+
'session.sid_bits_per_character' => array(
|
457 |
+
'7.0' => false,
|
458 |
+
'7.1' => true,
|
459 |
+
),
|
460 |
);
|
461 |
|
462 |
/**
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewKeywordsSniff.php
CHANGED
@@ -191,6 +191,10 @@ class PHPCompatibility_Sniffs_PHP_NewKeywordsSniff extends PHPCompatibility_Snif
|
|
191 |
$tokenType = $this->translateContentToToken[$content];
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
194 |
$nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
195 |
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
196 |
|
191 |
$tokenType = $this->translateContentToToken[$content];
|
192 |
}
|
193 |
|
194 |
+
if (isset($this->newKeywords[$tokenType]) === false) {
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
|
198 |
$nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
199 |
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
200 |
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewMultiCatchSniff.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewMultiCatch.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewMultiCatch.
|
14 |
+
*
|
15 |
+
* Catching multiple exception types in one statement is available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewMultiCatchSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
return array(T_CATCH);
|
33 |
+
|
34 |
+
}//end register()
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Processes this test, when one of its tokens is encountered.
|
38 |
+
*
|
39 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
40 |
+
* @param int $stackPtr The position of the current token
|
41 |
+
* in the stack passed in $tokens.
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
46 |
+
{
|
47 |
+
if ($this->supportsBelow('7.0') === false) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
$tokens = $phpcsFile->getTokens();
|
52 |
+
$token = $tokens[$stackPtr];
|
53 |
+
|
54 |
+
// Bow out during live coding.
|
55 |
+
if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$hasBitwiseOr = $phpcsFile->findNext(T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']);
|
60 |
+
|
61 |
+
if ($hasBitwiseOr === false) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$phpcsFile->addError(
|
66 |
+
'Catching multiple exceptions within one statement is not supported in PHP 7.0 or earlier.',
|
67 |
+
$hasBitwiseOr,
|
68 |
+
'Found'
|
69 |
+
);
|
70 |
+
|
71 |
+
}//end process()
|
72 |
+
|
73 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewNullableTypesSniff.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewNullableTypes.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewNullableTypes.
|
14 |
+
*
|
15 |
+
* Nullable type hints and return types are available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewNullableTypesSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
$tokens = array(
|
33 |
+
T_FUNCTION,
|
34 |
+
);
|
35 |
+
|
36 |
+
if (version_compare(PHP_CodeSniffer::VERSION, '2.3.4') >= 0) {
|
37 |
+
$tokens[] = T_RETURN_TYPE;
|
38 |
+
}
|
39 |
+
|
40 |
+
return $tokens;
|
41 |
+
|
42 |
+
}//end register()
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Processes this test, when one of its tokens is encountered.
|
47 |
+
*
|
48 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
+
* @param int $stackPtr The position of the current token
|
50 |
+
* in the stack passed in $tokens.
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
55 |
+
{
|
56 |
+
if ($this->supportsBelow('7.0') === false) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$tokens = $phpcsFile->getTokens();
|
61 |
+
$tokenCode = $tokens[$stackPtr]['code'];
|
62 |
+
|
63 |
+
if ($tokenCode === T_FUNCTION) {
|
64 |
+
$this->processFunctionDeclaration($phpcsFile, $stackPtr);
|
65 |
+
} else {
|
66 |
+
$this->processReturnType($phpcsFile, $stackPtr);
|
67 |
+
}
|
68 |
+
}//end process()
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Process this test for function tokens.
|
73 |
+
*
|
74 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
75 |
+
* @param int $stackPtr The position of the current token
|
76 |
+
* in the stack passed in $tokens.
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function processFunctionDeclaration(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
81 |
+
{
|
82 |
+
$params = $this->getMethodParameters($phpcsFile, $stackPtr);
|
83 |
+
|
84 |
+
if (empty($params) === false && is_array($params)) {
|
85 |
+
foreach ($params as $param) {
|
86 |
+
if ($param['nullable_type'] === true) {
|
87 |
+
$phpcsFile->addError(
|
88 |
+
'Nullable type declarations are not supported in PHP 7.0 or earlier. Found: %s',
|
89 |
+
$stackPtr,
|
90 |
+
'typeDeclarationFound',
|
91 |
+
array($param['type_hint'])
|
92 |
+
);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Process this test for return type tokens.
|
101 |
+
*
|
102 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
103 |
+
* @param int $stackPtr The position of the current token
|
104 |
+
* in the stack passed in $tokens.
|
105 |
+
*
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
protected function processReturnType(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
109 |
+
{
|
110 |
+
$tokens = $phpcsFile->getTokens();
|
111 |
+
if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
|
112 |
+
$phpcsFile->addError(
|
113 |
+
'Nullable return types are not supported in PHP 7.0 or earlier.',
|
114 |
+
$stackPtr,
|
115 |
+
'returnTypeFound'
|
116 |
+
);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
}//end class
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewScalarReturnTypeDeclarationsSniff.php
CHANGED
@@ -29,22 +29,23 @@ class PHPCompatibility_Sniffs_PHP_NewScalarReturnTypeDeclarationsSniff extends P
|
|
29 |
'int' => array(
|
30 |
'5.6' => false,
|
31 |
'7.0' => true,
|
32 |
-
'description' => 'int return type'
|
33 |
),
|
34 |
'float' => array(
|
35 |
'5.6' => false,
|
36 |
'7.0' => true,
|
37 |
-
'description' => 'float return type'
|
38 |
),
|
39 |
'bool' => array(
|
40 |
'5.6' => false,
|
41 |
'7.0' => true,
|
42 |
-
'description' => 'bool return type'
|
43 |
),
|
44 |
'string' => array(
|
45 |
'5.6' => false,
|
46 |
'7.0' => true,
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
),
|
49 |
);
|
50 |
|
@@ -106,12 +107,15 @@ class PHPCompatibility_Sniffs_PHP_NewScalarReturnTypeDeclarationsSniff extends P
|
|
106 |
}
|
107 |
}
|
108 |
if (strlen($error) > 0) {
|
109 |
-
$error =
|
|
|
|
|
|
|
110 |
|
111 |
if ($isError === true) {
|
112 |
-
$phpcsFile->addError($error, $stackPtr);
|
113 |
} else {
|
114 |
-
$phpcsFile->addWarning($error, $stackPtr);
|
115 |
}
|
116 |
}
|
117 |
|
29 |
'int' => array(
|
30 |
'5.6' => false,
|
31 |
'7.0' => true,
|
|
|
32 |
),
|
33 |
'float' => array(
|
34 |
'5.6' => false,
|
35 |
'7.0' => true,
|
|
|
36 |
),
|
37 |
'bool' => array(
|
38 |
'5.6' => false,
|
39 |
'7.0' => true,
|
|
|
40 |
),
|
41 |
'string' => array(
|
42 |
'5.6' => false,
|
43 |
'7.0' => true,
|
44 |
+
),
|
45 |
+
|
46 |
+
'void' => array(
|
47 |
+
'7.0' => false,
|
48 |
+
'7.1' => true,
|
49 |
),
|
50 |
);
|
51 |
|
107 |
}
|
108 |
}
|
109 |
if (strlen($error) > 0) {
|
110 |
+
$error = '%s return type is ' . $error;
|
111 |
+
$data = array(
|
112 |
+
$typeName,
|
113 |
+
);
|
114 |
|
115 |
if ($isError === true) {
|
116 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
117 |
} else {
|
118 |
+
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
119 |
}
|
120 |
}
|
121 |
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php
CHANGED
@@ -50,6 +50,10 @@ class PHPCompatibility_Sniffs_PHP_NewScalarTypeDeclarationsSniff extends PHPComp
|
|
50 |
'5.6' => false,
|
51 |
'7.0' => true,
|
52 |
),
|
|
|
|
|
|
|
|
|
53 |
);
|
54 |
|
55 |
|
50 |
'5.6' => false,
|
51 |
'7.0' => true,
|
52 |
),
|
53 |
+
'iterable' => array(
|
54 |
+
'7.0' => false,
|
55 |
+
'7.1' => true,
|
56 |
+
),
|
57 |
);
|
58 |
|
59 |
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php
CHANGED
@@ -84,19 +84,23 @@ class PHPCompatibility_Sniffs_PHP_PregReplaceEModifierSniff extends PHPCompatibi
|
|
84 |
return;
|
85 |
}
|
86 |
|
87 |
-
$stringToken = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $firstParam['start'], $firstParam['end'] + 1);
|
88 |
-
if ($stringToken === false) {
|
89 |
-
// No string token found in the first parameter, so skip it (e.g. if variable passed in).
|
90 |
-
return;
|
91 |
-
}
|
92 |
-
|
93 |
/*
|
94 |
* The first parameter might be build up of a combination of strings,
|
95 |
-
* variables and function calls
|
96 |
-
* and end will still be strings. And as that's all we're concerned with,
|
97 |
-
* just use the raw content of the first parameter for further processing.
|
98 |
*/
|
99 |
-
$regex =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
$regexFirstChar = substr($regex, 0, 1);
|
102 |
if (isset($this->doublesSeparators[$regexFirstChar])) {
|
84 |
return;
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
/*
|
88 |
* The first parameter might be build up of a combination of strings,
|
89 |
+
* variables and function calls. We are only concerned with the strings.
|
|
|
|
|
90 |
*/
|
91 |
+
$regex = '';
|
92 |
+
for ($i = $firstParam['start']; $i <= $firstParam['end']; $i++ ) {
|
93 |
+
if (in_array($tokens[$i]['code'], PHP_CodeSniffer_Tokens::$stringTokens, true) === true) {
|
94 |
+
$regex .= $this->stripQuotes($tokens[$i]['content']);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
// Deal with multi-line regexes which were broken up in several string tokens.
|
98 |
+
$regex = $this->stripQuotes($regex);
|
99 |
+
|
100 |
+
if ($regex === '') {
|
101 |
+
// No string token found in the first parameter, so skip it (e.g. if variable passed in).
|
102 |
+
return;
|
103 |
+
}
|
104 |
|
105 |
$regexFirstChar = substr($regex, 0, 1);
|
106 |
if (isset($this->doublesSeparators[$regexFirstChar])) {
|
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/RemovedExtensionsSniff.php
CHANGED
@@ -189,6 +189,11 @@ class PHPCompatibility_Sniffs_PHP_RemovedExtensionsSniff extends PHPCompatibilit
|
|
189 |
'7.0' => 0,
|
190 |
'alternative' => null
|
191 |
),
|
|
|
|
|
|
|
|
|
|
|
192 |
'mcve' => array(
|
193 |
'5.0' => 1,
|
194 |
'5.1' => 0,
|
189 |
'7.0' => 0,
|
190 |
'alternative' => null
|
191 |
),
|
192 |
+
'mcrypt' => array(
|
193 |
+
'7.0' => 1,
|
194 |
+
'7.1' => -1,
|
195 |
+
'alternative' => 'openssl (preferred) or pecl/mcrypt once available'
|
196 |
+
),
|
197 |
'mcve' => array(
|
198 |
'5.0' => 1,
|
199 |
'5.1' => 0,
|
vendor/wimg/php-compatibility/README.md
CHANGED
@@ -46,8 +46,8 @@ Installation in Composer project (method 2)
|
|
46 |
"squizlabs/php_codesniffer": "*",
|
47 |
"wimg/php-compatibility": "*",
|
48 |
"simplyadmire/composer-plugins" : "@dev",
|
49 |
-
"prefer-stable" : true
|
50 |
},
|
|
|
51 |
|
52 |
```
|
53 |
* Run `composer update --lock` to install both phpcs and PHPCompatibility coding standard.
|
46 |
"squizlabs/php_codesniffer": "*",
|
47 |
"wimg/php-compatibility": "*",
|
48 |
"simplyadmire/composer-plugins" : "@dev",
|
|
|
49 |
},
|
50 |
+
"prefer-stable" : true
|
51 |
|
52 |
```
|
53 |
* Run `composer update --lock` to install both phpcs and PHPCompatibility coding standard.
|
vendor/wimg/php-compatibility/Sniff.php
CHANGED
@@ -408,6 +408,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
408 |
* @param int $stackPtr The position of the token.
|
409 |
* @param array|int $validScopes Optional. Array of valid scopes
|
410 |
* or int value of a valid scope.
|
|
|
|
|
411 |
*
|
412 |
* @return bool Without the optional $scopeTypes: True if within a scope, false otherwise.
|
413 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
@@ -443,8 +445,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
443 |
}
|
444 |
|
445 |
// Check for required scope types.
|
446 |
-
foreach ($tokens[$stackPtr]['conditions'] as $pointer => $
|
447 |
-
if (in_array($
|
448 |
return true;
|
449 |
}
|
450 |
}
|
@@ -476,6 +478,53 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
476 |
}
|
477 |
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
/**
|
480 |
* Returns the fully qualified class name for a new class instantiation.
|
481 |
*
|
@@ -787,6 +836,9 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
787 |
* 'name' => '$var', // The variable name.
|
788 |
* 'pass_by_reference' => false, // Passed by reference.
|
789 |
* 'type_hint' => string, // Type hint for array or custom type
|
|
|
|
|
|
|
790 |
* )
|
791 |
* </code>
|
792 |
*
|
@@ -794,14 +846,20 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
794 |
* 'default' with the value of the default as a string.
|
795 |
*
|
796 |
* {@internal Duplicate of same method as contained in the `PHP_CodeSniffer_File`
|
797 |
-
* class, but with some improvements which
|
|
|
|
|
|
|
798 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
799 |
* that, this method can be removed and calls to it replaced with
|
800 |
-
* `$phpcsFile->getMethodParameters($stackPtr)` calls.
|
|
|
|
|
801 |
*
|
802 |
* @param PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
803 |
-
* @param int
|
804 |
-
*
|
|
|
805 |
*
|
806 |
* @return array|false
|
807 |
* @throws PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
@@ -831,6 +889,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
831 |
$passByReference = false;
|
832 |
$variableLength = false;
|
833 |
$typeHint = '';
|
|
|
834 |
|
835 |
for ($i = $paramStart; $i <= $closer; $i++) {
|
836 |
// Check to see if this token has a parenthesis or bracket opener. If it does
|
@@ -869,7 +928,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
869 |
case T_PARENT:
|
870 |
case T_STATIC:
|
871 |
// Self is valid, the others invalid, but were probably intended as type hints.
|
872 |
-
if (
|
873 |
$typeHint = $tokens[$i]['content'];
|
874 |
}
|
875 |
break;
|
@@ -908,6 +967,12 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
908 |
$typeHint .= $tokens[$i]['content'];
|
909 |
}
|
910 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
case T_CLOSE_PARENTHESIS:
|
912 |
case T_COMMA:
|
913 |
// If it's null, then there must be no parameters for this
|
@@ -932,7 +997,8 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
932 |
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
933 |
$vars[$paramCount]['variable_length'] = $variableLength;
|
934 |
$vars[$paramCount]['type_hint'] = $typeHint;
|
935 |
-
$vars[$paramCount]['
|
|
|
936 |
|
937 |
// Reset the vars, as we are about to process the next parameter.
|
938 |
$defaultStart = null;
|
@@ -940,6 +1006,7 @@ abstract class PHPCompatibility_Sniff implements PHP_CodeSniffer_Sniff
|
|
940 |
$passByReference = false;
|
941 |
$variableLength = false;
|
942 |
$typeHint = '';
|
|
|
943 |
|
944 |
$paramCount++;
|
945 |
break;
|
408 |
* @param int $stackPtr The position of the token.
|
409 |
* @param array|int $validScopes Optional. Array of valid scopes
|
410 |
* or int value of a valid scope.
|
411 |
+
* Pass the T_.. constant(s) for the
|
412 |
+
* desired scope to this parameter.
|
413 |
*
|
414 |
* @return bool Without the optional $scopeTypes: True if within a scope, false otherwise.
|
415 |
* If the $scopeTypes are set: True if *one* of the conditions is a
|
445 |
}
|
446 |
|
447 |
// Check for required scope types.
|
448 |
+
foreach ($tokens[$stackPtr]['conditions'] as $pointer => $tokenCode) {
|
449 |
+
if (in_array($tokenCode, $validScopes, true)) {
|
450 |
return true;
|
451 |
}
|
452 |
}
|
478 |
}
|
479 |
|
480 |
|
481 |
+
/**
|
482 |
+
* Verify whether a token is within a scoped use statement.
|
483 |
+
*
|
484 |
+
* PHPCS cross-version compatibility method.
|
485 |
+
*
|
486 |
+
* In PHPCS 1.x no conditions are set for a scoped use statement.
|
487 |
+
* This method works around that limitation.
|
488 |
+
*
|
489 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
490 |
+
* @param int $stackPtr The position of the token.
|
491 |
+
*
|
492 |
+
* @return bool True if within use scope, false otherwise.
|
493 |
+
*/
|
494 |
+
public function inUseScope(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
495 |
+
{
|
496 |
+
static $isLowPHPCS, $ignoreTokens;
|
497 |
+
|
498 |
+
if (isset($isLowPHPCS) === false) {
|
499 |
+
$isLowPHPCS = version_compare(PHP_CodeSniffer::VERSION, '2.0', '<');
|
500 |
+
}
|
501 |
+
if (isset($ignoreTokens) === false) {
|
502 |
+
$ignoreTokens = PHP_CodeSniffer_Tokens::$emptyTokens;
|
503 |
+
$ignoreTokens[T_STRING] = T_STRING;
|
504 |
+
$ignoreTokens[T_AS] = T_AS;
|
505 |
+
$ignoreTokens[T_PUBLIC] = T_PUBLIC;
|
506 |
+
$ignoreTokens[T_PROTECTED] = T_PROTECTED;
|
507 |
+
$ignoreTokens[T_PRIVATE] = T_PRIVATE;
|
508 |
+
}
|
509 |
+
|
510 |
+
// PHPCS 2.0.
|
511 |
+
if ($isLowPHPCS === false) {
|
512 |
+
return $this->tokenHasScope($phpcsFile, $stackPtr, T_USE);
|
513 |
+
} else {
|
514 |
+
// PHPCS 1.x.
|
515 |
+
$tokens = $phpcsFile->getTokens();
|
516 |
+
$maybeCurlyOpen = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
|
517 |
+
if ($tokens[$maybeCurlyOpen]['code'] === T_OPEN_CURLY_BRACKET) {
|
518 |
+
$maybeUseStatement = $phpcsFile->findPrevious($ignoreTokens, ($maybeCurlyOpen - 1), null, true);
|
519 |
+
if ($tokens[$maybeUseStatement]['code'] === T_USE) {
|
520 |
+
return true;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
}
|
526 |
+
|
527 |
+
|
528 |
/**
|
529 |
* Returns the fully qualified class name for a new class instantiation.
|
530 |
*
|
836 |
* 'name' => '$var', // The variable name.
|
837 |
* 'pass_by_reference' => false, // Passed by reference.
|
838 |
* 'type_hint' => string, // Type hint for array or custom type
|
839 |
+
* 'nullable_type' => bool, // Whether the type given in the type hint is nullable
|
840 |
+
* 'type_hint' => string, // Type hint for array or custom type
|
841 |
+
* 'raw' => string, // Raw content of the tokens for the parameter
|
842 |
* )
|
843 |
* </code>
|
844 |
*
|
846 |
* 'default' with the value of the default as a string.
|
847 |
*
|
848 |
* {@internal Duplicate of same method as contained in the `PHP_CodeSniffer_File`
|
849 |
+
* class, but with some improvements which will probably be introduced in
|
850 |
+
* PHPCS 2.7.1/2.8. {@see https://github.com/squizlabs/PHP_CodeSniffer/pull/1117}
|
851 |
+
* and {@see https://github.com/squizlabs/PHP_CodeSniffer/pull/1193}
|
852 |
+
*
|
853 |
* Once the minimum supported PHPCS version for this sniff library goes beyond
|
854 |
* that, this method can be removed and calls to it replaced with
|
855 |
+
* `$phpcsFile->getMethodParameters($stackPtr)` calls.
|
856 |
+
*
|
857 |
+
* Last synced with PHPCS version: PHPCS 2.7.}}
|
858 |
*
|
859 |
* @param PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
|
860 |
+
* @param int $stackPtr The position in the stack of the
|
861 |
+
* T_FUNCTION token to acquire the
|
862 |
+
* parameters for.
|
863 |
*
|
864 |
* @return array|false
|
865 |
* @throws PHP_CodeSniffer_Exception If the specified $stackPtr is not of
|
889 |
$passByReference = false;
|
890 |
$variableLength = false;
|
891 |
$typeHint = '';
|
892 |
+
$nullableType = false;
|
893 |
|
894 |
for ($i = $paramStart; $i <= $closer; $i++) {
|
895 |
// Check to see if this token has a parenthesis or bracket opener. If it does
|
928 |
case T_PARENT:
|
929 |
case T_STATIC:
|
930 |
// Self is valid, the others invalid, but were probably intended as type hints.
|
931 |
+
if ($defaultStart === null) {
|
932 |
$typeHint = $tokens[$i]['content'];
|
933 |
}
|
934 |
break;
|
967 |
$typeHint .= $tokens[$i]['content'];
|
968 |
}
|
969 |
break;
|
970 |
+
case T_INLINE_THEN:
|
971 |
+
if ($defaultStart === null) {
|
972 |
+
$nullableType = true;
|
973 |
+
$typeHint .= $tokens[$i]['content'];
|
974 |
+
}
|
975 |
+
break;
|
976 |
case T_CLOSE_PARENTHESIS:
|
977 |
case T_COMMA:
|
978 |
// If it's null, then there must be no parameters for this
|
997 |
$vars[$paramCount]['pass_by_reference'] = $passByReference;
|
998 |
$vars[$paramCount]['variable_length'] = $variableLength;
|
999 |
$vars[$paramCount]['type_hint'] = $typeHint;
|
1000 |
+
$vars[$paramCount]['nullable_type'] = $nullableType;
|
1001 |
+
$vars[$paramCount]['raw'] = $rawContent;
|
1002 |
|
1003 |
// Reset the vars, as we are about to process the next parameter.
|
1004 |
$defaultStart = null;
|
1006 |
$passByReference = false;
|
1007 |
$variableLength = false;
|
1008 |
$typeHint = '';
|
1009 |
+
$nullableType = false;
|
1010 |
|
1011 |
$paramCount++;
|
1012 |
break;
|
vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php
CHANGED
@@ -626,15 +626,144 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
|
|
626 |
'5.4' => true,
|
627 |
'alternative' => null
|
628 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
);
|
630 |
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
protected $forbiddenFunctionNames = array();
|
639 |
|
640 |
/**
|
626 |
'5.4' => true,
|
627 |
'alternative' => null
|
628 |
),
|
629 |
+
|
630 |
+
'mcrypt_create_iv' => array(
|
631 |
+
'7.1' => false,
|
632 |
+
'alternative' => 'OpenSSL'
|
633 |
+
),
|
634 |
+
'mcrypt_decrypt' => array(
|
635 |
+
'7.1' => false,
|
636 |
+
'alternative' => 'OpenSSL'
|
637 |
+
),
|
638 |
+
'mcrypt_enc_get_algorithms_name' => array(
|
639 |
+
'7.1' => false,
|
640 |
+
'alternative' => 'OpenSSL'
|
641 |
+
),
|
642 |
+
'mcrypt_enc_get_block_size' => array(
|
643 |
+
'7.1' => false,
|
644 |
+
'alternative' => 'OpenSSL'
|
645 |
+
),
|
646 |
+
'mcrypt_enc_get_iv_size' => array(
|
647 |
+
'7.1' => false,
|
648 |
+
'alternative' => 'OpenSSL'
|
649 |
+
),
|
650 |
+
'mcrypt_enc_get_key_size' => array(
|
651 |
+
'7.1' => false,
|
652 |
+
'alternative' => 'OpenSSL'
|
653 |
+
),
|
654 |
+
'mcrypt_enc_get_modes_name' => array(
|
655 |
+
'7.1' => false,
|
656 |
+
'alternative' => 'OpenSSL'
|
657 |
+
),
|
658 |
+
'mcrypt_enc_get_supported_key_sizes' => array(
|
659 |
+
'7.1' => false,
|
660 |
+
'alternative' => 'OpenSSL'
|
661 |
+
),
|
662 |
+
'mcrypt_enc_is_block_algorithm_mode' => array(
|
663 |
+
'7.1' => false,
|
664 |
+
'alternative' => 'OpenSSL'
|
665 |
+
),
|
666 |
+
'mcrypt_enc_is_block_algorithm' => array(
|
667 |
+
'7.1' => false,
|
668 |
+
'alternative' => 'OpenSSL'
|
669 |
+
),
|
670 |
+
'mcrypt_enc_is_block_mode' => array(
|
671 |
+
'7.1' => false,
|
672 |
+
'alternative' => 'OpenSSL'
|
673 |
+
),
|
674 |
+
'mcrypt_enc_self_test' => array(
|
675 |
+
'7.1' => false,
|
676 |
+
'alternative' => 'OpenSSL'
|
677 |
+
),
|
678 |
+
'mcrypt_encrypt' => array(
|
679 |
+
'7.1' => false,
|
680 |
+
'alternative' => 'OpenSSL'
|
681 |
+
),
|
682 |
+
'mcrypt_generic_deinit' => array(
|
683 |
+
'7.1' => false,
|
684 |
+
'alternative' => 'OpenSSL'
|
685 |
+
),
|
686 |
+
'mcrypt_generic_init' => array(
|
687 |
+
'7.1' => false,
|
688 |
+
'alternative' => 'OpenSSL'
|
689 |
+
),
|
690 |
+
'mcrypt_generic' => array(
|
691 |
+
'7.1' => false,
|
692 |
+
'alternative' => 'OpenSSL'
|
693 |
+
),
|
694 |
+
'mcrypt_get_block_size' => array(
|
695 |
+
'7.1' => false,
|
696 |
+
'alternative' => 'OpenSSL'
|
697 |
+
),
|
698 |
+
'mcrypt_get_cipher_name' => array(
|
699 |
+
'7.1' => false,
|
700 |
+
'alternative' => 'OpenSSL'
|
701 |
+
),
|
702 |
+
'mcrypt_get_iv_size' => array(
|
703 |
+
'7.1' => false,
|
704 |
+
'alternative' => 'OpenSSL'
|
705 |
+
),
|
706 |
+
'mcrypt_get_key_size' => array(
|
707 |
+
'7.1' => false,
|
708 |
+
'alternative' => 'OpenSSL'
|
709 |
+
),
|
710 |
+
'mcrypt_list_algorithms' => array(
|
711 |
+
'7.1' => false,
|
712 |
+
'alternative' => 'OpenSSL'
|
713 |
+
),
|
714 |
+
'mcrypt_list_modes' => array(
|
715 |
+
'7.1' => false,
|
716 |
+
'alternative' => 'OpenSSL'
|
717 |
+
),
|
718 |
+
'mcrypt_module_close' => array(
|
719 |
+
'7.1' => false,
|
720 |
+
'alternative' => 'OpenSSL'
|
721 |
+
),
|
722 |
+
'mcrypt_module_get_algo_block_size' => array(
|
723 |
+
'7.1' => false,
|
724 |
+
'alternative' => 'OpenSSL'
|
725 |
+
),
|
726 |
+
'mcrypt_module_get_algo_key_size' => array(
|
727 |
+
'7.1' => false,
|
728 |
+
'alternative' => 'OpenSSL'
|
729 |
+
),
|
730 |
+
'mcrypt_module_get_supported_key_sizes' => array(
|
731 |
+
'7.1' => false,
|
732 |
+
'alternative' => 'OpenSSL'
|
733 |
+
),
|
734 |
+
'mcrypt_module_is_block_algorithm_mode' => array(
|
735 |
+
'7.1' => false,
|
736 |
+
'alternative' => 'OpenSSL'
|
737 |
+
),
|
738 |
+
'mcrypt_module_is_block_algorithm' => array(
|
739 |
+
'7.1' => false,
|
740 |
+
'alternative' => 'OpenSSL'
|
741 |
+
),
|
742 |
+
'mcrypt_module_is_block_mode' => array(
|
743 |
+
'7.1' => false,
|
744 |
+
'alternative' => 'OpenSSL'
|
745 |
+
),
|
746 |
+
'mcrypt_module_open' => array(
|
747 |
+
'7.1' => false,
|
748 |
+
'alternative' => 'OpenSSL'
|
749 |
+
),
|
750 |
+
'mcrypt_module_self_test' => array(
|
751 |
+
'7.1' => false,
|
752 |
+
'alternative' => 'OpenSSL'
|
753 |
+
),
|
754 |
+
'mdecrypt_generic' => array(
|
755 |
+
'7.1' => false,
|
756 |
+
'alternative' => 'OpenSSL'
|
757 |
+
),
|
758 |
);
|
759 |
|
760 |
+
/**
|
761 |
+
* List of just the function names.
|
762 |
+
*
|
763 |
+
* Will be set automatically in the register() method.
|
764 |
+
*
|
765 |
+
* @var array
|
766 |
+
*/
|
767 |
protected $forbiddenFunctionNames = array();
|
768 |
|
769 |
/**
|
vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php
CHANGED
@@ -179,7 +179,26 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedIniDirectivesSniff extends PHPCompat
|
|
179 |
),
|
180 |
'xsl.security_prefs' => array(
|
181 |
'7.0' => true
|
182 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
);
|
184 |
|
185 |
/**
|
179 |
),
|
180 |
'xsl.security_prefs' => array(
|
181 |
'7.0' => true
|
182 |
+
),
|
183 |
+
|
184 |
+
'mcrypt.algorithms_dir' => array(
|
185 |
+
'7.1' => false
|
186 |
+
),
|
187 |
+
'mcrypt.modes_dir' => array(
|
188 |
+
'7.1' => false
|
189 |
+
),
|
190 |
+
'session.entropy_file' => array(
|
191 |
+
'7.1' => true
|
192 |
+
),
|
193 |
+
'session.entropy_length' => array(
|
194 |
+
'7.1' => true
|
195 |
+
),
|
196 |
+
'session.hash_function' => array(
|
197 |
+
'7.1' => true
|
198 |
+
),
|
199 |
+
'session.hash_bits_per_character' => array(
|
200 |
+
'7.1' => true
|
201 |
+
),
|
202 |
);
|
203 |
|
204 |
/**
|
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoop.
|
4 |
+
*
|
5 |
+
* PHP version 7
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoop.
|
14 |
+
*
|
15 |
+
* Forbids use of break or continue statements outside of looping structures.
|
16 |
+
*
|
17 |
+
* PHP version 7
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_ForbiddenBreakContinueOutsideLoopSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Token codes of control structure in which usage of break/continue is valid.
|
28 |
+
*
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
protected $validLoopStructures = array(
|
32 |
+
T_FOR => true,
|
33 |
+
T_FOREACH => true,
|
34 |
+
T_WHILE => true,
|
35 |
+
T_DO => true,
|
36 |
+
T_SWITCH => true,
|
37 |
+
);
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Token codes which did not correctly get a condition assigned in older PHPCS versions.
|
41 |
+
*
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
protected $backCompat = array(
|
45 |
+
T_CASE => true,
|
46 |
+
T_DEFAULT => true,
|
47 |
+
);
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Returns an array of tokens this test wants to listen for.
|
51 |
+
*
|
52 |
+
* @return array
|
53 |
+
*/
|
54 |
+
public function register()
|
55 |
+
{
|
56 |
+
return array(
|
57 |
+
T_BREAK,
|
58 |
+
T_CONTINUE,
|
59 |
+
);
|
60 |
+
|
61 |
+
}//end register()
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Processes this test, when one of its tokens is encountered.
|
65 |
+
*
|
66 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
67 |
+
* @param int $stackPtr The position of the current token in the
|
68 |
+
* stack passed in $tokens.
|
69 |
+
*
|
70 |
+
* @return void
|
71 |
+
*/
|
72 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
73 |
+
{
|
74 |
+
$tokens = $phpcsFile->getTokens();
|
75 |
+
$token = $tokens[$stackPtr];
|
76 |
+
|
77 |
+
// Check if the break/continue is within a valid loop structure.
|
78 |
+
if (empty($token['conditions']) === false) {
|
79 |
+
foreach ($token['conditions'] as $tokenCode) {
|
80 |
+
if (isset($this->validLoopStructures[$tokenCode]) === true) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
// Deal with older PHPCS versions.
|
87 |
+
if (isset($token['scope_condition']) === true && isset($this->backCompat[$tokens[$token['scope_condition']]['code']]) === true) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
// If we're still here, no valid loop structure container has been found, so throw an error.
|
93 |
+
$error = "Using '%s' outside of a loop or switch structure is invalid";
|
94 |
+
$isError = false;
|
95 |
+
$data = array(
|
96 |
+
$token['content'],
|
97 |
+
);
|
98 |
+
if ($this->supportsAbove('7.0')) {
|
99 |
+
$isError = true;
|
100 |
+
$error .= ' and will throw a fatal error since PHP 7.0';
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($isError === true) {
|
104 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
105 |
+
} else {
|
106 |
+
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
107 |
+
}
|
108 |
+
|
109 |
+
}//end process()
|
110 |
+
|
111 |
+
}//end class
|
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesSniff.php
CHANGED
@@ -112,6 +112,13 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
112 |
'function' => true,
|
113 |
);
|
114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
/**
|
116 |
* targetedTokens
|
117 |
*
|
@@ -137,6 +144,8 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
137 |
*/
|
138 |
public function register()
|
139 |
{
|
|
|
|
|
140 |
$tokens = $this->targetedTokens;
|
141 |
if (defined('T_ANON_CLASS')) {
|
142 |
$tokens[] = constant('T_ANON_CLASS');
|
@@ -158,7 +167,7 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
158 |
$tokens = $phpcsFile->getTokens();
|
159 |
|
160 |
/**
|
161 |
-
* We distinguish between the class, function and namespace names
|
162 |
*/
|
163 |
if ($tokens[$stackPtr]['type'] === 'T_STRING') {
|
164 |
$this->processString($phpcsFile, $stackPtr, $tokens);
|
@@ -185,16 +194,44 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
185 |
return;
|
186 |
}
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
197 |
) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
return;
|
199 |
}
|
200 |
|
@@ -236,7 +273,8 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
236 |
// Special case for 5.3 where we want to find usage of traits, but
|
237 |
// trait is not a token.
|
238 |
if ($tokenContentLc === 'trait') {
|
239 |
-
|
|
|
240 |
}
|
241 |
|
242 |
// Look for any define/defined tokens (both T_STRING ones, blame Tokenizer).
|
@@ -263,4 +301,17 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
|
|
263 |
}
|
264 |
}//end processString()
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}//end class
|
112 |
'function' => true,
|
113 |
);
|
114 |
|
115 |
+
/**
|
116 |
+
* Whether PHPCS 1.x is used or not.
|
117 |
+
*
|
118 |
+
* @var bool
|
119 |
+
*/
|
120 |
+
protected $isLowPHPCS = false;
|
121 |
+
|
122 |
/**
|
123 |
* targetedTokens
|
124 |
*
|
144 |
*/
|
145 |
public function register()
|
146 |
{
|
147 |
+
$this->isLowPHPCS = version_compare(PHP_CodeSniffer::VERSION, '2.0', '<');
|
148 |
+
|
149 |
$tokens = $this->targetedTokens;
|
150 |
if (defined('T_ANON_CLASS')) {
|
151 |
$tokens[] = constant('T_ANON_CLASS');
|
167 |
$tokens = $phpcsFile->getTokens();
|
168 |
|
169 |
/**
|
170 |
+
* We distinguish between the class, function and namespace names vs the define statements.
|
171 |
*/
|
172 |
if ($tokens[$stackPtr]['type'] === 'T_STRING') {
|
173 |
$this->processString($phpcsFile, $stackPtr, $tokens);
|
194 |
return;
|
195 |
}
|
196 |
|
197 |
+
/*
|
198 |
+
* PHP 5.6 allows for use const and use function, but only if followed by the function/constant name.
|
199 |
+
* - `use function HelloWorld` => move to the next token (HelloWorld) to verify.
|
200 |
+
* - `use const HelloWorld` => move to the next token (HelloWorld) to verify.
|
201 |
+
*/
|
202 |
+
if ($tokens[$stackPtr]['type'] === 'T_USE'
|
203 |
+
&& isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === true
|
204 |
+
&& $this->supportsAbove('5.6')
|
205 |
+
) {
|
206 |
+
$maybeUseNext = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
|
207 |
+
if ($maybeUseNext !== false && $this->isEndOfUseStatement($tokens[$maybeUseNext]) === false) {
|
208 |
+
// Prevent duplicate messages: `const` is T_CONST in PHPCS 1.x and T_STRING in PHPCS 2.x.
|
209 |
+
if ($this->isLowPHPCS === true) {
|
210 |
+
return;
|
211 |
+
}
|
212 |
+
$nextNonEmpty = $maybeUseNext;
|
213 |
+
}
|
214 |
}
|
215 |
|
216 |
+
/*
|
217 |
+
* Deal with visibility modifiers.
|
218 |
+
* - `use HelloWorld { sayHello as protected; }` => valid, bow out.
|
219 |
+
* - `use HelloWorld { sayHello as private myPrivateHello; }` => move to the next token to verify.
|
220 |
+
*/
|
221 |
+
else if ($tokens[$stackPtr]['type'] === 'T_AS'
|
222 |
+
&& in_array($tokens[$nextNonEmpty]['code'], PHP_CodeSniffer_Tokens::$scopeModifiers, true) === true
|
223 |
+
&& $this->inUseScope($phpcsFile, $stackPtr) === true
|
224 |
) {
|
225 |
+
$maybeUseNext = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
|
226 |
+
if ($maybeUseNext === false || $this->isEndOfUseStatement($tokens[$maybeUseNext]) === true) {
|
227 |
+
return;
|
228 |
+
}
|
229 |
+
|
230 |
+
$nextNonEmpty = $maybeUseNext;
|
231 |
+
}
|
232 |
+
|
233 |
+
$nextContentLc = strtolower($tokens[$nextNonEmpty]['content']);
|
234 |
+
if (isset($this->invalidNames[$nextContentLc]) === false) {
|
235 |
return;
|
236 |
}
|
237 |
|
273 |
// Special case for 5.3 where we want to find usage of traits, but
|
274 |
// trait is not a token.
|
275 |
if ($tokenContentLc === 'trait') {
|
276 |
+
$this->processNonString($phpcsFile, $stackPtr, $tokens);
|
277 |
+
return;
|
278 |
}
|
279 |
|
280 |
// Look for any define/defined tokens (both T_STRING ones, blame Tokenizer).
|
301 |
}
|
302 |
}//end processString()
|
303 |
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Check if the current token code is for a token which can be considered
|
307 |
+
* the end of a (partial) use statement.
|
308 |
+
*
|
309 |
+
* @param int $token The current token information.
|
310 |
+
*
|
311 |
+
* @return bool
|
312 |
+
*/
|
313 |
+
protected function isEndOfUseStatement($token)
|
314 |
+
{
|
315 |
+
return in_array($token['code'], array(T_CLOSE_CURLY_BRACKET, T_SEMICOLON, T_COMMA), true);
|
316 |
+
}
|
317 |
}//end class
|
vendor/wimg/php-compatibility/Sniffs/PHP/LongArraysSniff.php
CHANGED
@@ -65,9 +65,51 @@ class PHPCompatibility_Sniffs_PHP_LongArraysSniff extends PHPCompatibility_Sniff
|
|
65 |
}
|
66 |
|
67 |
$tokens = $phpcsFile->getTokens();
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
72 |
}
|
73 |
}
|
65 |
}
|
66 |
|
67 |
$tokens = $phpcsFile->getTokens();
|
68 |
+
|
69 |
+
// Check if the variable name is in our blacklist.
|
70 |
+
if (in_array(substr($tokens[$stackPtr]['content'], 1), $this->deprecated, true) === false) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($this->inClassScope($phpcsFile, $stackPtr, false) === true) {
|
75 |
+
/*
|
76 |
+
* Check for class property definitions.
|
77 |
+
*/
|
78 |
+
$properties = array();
|
79 |
+
try {
|
80 |
+
$properties = $phpcsFile->getMemberProperties($stackPtr);
|
81 |
+
} catch ( PHP_CodeSniffer_Exception $e) {
|
82 |
+
// If it's not an expected exception, throw it.
|
83 |
+
if ($e->getMessage() !== '$stackPtr is not a class member var') {
|
84 |
+
throw $e;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
if (isset($properties['scope'])) {
|
89 |
+
// Ok, so this was a class property declaration, not our concern.
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
/*
|
94 |
+
* Check for static usage of class properties shadowing the long arrays.
|
95 |
+
*/
|
96 |
+
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
97 |
+
if ($tokens[$prevToken]['code'] === T_DOUBLE_COLON) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// Still here, so throw an error/warning.
|
103 |
+
$error = "The use of long predefined variables has been deprecated in 5.3%s; Found '%s'";
|
104 |
+
$isError = $this->supportsAbove('5.4');
|
105 |
+
$data = array(
|
106 |
+
($isError ? ' and removed in 5.4' : ''),
|
107 |
+
$tokens[$stackPtr]['content']
|
108 |
+
);
|
109 |
+
|
110 |
+
if ($isError === true) {
|
111 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
112 |
+
} else {
|
113 |
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
114 |
}
|
115 |
}
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewConstVisibilitySniff.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewConstVisibility.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewConstVisibility.
|
14 |
+
*
|
15 |
+
* Visibility for class constants is available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewConstVisibilitySniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
return array(T_CONST);
|
33 |
+
|
34 |
+
}//end register()
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Processes this test, when one of its tokens is encountered.
|
38 |
+
*
|
39 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
40 |
+
* @param int $stackPtr The position of the current token
|
41 |
+
* in the stack passed in $tokens.
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
46 |
+
{
|
47 |
+
$tokens = $phpcsFile->getTokens();
|
48 |
+
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
|
49 |
+
|
50 |
+
if ($prevToken === false) {
|
51 |
+
return;
|
52 |
+
}
|
53 |
+
|
54 |
+
// Is the previous token a visibility indicator ?
|
55 |
+
if (in_array($tokens[$prevToken]['code'], PHP_CodeSniffer_Tokens::$scopeModifiers, true) === false) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
if ($this->tokenHasScope($phpcsFile, $stackPtr, array(T_CLASS, T_INTERFACE)) === true && $this->supportsBelow('7.0') === true) {
|
60 |
+
$error = 'Visibility indicators for class constants are not supported in PHP 7.0 or earlier. Found "%s const"';
|
61 |
+
$data = array($tokens[$prevToken]['content']);
|
62 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
}//end process()
|
67 |
+
|
68 |
+
}//end class
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionParametersSniff.php
CHANGED
@@ -439,6 +439,16 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
|
|
439 |
'5.3.2' => false,
|
440 |
'5.3.3' => true
|
441 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
),
|
443 |
'openssl_encrypt' => array(
|
444 |
4 => array(
|
@@ -446,6 +456,21 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
|
|
446 |
'5.3.2' => false,
|
447 |
'5.3.3' => true
|
448 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
),
|
450 |
'openssl_pkcs7_verify' => array(
|
451 |
5 => array(
|
439 |
'5.3.2' => false,
|
440 |
'5.3.3' => true
|
441 |
),
|
442 |
+
5 => array(
|
443 |
+
'name' => 'tag',
|
444 |
+
'7.0' => false,
|
445 |
+
'7.1' => true
|
446 |
+
),
|
447 |
+
6 => array(
|
448 |
+
'name' => 'aad',
|
449 |
+
'7.0' => false,
|
450 |
+
'7.1' => true
|
451 |
+
),
|
452 |
),
|
453 |
'openssl_encrypt' => array(
|
454 |
4 => array(
|
456 |
'5.3.2' => false,
|
457 |
'5.3.3' => true
|
458 |
),
|
459 |
+
5 => array(
|
460 |
+
'name' => 'tag',
|
461 |
+
'7.0' => false,
|
462 |
+
'7.1' => true
|
463 |
+
),
|
464 |
+
6 => array(
|
465 |
+
'name' => 'aad',
|
466 |
+
'7.0' => false,
|
467 |
+
'7.1' => true
|
468 |
+
),
|
469 |
+
7 => array(
|
470 |
+
'name' => 'tag_length',
|
471 |
+
'7.0' => false,
|
472 |
+
'7.1' => true
|
473 |
+
),
|
474 |
),
|
475 |
'openssl_pkcs7_verify' => array(
|
476 |
5 => array(
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionsSniff.php
CHANGED
@@ -1205,6 +1205,40 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
|
|
1205 |
'5.6' => false,
|
1206 |
'7.0' => true
|
1207 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1208 |
);
|
1209 |
|
1210 |
|
1205 |
'5.6' => false,
|
1206 |
'7.0' => true
|
1207 |
),
|
1208 |
+
|
1209 |
+
'socket_export_stream' => array(
|
1210 |
+
'7.0.6' => false,
|
1211 |
+
'7.0.7' => true
|
1212 |
+
),
|
1213 |
+
|
1214 |
+
'curl_multi_errno' => array(
|
1215 |
+
'7.0' => false,
|
1216 |
+
'7.1' => true
|
1217 |
+
),
|
1218 |
+
'curl_share_errno' => array(
|
1219 |
+
'7.0' => false,
|
1220 |
+
'7.1' => true
|
1221 |
+
),
|
1222 |
+
'curl_share_strerror' => array(
|
1223 |
+
'7.0' => false,
|
1224 |
+
'7.1' => true
|
1225 |
+
),
|
1226 |
+
'is_iterable' => array(
|
1227 |
+
'7.0' => false,
|
1228 |
+
'7.1' => true
|
1229 |
+
),
|
1230 |
+
'pcntl_async_signals' => array(
|
1231 |
+
'7.0' => false,
|
1232 |
+
'7.1' => true
|
1233 |
+
),
|
1234 |
+
'session_create_id' => array(
|
1235 |
+
'7.0' => false,
|
1236 |
+
'7.1' => true
|
1237 |
+
),
|
1238 |
+
'session_gc' => array(
|
1239 |
+
'7.0' => false,
|
1240 |
+
'7.1' => true
|
1241 |
+
),
|
1242 |
);
|
1243 |
|
1244 |
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewIniDirectivesSniff.php
CHANGED
@@ -448,6 +448,15 @@ class PHPCompatibility_Sniffs_PHP_NewIniDirectivesSniff extends PHPCompatibility
|
|
448 |
'5.6' => false,
|
449 |
'7.0' => true,
|
450 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
);
|
452 |
|
453 |
/**
|
448 |
'5.6' => false,
|
449 |
'7.0' => true,
|
450 |
),
|
451 |
+
|
452 |
+
'session.sid_length' => array(
|
453 |
+
'7.0' => false,
|
454 |
+
'7.1' => true,
|
455 |
+
),
|
456 |
+
'session.sid_bits_per_character' => array(
|
457 |
+
'7.0' => false,
|
458 |
+
'7.1' => true,
|
459 |
+
),
|
460 |
);
|
461 |
|
462 |
/**
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewKeywordsSniff.php
CHANGED
@@ -191,6 +191,10 @@ class PHPCompatibility_Sniffs_PHP_NewKeywordsSniff extends PHPCompatibility_Snif
|
|
191 |
$tokenType = $this->translateContentToToken[$content];
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
194 |
$nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
195 |
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
196 |
|
191 |
$tokenType = $this->translateContentToToken[$content];
|
192 |
}
|
193 |
|
194 |
+
if (isset($this->newKeywords[$tokenType]) === false) {
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
|
198 |
$nextToken = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
|
199 |
$prevToken = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
|
200 |
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewMultiCatchSniff.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewMultiCatch.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewMultiCatch.
|
14 |
+
*
|
15 |
+
* Catching multiple exception types in one statement is available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewMultiCatchSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
return array(T_CATCH);
|
33 |
+
|
34 |
+
}//end register()
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Processes this test, when one of its tokens is encountered.
|
38 |
+
*
|
39 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
40 |
+
* @param int $stackPtr The position of the current token
|
41 |
+
* in the stack passed in $tokens.
|
42 |
+
*
|
43 |
+
* @return void
|
44 |
+
*/
|
45 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
46 |
+
{
|
47 |
+
if ($this->supportsBelow('7.0') === false) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
$tokens = $phpcsFile->getTokens();
|
52 |
+
$token = $tokens[$stackPtr];
|
53 |
+
|
54 |
+
// Bow out during live coding.
|
55 |
+
if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$hasBitwiseOr = $phpcsFile->findNext(T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']);
|
60 |
+
|
61 |
+
if ($hasBitwiseOr === false) {
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
|
65 |
+
$phpcsFile->addError(
|
66 |
+
'Catching multiple exceptions within one statement is not supported in PHP 7.0 or earlier.',
|
67 |
+
$hasBitwiseOr,
|
68 |
+
'Found'
|
69 |
+
);
|
70 |
+
|
71 |
+
}//end process()
|
72 |
+
|
73 |
+
}//end class
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewNullableTypesSniff.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PHPCompatibility_Sniffs_PHP_NewNullableTypes.
|
4 |
+
*
|
5 |
+
* PHP version 7.1
|
6 |
+
*
|
7 |
+
* @category PHP
|
8 |
+
* @package PHPCompatibility
|
9 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHPCompatibility_Sniffs_PHP_NewNullableTypes.
|
14 |
+
*
|
15 |
+
* Nullable type hints and return types are available since PHP 7.1.
|
16 |
+
*
|
17 |
+
* PHP version 7.1
|
18 |
+
*
|
19 |
+
* @category PHP
|
20 |
+
* @package PHPCompatibility
|
21 |
+
* @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
|
22 |
+
*/
|
23 |
+
class PHPCompatibility_Sniffs_PHP_NewNullableTypesSniff extends PHPCompatibility_Sniff
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns an array of tokens this test wants to listen for.
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function register()
|
31 |
+
{
|
32 |
+
$tokens = array(
|
33 |
+
T_FUNCTION,
|
34 |
+
);
|
35 |
+
|
36 |
+
if (version_compare(PHP_CodeSniffer::VERSION, '2.3.4') >= 0) {
|
37 |
+
$tokens[] = T_RETURN_TYPE;
|
38 |
+
}
|
39 |
+
|
40 |
+
return $tokens;
|
41 |
+
|
42 |
+
}//end register()
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Processes this test, when one of its tokens is encountered.
|
47 |
+
*
|
48 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
49 |
+
* @param int $stackPtr The position of the current token
|
50 |
+
* in the stack passed in $tokens.
|
51 |
+
*
|
52 |
+
* @return void
|
53 |
+
*/
|
54 |
+
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
55 |
+
{
|
56 |
+
if ($this->supportsBelow('7.0') === false) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$tokens = $phpcsFile->getTokens();
|
61 |
+
$tokenCode = $tokens[$stackPtr]['code'];
|
62 |
+
|
63 |
+
if ($tokenCode === T_FUNCTION) {
|
64 |
+
$this->processFunctionDeclaration($phpcsFile, $stackPtr);
|
65 |
+
} else {
|
66 |
+
$this->processReturnType($phpcsFile, $stackPtr);
|
67 |
+
}
|
68 |
+
}//end process()
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Process this test for function tokens.
|
73 |
+
*
|
74 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
75 |
+
* @param int $stackPtr The position of the current token
|
76 |
+
* in the stack passed in $tokens.
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
protected function processFunctionDeclaration(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
81 |
+
{
|
82 |
+
$params = $this->getMethodParameters($phpcsFile, $stackPtr);
|
83 |
+
|
84 |
+
if (empty($params) === false && is_array($params)) {
|
85 |
+
foreach ($params as $param) {
|
86 |
+
if ($param['nullable_type'] === true) {
|
87 |
+
$phpcsFile->addError(
|
88 |
+
'Nullable type declarations are not supported in PHP 7.0 or earlier. Found: %s',
|
89 |
+
$stackPtr,
|
90 |
+
'typeDeclarationFound',
|
91 |
+
array($param['type_hint'])
|
92 |
+
);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Process this test for return type tokens.
|
101 |
+
*
|
102 |
+
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
|
103 |
+
* @param int $stackPtr The position of the current token
|
104 |
+
* in the stack passed in $tokens.
|
105 |
+
*
|
106 |
+
* @return void
|
107 |
+
*/
|
108 |
+
protected function processReturnType(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
|
109 |
+
{
|
110 |
+
$tokens = $phpcsFile->getTokens();
|
111 |
+
if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
|
112 |
+
$phpcsFile->addError(
|
113 |
+
'Nullable return types are not supported in PHP 7.0 or earlier.',
|
114 |
+
$stackPtr,
|
115 |
+
'returnTypeFound'
|
116 |
+
);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
}//end class
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewScalarReturnTypeDeclarationsSniff.php
CHANGED
@@ -29,22 +29,23 @@ class PHPCompatibility_Sniffs_PHP_NewScalarReturnTypeDeclarationsSniff extends P
|
|
29 |
'int' => array(
|
30 |
'5.6' => false,
|
31 |
'7.0' => true,
|
32 |
-
'description' => 'int return type'
|
33 |
),
|
34 |
'float' => array(
|
35 |
'5.6' => false,
|
36 |
'7.0' => true,
|
37 |
-
'description' => 'float return type'
|
38 |
),
|
39 |
'bool' => array(
|
40 |
'5.6' => false,
|
41 |
'7.0' => true,
|
42 |
-
'description' => 'bool return type'
|
43 |
),
|
44 |
'string' => array(
|
45 |
'5.6' => false,
|
46 |
'7.0' => true,
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
),
|
49 |
);
|
50 |
|
@@ -106,12 +107,15 @@ class PHPCompatibility_Sniffs_PHP_NewScalarReturnTypeDeclarationsSniff extends P
|
|
106 |
}
|
107 |
}
|
108 |
if (strlen($error) > 0) {
|
109 |
-
$error =
|
|
|
|
|
|
|
110 |
|
111 |
if ($isError === true) {
|
112 |
-
$phpcsFile->addError($error, $stackPtr);
|
113 |
} else {
|
114 |
-
$phpcsFile->addWarning($error, $stackPtr);
|
115 |
}
|
116 |
}
|
117 |
|
29 |
'int' => array(
|
30 |
'5.6' => false,
|
31 |
'7.0' => true,
|
|
|
32 |
),
|
33 |
'float' => array(
|
34 |
'5.6' => false,
|
35 |
'7.0' => true,
|
|
|
36 |
),
|
37 |
'bool' => array(
|
38 |
'5.6' => false,
|
39 |
'7.0' => true,
|
|
|
40 |
),
|
41 |
'string' => array(
|
42 |
'5.6' => false,
|
43 |
'7.0' => true,
|
44 |
+
),
|
45 |
+
|
46 |
+
'void' => array(
|
47 |
+
'7.0' => false,
|
48 |
+
'7.1' => true,
|
49 |
),
|
50 |
);
|
51 |
|
107 |
}
|
108 |
}
|
109 |
if (strlen($error) > 0) {
|
110 |
+
$error = '%s return type is ' . $error;
|
111 |
+
$data = array(
|
112 |
+
$typeName,
|
113 |
+
);
|
114 |
|
115 |
if ($isError === true) {
|
116 |
+
$phpcsFile->addError($error, $stackPtr, 'Found', $data);
|
117 |
} else {
|
118 |
+
$phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
|
119 |
}
|
120 |
}
|
121 |
|
vendor/wimg/php-compatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php
CHANGED
@@ -50,6 +50,10 @@ class PHPCompatibility_Sniffs_PHP_NewScalarTypeDeclarationsSniff extends PHPComp
|
|
50 |
'5.6' => false,
|
51 |
'7.0' => true,
|
52 |
),
|
|
|
|
|
|
|
|
|
53 |
);
|
54 |
|
55 |
|
50 |
'5.6' => false,
|
51 |
'7.0' => true,
|
52 |
),
|
53 |
+
'iterable' => array(
|
54 |
+
'7.0' => false,
|
55 |
+
'7.1' => true,
|
56 |
+
),
|
57 |
);
|
58 |
|
59 |
|
vendor/wimg/php-compatibility/Sniffs/PHP/PregReplaceEModifierSniff.php
CHANGED
@@ -84,19 +84,23 @@ class PHPCompatibility_Sniffs_PHP_PregReplaceEModifierSniff extends PHPCompatibi
|
|
84 |
return;
|
85 |
}
|
86 |
|
87 |
-
$stringToken = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $firstParam['start'], $firstParam['end'] + 1);
|
88 |
-
if ($stringToken === false) {
|
89 |
-
// No string token found in the first parameter, so skip it (e.g. if variable passed in).
|
90 |
-
return;
|
91 |
-
}
|
92 |
-
|
93 |
/*
|
94 |
* The first parameter might be build up of a combination of strings,
|
95 |
-
* variables and function calls
|
96 |
-
* and end will still be strings. And as that's all we're concerned with,
|
97 |
-
* just use the raw content of the first parameter for further processing.
|
98 |
*/
|
99 |
-
$regex =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
$regexFirstChar = substr($regex, 0, 1);
|
102 |
if (isset($this->doublesSeparators[$regexFirstChar])) {
|
84 |
return;
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
/*
|
88 |
* The first parameter might be build up of a combination of strings,
|
89 |
+
* variables and function calls. We are only concerned with the strings.
|
|
|
|
|
90 |
*/
|
91 |
+
$regex = '';
|
92 |
+
for ($i = $firstParam['start']; $i <= $firstParam['end']; $i++ ) {
|
93 |
+
if (in_array($tokens[$i]['code'], PHP_CodeSniffer_Tokens::$stringTokens, true) === true) {
|
94 |
+
$regex .= $this->stripQuotes($tokens[$i]['content']);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
// Deal with multi-line regexes which were broken up in several string tokens.
|
98 |
+
$regex = $this->stripQuotes($regex);
|
99 |
+
|
100 |
+
if ($regex === '') {
|
101 |
+
// No string token found in the first parameter, so skip it (e.g. if variable passed in).
|
102 |
+
return;
|
103 |
+
}
|
104 |
|
105 |
$regexFirstChar = substr($regex, 0, 1);
|
106 |
if (isset($this->doublesSeparators[$regexFirstChar])) {
|
vendor/wimg/php-compatibility/Sniffs/PHP/RemovedExtensionsSniff.php
CHANGED
@@ -189,6 +189,11 @@ class PHPCompatibility_Sniffs_PHP_RemovedExtensionsSniff extends PHPCompatibilit
|
|
189 |
'7.0' => 0,
|
190 |
'alternative' => null
|
191 |
),
|
|
|
|
|
|
|
|
|
|
|
192 |
'mcve' => array(
|
193 |
'5.0' => 1,
|
194 |
'5.1' => 0,
|
189 |
'7.0' => 0,
|
190 |
'alternative' => null
|
191 |
),
|
192 |
+
'mcrypt' => array(
|
193 |
+
'7.0' => 1,
|
194 |
+
'7.1' => -1,
|
195 |
+
'alternative' => 'openssl (preferred) or pecl/mcrypt once available'
|
196 |
+
),
|
197 |
'mcve' => array(
|
198 |
'5.0' => 1,
|
199 |
'5.1' => 0,
|
wpengine-phpcompat.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: PHP Compatibility Checker
|
|
4 |
Plugin URI: https://wpengine.com
|
5 |
Description: Make sure your plugins and themes are compatible with newer PHP versions.
|
6 |
Author: WP Engine
|
7 |
-
Version: 1.2.
|
8 |
Author URI: https://wpengine.com
|
9 |
Text Domain: php-compatibility-checker
|
10 |
*/
|
4 |
Plugin URI: https://wpengine.com
|
5 |
Description: Make sure your plugins and themes are compatible with newer PHP versions.
|
6 |
Author: WP Engine
|
7 |
+
Version: 1.2.3
|
8 |
Author URI: https://wpengine.com
|
9 |
Text Domain: php-compatibility-checker
|
10 |
*/
|