PHP Compatibility Checker - Version 1.3.0

Version Description

  • Updated the PHPCompatibility library to latest version. Should fix many false positives.
  • Changed language and added help text to Admin UI.
Download this release

Release Info

Developer wpengine
Plugin Icon 128x128 PHP Compatibility Checker
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.4 to 1.3.0

Files changed (32) hide show
  1. readme.txt +12 -7
  2. src/wpephpcompat.php +2 -0
  3. vendor/composer/installed.json +4 -4
  4. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php +19 -19
  5. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php +4 -4
  6. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php +5 -1
  7. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php +13 -3
  8. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php +184 -0
  9. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php +0 -11
  10. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php +0 -11
  11. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php +1 -1
  12. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php +1 -1
  13. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php +8 -8
  14. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php +13 -4
  15. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php +1 -1
  16. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/TernaryOperatorsSniff.php +1 -1
  17. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ValidIntegersSniff.php +1 -1
  18. vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php +19 -19
  19. vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php +4 -4
  20. vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php +5 -1
  21. vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php +13 -3
  22. vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php +184 -0
  23. vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php +0 -11
  24. vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesSniff.php +0 -11
  25. vendor/wimg/php-compatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php +1 -1
  26. vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionParametersSniff.php +1 -1
  27. vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionsSniff.php +8 -8
  28. vendor/wimg/php-compatibility/Sniffs/PHP/PregReplaceEModifierSniff.php +13 -4
  29. vendor/wimg/php-compatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php +1 -1
  30. vendor/wimg/php-compatibility/Sniffs/PHP/TernaryOperatorsSniff.php +1 -1
  31. vendor/wimg/php-compatibility/Sniffs/PHP/ValidIntegersSniff.php +1 -1
  32. wpengine-phpcompat.php +17 -7
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.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -17,15 +17,15 @@ This plugin will lint theme and plugin code inside your WordPress file system an
17
 
18
  **This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.**
19
 
20
- **Please note that linting code is not perfect. This plugin cannot detect unused codepaths that might be used for backwards compatibility, and thus might show false postiives. We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that can cause false positives. We are continuously working to ensure the checker provides the most accurate results possible.**
21
 
22
  **This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site's WP-Cron isn't running correctly. Please see the [FAQ](https://wordpress.org/plugins/php-compatibility-checker/faq/) for more information.**
23
 
24
  = Update to PHP 7 =
25
  * Use this plugin to check your site for compatibility for PHP 7!
26
- * As of [August 2016](https://wordpress.org/about/stats/), 57.1% of WordPress websites run a PHP version less PHP 5.5.
27
  * These versions of PHP have been deprecated and unsupported for over 9 months.
28
- * Only 2.2% of WordPress websites run PHP 7, the current main version of PHP.
29
 
30
 
31
  = Disclaimer =
@@ -79,7 +79,7 @@ Example: `wp phpcompat 7.0 --scan=active`
79
 
80
  3. A plugin I created is listed as not compatible, what should I do?
81
 
82
- We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that cause false positives. If your plugin shows up as incompatible but you think that is wrong, please open a [GitHub issue](https://github.com/wpengine/phpcompat/issues/new) on the project, or email wordpress@wpengine.com with info about your plugin and why you know it is compatible (you have automated tests, the failure is on backwards compatibility codepaths, etc).
83
 
84
  4. Can I use this to test non-WordPress PHP Projects?
85
 
@@ -114,6 +114,10 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
114
 
115
  == Changelog ==
116
 
 
 
 
 
117
  = 1.2.4 =
118
  - Fixed Composer issue.
119
 
@@ -172,5 +176,6 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
172
 
173
  == Upgrade Notice ==
174
 
175
- = 1.2.4 =
176
- - Fixed Composer issue.
 
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.3.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
17
 
18
  **This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.**
19
 
20
+ **Please note that linting code is not perfect. This plugin cannot detect unused code-paths that might be used for backwards compatibility, and thus might show false positives. We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that can cause false positives. We are continuously working to ensure the checker provides the most accurate results possible.**
21
 
22
  **This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site's WP-Cron isn't running correctly. Please see the [FAQ](https://wordpress.org/plugins/php-compatibility-checker/faq/) for more information.**
23
 
24
  = Update to PHP 7 =
25
  * Use this plugin to check your site for compatibility for PHP 7!
26
+ * As of [November 2016](https://wordpress.org/about/stats/), 52.9% of WordPress websites run a PHP version less PHP 5.5.
27
  * These versions of PHP have been deprecated and unsupported for over 9 months.
28
+ * Only 3.4% of WordPress websites run PHP 7, the current main version of PHP.
29
 
30
 
31
  = Disclaimer =
79
 
80
  3. A plugin I created is listed as not compatible, what should I do?
81
 
82
+ We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that cause false positives. If your plugin shows up as incompatible but you think that is wrong, please open a [GitHub issue](https://github.com/wpengine/phpcompat/issues/new) on the project, or email wordpress@wpengine.com with info about your plugin and why you know it is compatible (you have automated tests, the failure is on backwards compatibility code paths, etc).
83
 
84
  4. Can I use this to test non-WordPress PHP Projects?
85
 
114
 
115
  == Changelog ==
116
 
117
+ = 1.3.0 =
118
+ - Updated the PHPCompatibility library to latest version. Should fix many false positives.
119
+ - Changed language and added help text to Admin UI.
120
+
121
  = 1.2.4 =
122
  - Fixed Composer issue.
123
 
176
 
177
  == Upgrade Notice ==
178
 
179
+ = 1.3.0 =
180
+ - Updated the PHPCompatibility library to latest version. Should fix many false positives.
181
+ - Changed language and added help text to Admin UI.
src/wpephpcompat.php CHANGED
@@ -73,6 +73,8 @@ class WPEPHPCompat {
73
  '*/updraftplus/*' => '7.0',
74
  '*/megamenu/*' => '7.0',
75
  '*/tablepress/*' => '7.0',
 
 
76
  );
77
 
78
  /**
73
  '*/updraftplus/*' => '7.0',
74
  '*/megamenu/*' => '7.0',
75
  '*/tablepress/*' => '7.0',
76
+ '*/myMail/*' => '7.0',
77
+ '*/wp-spamshield/*' => '7.0',
78
  );
79
 
80
  /**
vendor/composer/installed.json CHANGED
@@ -140,12 +140,12 @@
140
  "source": {
141
  "type": "git",
142
  "url": "https://github.com/wimg/PHPCompatibility.git",
143
- "reference": "f00019c58dec75232ea67e6d2ed49fde9b3df590"
144
  },
145
  "dist": {
146
  "type": "zip",
147
- "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/f00019c58dec75232ea67e6d2ed49fde9b3df590",
148
- "reference": "f00019c58dec75232ea67e6d2ed49fde9b3df590",
149
  "shasum": ""
150
  },
151
  "require": {
@@ -156,7 +156,7 @@
156
  "require-dev": {
157
  "satooshi/php-coveralls": "dev-master"
158
  },
159
- "time": "2016-10-25 23:03:42",
160
  "type": "phpcodesniffer-standard",
161
  "installation-source": "source",
162
  "autoload": {
140
  "source": {
141
  "type": "git",
142
  "url": "https://github.com/wimg/PHPCompatibility.git",
143
+ "reference": "a3263259daa3629d174d1ac25657466222d6607e"
144
  },
145
  "dist": {
146
  "type": "zip",
147
+ "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/a3263259daa3629d174d1ac25657466222d6607e",
148
+ "reference": "a3263259daa3629d174d1ac25657466222d6607e",
149
  "shasum": ""
150
  },
151
  "require": {
156
  "require-dev": {
157
  "satooshi/php-coveralls": "dev-master"
158
  },
159
+ "time": "2016-10-30 14:34:26",
160
  "type": "phpcodesniffer-standard",
161
  "installation-source": "source",
162
  "autoload": {
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php CHANGED
@@ -19,14 +19,14 @@
19
  class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibility_Sniff
20
  {
21
  /**
22
- * A list of forbidden functions with their alternatives.
23
  *
24
- * The array lists : version number with false (deprecated) or true (forbidden) and an alternative function.
25
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
26
  *
27
  * @var array(string => array(string => bool|string|null))
28
  */
29
- protected $forbiddenFunctions = array(
30
  'php_check_syntax' => array(
31
  '5.0.5' => true,
32
  'alternative' => null
@@ -764,7 +764,7 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
764
  *
765
  * @var array
766
  */
767
- protected $forbiddenFunctionNames = array();
768
 
769
  /**
770
  * Returns an array of tokens this test wants to listen for.
@@ -773,9 +773,9 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
773
  */
774
  public function register()
775
  {
776
- // Everyone has had a chance to figure out what forbidden functions
777
  // they want to check for, so now we can cache out the list.
778
- $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions);
779
 
780
  return array(T_STRING);
781
 
@@ -812,7 +812,7 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
812
 
813
  $function = strtolower($tokens[$stackPtr]['content']);
814
 
815
- if (in_array($function, $this->forbiddenFunctionNames) === false) {
816
  return;
817
  }
818
 
@@ -824,9 +824,9 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
824
  * Generates the error or warning for this sniff.
825
  *
826
  * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
827
- * @param int $stackPtr The position of the forbidden function
828
  * in the token array.
829
- * @param string $function The name of the forbidden function.
830
  *
831
  * @return void
832
  */
@@ -836,28 +836,28 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
836
 
837
  $isError = false;
838
  $previousVersionStatus = null;
839
- foreach ($this->forbiddenFunctions[$function] as $version => $forbidden) {
840
  if ($this->supportsAbove($version)) {
841
  if ($version != 'alternative') {
842
- if ($previousVersionStatus !== $forbidden) {
843
- $previousVersionStatus = $forbidden;
844
- if ($forbidden === true) {
845
  $isError = true;
846
- $error .= 'forbidden';
847
  } else {
848
- $error .= 'discouraged';
849
  }
850
- $error .= ' from PHP version ' . $version . ' and ';
851
  }
852
  }
853
  }
854
  }
855
  if (strlen($error) > 0) {
856
- $error = 'The use of function ' . $function . ' is ' . $error;
857
  $error = substr($error, 0, strlen($error) - 5);
858
 
859
- if ($this->forbiddenFunctions[$function]['alternative'] !== null) {
860
- $error .= '; use ' . $this->forbiddenFunctions[$function]['alternative'] . ' instead';
861
  }
862
 
863
  if ($isError === true) {
19
  class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibility_Sniff
20
  {
21
  /**
22
+ * A list of deprecated and removed functions with their alternatives.
23
  *
24
+ * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
25
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
26
  *
27
  * @var array(string => array(string => bool|string|null))
28
  */
29
+ protected $removedFunctions = array(
30
  'php_check_syntax' => array(
31
  '5.0.5' => true,
32
  'alternative' => null
764
  *
765
  * @var array
766
  */
767
+ protected $removedFunctionNames = array();
768
 
769
  /**
770
  * Returns an array of tokens this test wants to listen for.
773
  */
774
  public function register()
775
  {
776
+ // Everyone has had a chance to figure out what removed functions
777
  // they want to check for, so now we can cache out the list.
778
+ $this->removedFunctionNames = array_keys($this->removedFunctions);
779
 
780
  return array(T_STRING);
781
 
812
 
813
  $function = strtolower($tokens[$stackPtr]['content']);
814
 
815
+ if (in_array($function, $this->removedFunctionNames) === false) {
816
  return;
817
  }
818
 
824
  * Generates the error or warning for this sniff.
825
  *
826
  * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
827
+ * @param int $stackPtr The position of the function
828
  * in the token array.
829
+ * @param string $function The name of the function.
830
  *
831
  * @return void
832
  */
836
 
837
  $isError = false;
838
  $previousVersionStatus = null;
839
+ foreach ($this->removedFunctions[$function] as $version => $removed) {
840
  if ($this->supportsAbove($version)) {
841
  if ($version != 'alternative') {
842
+ if ($previousVersionStatus !== $removed) {
843
+ $previousVersionStatus = $removed;
844
+ if ($removed === true) {
845
  $isError = true;
846
+ $error .= 'removed';
847
  } else {
848
+ $error .= 'deprecated';
849
  }
850
+ $error .= ' since PHP ' . $version . ' and ';
851
  }
852
  }
853
  }
854
  }
855
  if (strlen($error) > 0) {
856
+ $error = 'Function ' . $function . '() is ' . $error;
857
  $error = substr($error, 0, strlen($error) - 5);
858
 
859
+ if ($this->removedFunctions[$function]['alternative'] !== null) {
860
+ $error .= '; use ' . $this->removedFunctions[$function]['alternative'] . ' instead';
861
  }
862
 
863
  if ($isError === true) {
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php CHANGED
@@ -257,18 +257,18 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedIniDirectivesSniff extends PHPCompat
257
 
258
  $error = '';
259
 
260
- foreach ($this->deprecatedIniDirectives[$filteredToken] as $version => $forbidden)
261
  {
262
  if ($version !== 'alternative') {
263
  if ($this->supportsAbove($version)) {
264
- if ($forbidden === true) {
265
  $isError = ($function !== 'ini_get') ? true : false;
266
- $error .= " forbidden";
267
  } else {
268
  $isError = false;
269
  $error .= " deprecated";
270
  }
271
- $error .= " from PHP " . $version . " and";
272
  }
273
  }
274
  }
257
 
258
  $error = '';
259
 
260
+ foreach ($this->deprecatedIniDirectives[$filteredToken] as $version => $removed)
261
  {
262
  if ($version !== 'alternative') {
263
  if ($this->supportsAbove($version)) {
264
+ if ($removed === true) {
265
  $isError = ($function !== 'ini_get') ? true : false;
266
+ $error .= " removed";
267
  } else {
268
  $isError = false;
269
  $error .= " deprecated";
270
  }
271
+ $error .= " since PHP " . $version . " and";
272
  }
273
  }
274
  }
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php CHANGED
@@ -81,7 +81,11 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedPHP4StyleConstructorsSniff extends P
81
  }
82
 
83
  if ($newConstructorFound === false && $oldConstructorFound === true) {
84
- $phpcsFile->addError('Use of deprecated PHP4 style class constructor is not supported since PHP 7', $oldConstructorPos);
 
 
 
 
85
  }
86
  }
87
  }
81
  }
82
 
83
  if ($newConstructorFound === false && $oldConstructorFound === true) {
84
+ $phpcsFile->addWarning(
85
+ 'Use of deprecated PHP4 style class constructor is not supported since PHP 7.',
86
+ $oldConstructorPos,
87
+ 'Found'
88
+ );
89
  }
90
  }
91
  }
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php CHANGED
@@ -107,11 +107,21 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenCallTimePassByReferenceSniff extends
107
  foreach ($parameters as $parameter) {
108
  if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) {
109
  // T_BITWISE_AND represents a pass-by-reference.
110
- $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3';
 
 
 
111
  if($this->supportsAbove('5.4')) {
112
- $error .= ' and prohibited since PHP 5.4';
 
 
 
 
 
 
 
 
113
  }
114
- $phpcsFile->addError($error, $parameter['start'], 'NotAllowed');
115
  }
116
  }
117
  }//end process()
107
  foreach ($parameters as $parameter) {
108
  if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) {
109
  // T_BITWISE_AND represents a pass-by-reference.
110
+ $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3';
111
+ $isError = false;
112
+ $errorCode = 'Deprecated';
113
+
114
  if($this->supportsAbove('5.4')) {
115
+ $error .= ' and prohibited since PHP 5.4';
116
+ $isError = true;
117
+ $errorCode = 'NotAllowed';
118
+ }
119
+
120
+ if ($isError === true) {
121
+ $phpcsFile->addError($error, $parameter['start'], $errorCode);
122
+ } else {
123
+ $phpcsFile->addWarning($error, $parameter['start'], $errorCode);
124
  }
 
125
  }
126
  }
127
  }//end process()
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsDeclaredClassSniff.
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_ForbiddenNamesAsDeclaredClassSniff.
14
+ *
15
+ * Prohibits the use of some reserved keywords to name a class, interface, trait or namespace.
16
+ *
17
+ * @see http://php.net/manual/en/reserved.other-reserved-words.php
18
+ *
19
+ * PHP version 7
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
24
+ */
25
+ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsDeclaredSniff extends PHPCompatibility_Sniff
26
+ {
27
+
28
+ /**
29
+ * List of tokens which can not be used as class, interface, trait names or as part of a namespace.
30
+ *
31
+ * @var array
32
+ */
33
+ protected $forbiddenTokens = array(
34
+ T_NULL => '7.0',
35
+ T_TRUE => '7.0',
36
+ T_FALSE => '7.0'
37
+ );
38
+
39
+ /**
40
+ * T_STRING keywords to recognize as forbidden names.
41
+ *
42
+ * @var array
43
+ */
44
+ protected $forbiddenNames = array(
45
+ 'null' => '7.0',
46
+ 'true' => '7.0',
47
+ 'false' => '7.0',
48
+ 'bool' => '7.0',
49
+ 'int' => '7.0',
50
+ 'float' => '7.0',
51
+ 'string' => '7.0',
52
+ 'resource' => '7.0',
53
+ 'object' => '7.0',
54
+ 'mixed' => '7.0',
55
+ 'numeric' => '7.0',
56
+ );
57
+
58
+
59
+ /**
60
+ * Returns an array of tokens this test wants to listen for.
61
+ *
62
+ * @return array
63
+ */
64
+ public function register()
65
+ {
66
+ return array(
67
+ T_CLASS,
68
+ T_INTERFACE,
69
+ T_NAMESPACE,
70
+ T_TRAIT,
71
+ T_STRING, // Compat for PHPCS 1.x and PHP < 5.3.
72
+ );
73
+
74
+ }//end register()
75
+
76
+
77
+ /**
78
+ * Processes this test, when one of its tokens is encountered.
79
+ *
80
+ * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
81
+ * @param int $stackPtr The position of the current token in the
82
+ * stack passed in $tokens.
83
+ *
84
+ * @return void
85
+ */
86
+ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
87
+ {
88
+ $tokens = $phpcsFile->getTokens();
89
+ $tokenCode = $tokens[$stackPtr]['code'];
90
+ $tokenContentLc = strtolower($tokens[$stackPtr]['content']);
91
+
92
+ // For string tokens we only care about 'trait' and 'namespace' as those are
93
+ // the only ones which may not be correctly recognized as it's own token.
94
+ // This only happens in older versions of PHP where the token doesn't exist yet as a keyword.
95
+ if ($tokenCode === T_STRING && ($tokenContentLc !== 'trait' && $tokenContentLc !== 'namespace')) {
96
+ return;
97
+ }
98
+
99
+ if (in_array($tokenCode, array(T_CLASS, T_INTERFACE, T_TRAIT), true)) {
100
+ // Check for the declared name being a name which is not tokenized as T_STRING.
101
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
102
+ if ($nextNonEmpty !== false && isset($this->forbiddenTokens[$tokens[$nextNonEmpty]['code']]) === true) {
103
+ $name = $tokens[$nextNonEmpty]['content'];
104
+ } else {
105
+ // Get the declared name if it's a T_STRING.
106
+ $name = $phpcsFile->getDeclarationName($stackPtr);
107
+ }
108
+ unset($nextNonEmpty);
109
+
110
+ if (isset($name) === false || is_string($name) === false || $name === '') {
111
+ return;
112
+ }
113
+
114
+ $nameLc = strtolower($name);
115
+ if (isset($this->forbiddenNames[$nameLc]) === false) {
116
+ return;
117
+ }
118
+
119
+ } else if ($tokenCode === T_NAMESPACE) {
120
+ $namespaceName = $this->getDeclaredNamespaceName($phpcsFile, $stackPtr);
121
+
122
+ if ($namespaceName === false || $namespaceName === '') {
123
+ return;
124
+ }
125
+
126
+ $namespaceParts = explode('\\', $namespaceName);
127
+ foreach ($namespaceParts as $namespacePart) {
128
+ $partLc = strtolower($namespacePart);
129
+ if (isset($this->forbiddenNames[$partLc]) === true) {
130
+ $name = $namespacePart;
131
+ $nameLc = $partLc;
132
+ break;
133
+ }
134
+ }
135
+ } else if ($tokenCode === T_STRING) {
136
+ // Traits and namespaces which are not yet tokenized as T_TRAIT/T_NAMESPACE.
137
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
138
+ if ($nextNonEmpty === false) {
139
+ return;
140
+ }
141
+
142
+ $nextNonEmptyCode = $tokens[$nextNonEmpty]['code'];
143
+
144
+ if ($nextNonEmptyCode !== T_STRING && isset($this->forbiddenTokens[$nextNonEmptyCode]) === true) {
145
+ $name = $tokens[$nextNonEmpty]['content'];
146
+ $nameLc = strtolower($tokens[$nextNonEmpty]['content']);
147
+ } else if ($nextNonEmptyCode === T_STRING) {
148
+ $endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_OPEN_CURLY_BRACKET), ($stackPtr + 1));
149
+
150
+ do {
151
+ $nextNonEmptyLc = strtolower($tokens[$nextNonEmpty]['content']);
152
+
153
+ if (isset($this->forbiddenNames[$nextNonEmptyLc]) === true) {
154
+ $name = $tokens[$nextNonEmpty]['content'];
155
+ $nameLc = $nextNonEmptyLc;
156
+ break;
157
+ }
158
+
159
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), $endOfStatement, true);
160
+ } while ($nextNonEmpty !== false);
161
+ }
162
+ unset($nextNonEmptyCode, $nextNonEmptyLc, $endOfStatement);
163
+ }
164
+
165
+ if (isset($name, $nameLc) === false) {
166
+ return;
167
+ }
168
+
169
+ // Still here, so this is one of the reserved words.
170
+ $version = $this->forbiddenNames[$nameLc];
171
+ if ($this->supportsAbove($version) === true) {
172
+ $error = "'%s' is a reserved keyword as of PHP version %s and cannot be used to name a class, interface or trait or as part of a namespace (%s)";
173
+ $data = array(
174
+ $nameLc,
175
+ $version,
176
+ $tokens[$stackPtr]['type'],
177
+ );
178
+
179
+ $phpcsFile->addError($error, $stackPtr, 'Found', $data);
180
+ }
181
+ }//end process()
182
+
183
+
184
+ }//end class
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php CHANGED
@@ -48,9 +48,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsInvokedFunctionsSniff extends
48
  T_PUBLIC => '5.0',
49
  T_TRAIT => '5.4',
50
  T_TRY => '5.0',
51
- T_NULL => '7.0',
52
- T_TRUE => '7.0',
53
- T_FALSE => '7.0'
54
  );
55
 
56
  /**
@@ -67,14 +64,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsInvokedFunctionsSniff extends
67
  'callable' => '5.4',
68
  'insteadof' => '5.4',
69
  'trait' => '5.4',
70
- 'bool' => '7.0',
71
- 'int' => '7.0',
72
- 'float' => '7.0',
73
- 'string' => '7.0',
74
- 'resource' => '7.0',
75
- 'object' => '7.0',
76
- 'mixed' => '7.0',
77
- 'numeric' => '7.0',
78
  'finally' => '5.5'
79
  );
80
 
48
  T_PUBLIC => '5.0',
49
  T_TRAIT => '5.4',
50
  T_TRY => '5.0',
 
 
 
51
  );
52
 
53
  /**
64
  'callable' => '5.4',
65
  'insteadof' => '5.4',
66
  'trait' => '5.4',
 
 
 
 
 
 
 
 
67
  'finally' => '5.5'
68
  );
69
 
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php CHANGED
@@ -89,17 +89,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
89
  '__function__' => 'all',
90
  '__method__' => 'all',
91
  '__namespace__' => '5.3',
92
- 'bool' => '7.0',
93
- 'int' => '7.0',
94
- 'float' => '7.0',
95
- 'string' => '7.0',
96
- 'null' => '7.0',
97
- 'true' => '7.0',
98
- 'false' => '7.0',
99
- 'resource' => '7.0',
100
- 'object' => '7.0',
101
- 'mixed' => '7.0',
102
- 'numeric' => '7.0'
103
  );
104
 
105
  /**
89
  '__function__' => 'all',
90
  '__method__' => 'all',
91
  '__namespace__' => '5.3',
 
 
 
 
 
 
 
 
 
 
 
92
  );
93
 
94
  /**
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php CHANGED
@@ -99,7 +99,7 @@ class PHPCompatibility_Sniffs_PHP_MbstringReplaceEModifierSniff extends PHPCompa
99
  $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
100
  }
101
 
102
- $phpcsFile->addError($error, $stackPtr, 'Found');
103
  }
104
 
105
  }//end process()
99
  $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
100
  }
101
 
102
+ $phpcsFile->addWarning($error, $stackPtr, 'Found');
103
  }
104
 
105
  }//end process()
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php CHANGED
@@ -744,7 +744,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
744
  */
745
  public function register()
746
  {
747
- // Everyone has had a chance to figure out what forbidden functions
748
  // they want to check for, so now we can cache out the list.
749
  $this->newFunctionParametersNames = array_keys($this->newFunctionParameters);
750
 
744
  */
745
  public function register()
746
  {
747
+ // Everyone has had a chance to figure out what functions
748
  // they want to check for, so now we can cache out the list.
749
  $this->newFunctionParametersNames = array_keys($this->newFunctionParameters);
750
 
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php CHANGED
@@ -24,7 +24,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
24
  *
25
  * @var array(string => array(string => int|string|null))
26
  */
27
- protected $forbiddenFunctions = array(
28
  'array_fill_keys' => array(
29
  '5.1' => false,
30
  '5.2' => true
@@ -1246,7 +1246,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1246
  *
1247
  * @var array
1248
  */
1249
- private $forbiddenFunctionNames;
1250
 
1251
 
1252
  /**
@@ -1256,11 +1256,11 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1256
  */
1257
  public function register()
1258
  {
1259
- // Everyone has had a chance to figure out what forbidden functions
1260
  // they want to check for, so now we can cache out the list.
1261
- $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions);
1262
- $this->forbiddenFunctionNames = array_map('strtolower', $this->forbiddenFunctionNames);
1263
- $this->forbiddenFunctions = array_combine($this->forbiddenFunctionNames, $this->forbiddenFunctions);
1264
 
1265
  return array(T_STRING);
1266
 
@@ -1298,7 +1298,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1298
 
1299
  $function = strtolower($tokens[$stackPtr]['content']);
1300
 
1301
- if (in_array($function, $this->forbiddenFunctionNames) === false) {
1302
  return;
1303
  }
1304
 
@@ -1323,7 +1323,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1323
  $error = '';
1324
 
1325
  $isError = false;
1326
- foreach ($this->forbiddenFunctions[$functionLc] as $version => $present) {
1327
  if ($this->supportsBelow($version)) {
1328
  if ($present === false) {
1329
  $isError = true;
24
  *
25
  * @var array(string => array(string => int|string|null))
26
  */
27
+ protected $newFunctions = array(
28
  'array_fill_keys' => array(
29
  '5.1' => false,
30
  '5.2' => true
1246
  *
1247
  * @var array
1248
  */
1249
+ private $newFunctionNames;
1250
 
1251
 
1252
  /**
1256
  */
1257
  public function register()
1258
  {
1259
+ // Everyone has had a chance to figure out what new functions
1260
  // they want to check for, so now we can cache out the list.
1261
+ $this->newFunctionNames = array_keys($this->newFunctions);
1262
+ $this->newFunctionNames = array_map('strtolower', $this->newFunctionNames);
1263
+ $this->newFunctions = array_combine($this->newFunctionNames, $this->newFunctions);
1264
 
1265
  return array(T_STRING);
1266
 
1298
 
1299
  $function = strtolower($tokens[$stackPtr]['content']);
1300
 
1301
+ if (in_array($function, $this->newFunctionNames) === false) {
1302
  return;
1303
  }
1304
 
1323
  $error = '';
1324
 
1325
  $isError = false;
1326
+ foreach ($this->newFunctions[$functionLc] as $version => $present) {
1327
  if ($this->supportsBelow($version)) {
1328
  if ($present === false) {
1329
  $isError = true;
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php CHANGED
@@ -114,13 +114,22 @@ class PHPCompatibility_Sniffs_PHP_PregReplaceEModifierSniff extends PHPCompatibi
114
  $modifiers = substr($regex, $regexEndPos + 1);
115
 
116
  if (strpos($modifiers, 'e') !== false) {
 
 
 
 
 
117
  if ($this->supportsAbove('7.0')) {
118
- $error = '%s() - /e modifier is forbidden since PHP 7.0';
 
 
 
 
 
 
119
  } else {
120
- $error = '%s() - /e modifier is deprecated since PHP 5.5';
121
  }
122
- $data = array($functionName);
123
- $phpcsFile->addError($error, $stackPtr, 'Found', $data);
124
  }
125
  }
126
 
114
  $modifiers = substr($regex, $regexEndPos + 1);
115
 
116
  if (strpos($modifiers, 'e') !== false) {
117
+ $error = '%s() - /e modifier is deprecated since PHP 5.5';
118
+ $isError = false;
119
+ $errorCode = 'Deprecated';
120
+ $data = array($functionName);
121
+
122
  if ($this->supportsAbove('7.0')) {
123
+ $error .= ' and removed since PHP 7.0';
124
+ $isError = true;
125
+ $errorCode = 'Removed';
126
+ }
127
+
128
+ if ($isError === true) {
129
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
130
  } else {
131
+ $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
132
  }
 
 
133
  }
134
  }
135
 
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php CHANGED
@@ -69,7 +69,7 @@ class PHPCompatibility_Sniffs_PHP_RemovedFunctionParametersSniff extends PHPComp
69
  */
70
  public function register()
71
  {
72
- // Everyone has had a chance to figure out what forbidden functions
73
  // they want to check for, so now we can cache out the list.
74
  $this->removedFunctionParametersNames = array_keys($this->removedFunctionParameters);
75
 
69
  */
70
  public function register()
71
  {
72
+ // Everyone has had a chance to figure out what removed function parameters
73
  // they want to check for, so now we can cache out the list.
74
  $this->removedFunctionParametersNames = array_keys($this->removedFunctionParameters);
75
 
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/TernaryOperatorsSniff.php CHANGED
@@ -60,7 +60,7 @@ class PHPCompatibility_Sniffs_PHP_TernaryOperatorsSniff extends PHPCompatibility
60
 
61
  if ($next !== false && $tokens[$next]['code'] === T_INLINE_ELSE) {
62
  $error = 'Middle may not be omitted from ternary operators in PHP < 5.3';
63
- $phpcsFile->addWarning($error, $stackPtr);
64
  }
65
  }
66
  }
60
 
61
  if ($next !== false && $tokens[$next]['code'] === T_INLINE_ELSE) {
62
  $error = 'Middle may not be omitted from ternary operators in PHP < 5.3';
63
+ $phpcsFile->addError($error, $stackPtr);
64
  }
65
  }
66
  }
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/ValidIntegersSniff.php CHANGED
@@ -64,7 +64,7 @@ class PHPCompatibility_Sniffs_PHP_ValidIntegersSniff extends PHPCompatibility_Sn
64
  if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) {
65
  $error = 'Invalid binary integer detected. Found: %s';
66
  $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
67
- $phpcsFile->addError($error, $stackPtr, 'InvalidBinaryIntegerFound', $data);
68
  }
69
  return;
70
  }
64
  if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) {
65
  $error = 'Invalid binary integer detected. Found: %s';
66
  $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
67
+ $phpcsFile->addWarning($error, $stackPtr, 'InvalidBinaryIntegerFound', $data);
68
  }
69
  return;
70
  }
vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php CHANGED
@@ -19,14 +19,14 @@
19
  class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibility_Sniff
20
  {
21
  /**
22
- * A list of forbidden functions with their alternatives.
23
  *
24
- * The array lists : version number with false (deprecated) or true (forbidden) and an alternative function.
25
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
26
  *
27
  * @var array(string => array(string => bool|string|null))
28
  */
29
- protected $forbiddenFunctions = array(
30
  'php_check_syntax' => array(
31
  '5.0.5' => true,
32
  'alternative' => null
@@ -764,7 +764,7 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
764
  *
765
  * @var array
766
  */
767
- protected $forbiddenFunctionNames = array();
768
 
769
  /**
770
  * Returns an array of tokens this test wants to listen for.
@@ -773,9 +773,9 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
773
  */
774
  public function register()
775
  {
776
- // Everyone has had a chance to figure out what forbidden functions
777
  // they want to check for, so now we can cache out the list.
778
- $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions);
779
 
780
  return array(T_STRING);
781
 
@@ -812,7 +812,7 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
812
 
813
  $function = strtolower($tokens[$stackPtr]['content']);
814
 
815
- if (in_array($function, $this->forbiddenFunctionNames) === false) {
816
  return;
817
  }
818
 
@@ -824,9 +824,9 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
824
  * Generates the error or warning for this sniff.
825
  *
826
  * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
827
- * @param int $stackPtr The position of the forbidden function
828
  * in the token array.
829
- * @param string $function The name of the forbidden function.
830
  *
831
  * @return void
832
  */
@@ -836,28 +836,28 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibil
836
 
837
  $isError = false;
838
  $previousVersionStatus = null;
839
- foreach ($this->forbiddenFunctions[$function] as $version => $forbidden) {
840
  if ($this->supportsAbove($version)) {
841
  if ($version != 'alternative') {
842
- if ($previousVersionStatus !== $forbidden) {
843
- $previousVersionStatus = $forbidden;
844
- if ($forbidden === true) {
845
  $isError = true;
846
- $error .= 'forbidden';
847
  } else {
848
- $error .= 'discouraged';
849
  }
850
- $error .= ' from PHP version ' . $version . ' and ';
851
  }
852
  }
853
  }
854
  }
855
  if (strlen($error) > 0) {
856
- $error = 'The use of function ' . $function . ' is ' . $error;
857
  $error = substr($error, 0, strlen($error) - 5);
858
 
859
- if ($this->forbiddenFunctions[$function]['alternative'] !== null) {
860
- $error .= '; use ' . $this->forbiddenFunctions[$function]['alternative'] . ' instead';
861
  }
862
 
863
  if ($isError === true) {
19
  class PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff extends PHPCompatibility_Sniff
20
  {
21
  /**
22
+ * A list of deprecated and removed functions with their alternatives.
23
  *
24
+ * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
25
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
26
  *
27
  * @var array(string => array(string => bool|string|null))
28
  */
29
+ protected $removedFunctions = array(
30
  'php_check_syntax' => array(
31
  '5.0.5' => true,
32
  'alternative' => null
764
  *
765
  * @var array
766
  */
767
+ protected $removedFunctionNames = array();
768
 
769
  /**
770
  * Returns an array of tokens this test wants to listen for.
773
  */
774
  public function register()
775
  {
776
+ // Everyone has had a chance to figure out what removed functions
777
  // they want to check for, so now we can cache out the list.
778
+ $this->removedFunctionNames = array_keys($this->removedFunctions);
779
 
780
  return array(T_STRING);
781
 
812
 
813
  $function = strtolower($tokens[$stackPtr]['content']);
814
 
815
+ if (in_array($function, $this->removedFunctionNames) === false) {
816
  return;
817
  }
818
 
824
  * Generates the error or warning for this sniff.
825
  *
826
  * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
827
+ * @param int $stackPtr The position of the function
828
  * in the token array.
829
+ * @param string $function The name of the function.
830
  *
831
  * @return void
832
  */
836
 
837
  $isError = false;
838
  $previousVersionStatus = null;
839
+ foreach ($this->removedFunctions[$function] as $version => $removed) {
840
  if ($this->supportsAbove($version)) {
841
  if ($version != 'alternative') {
842
+ if ($previousVersionStatus !== $removed) {
843
+ $previousVersionStatus = $removed;
844
+ if ($removed === true) {
845
  $isError = true;
846
+ $error .= 'removed';
847
  } else {
848
+ $error .= 'deprecated';
849
  }
850
+ $error .= ' since PHP ' . $version . ' and ';
851
  }
852
  }
853
  }
854
  }
855
  if (strlen($error) > 0) {
856
+ $error = 'Function ' . $function . '() is ' . $error;
857
  $error = substr($error, 0, strlen($error) - 5);
858
 
859
+ if ($this->removedFunctions[$function]['alternative'] !== null) {
860
+ $error .= '; use ' . $this->removedFunctions[$function]['alternative'] . ' instead';
861
  }
862
 
863
  if ($isError === true) {
vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php CHANGED
@@ -257,18 +257,18 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedIniDirectivesSniff extends PHPCompat
257
 
258
  $error = '';
259
 
260
- foreach ($this->deprecatedIniDirectives[$filteredToken] as $version => $forbidden)
261
  {
262
  if ($version !== 'alternative') {
263
  if ($this->supportsAbove($version)) {
264
- if ($forbidden === true) {
265
  $isError = ($function !== 'ini_get') ? true : false;
266
- $error .= " forbidden";
267
  } else {
268
  $isError = false;
269
  $error .= " deprecated";
270
  }
271
- $error .= " from PHP " . $version . " and";
272
  }
273
  }
274
  }
257
 
258
  $error = '';
259
 
260
+ foreach ($this->deprecatedIniDirectives[$filteredToken] as $version => $removed)
261
  {
262
  if ($version !== 'alternative') {
263
  if ($this->supportsAbove($version)) {
264
+ if ($removed === true) {
265
  $isError = ($function !== 'ini_get') ? true : false;
266
+ $error .= " removed";
267
  } else {
268
  $isError = false;
269
  $error .= " deprecated";
270
  }
271
+ $error .= " since PHP " . $version . " and";
272
  }
273
  }
274
  }
vendor/wimg/php-compatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php CHANGED
@@ -81,7 +81,11 @@ class PHPCompatibility_Sniffs_PHP_DeprecatedPHP4StyleConstructorsSniff extends P
81
  }
82
 
83
  if ($newConstructorFound === false && $oldConstructorFound === true) {
84
- $phpcsFile->addError('Use of deprecated PHP4 style class constructor is not supported since PHP 7', $oldConstructorPos);
 
 
 
 
85
  }
86
  }
87
  }
81
  }
82
 
83
  if ($newConstructorFound === false && $oldConstructorFound === true) {
84
+ $phpcsFile->addWarning(
85
+ 'Use of deprecated PHP4 style class constructor is not supported since PHP 7.',
86
+ $oldConstructorPos,
87
+ 'Found'
88
+ );
89
  }
90
  }
91
  }
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php CHANGED
@@ -107,11 +107,21 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenCallTimePassByReferenceSniff extends
107
  foreach ($parameters as $parameter) {
108
  if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) {
109
  // T_BITWISE_AND represents a pass-by-reference.
110
- $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3';
 
 
 
111
  if($this->supportsAbove('5.4')) {
112
- $error .= ' and prohibited since PHP 5.4';
 
 
 
 
 
 
 
 
113
  }
114
- $phpcsFile->addError($error, $parameter['start'], 'NotAllowed');
115
  }
116
  }
117
  }//end process()
107
  foreach ($parameters as $parameter) {
108
  if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) {
109
  // T_BITWISE_AND represents a pass-by-reference.
110
+ $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3';
111
+ $isError = false;
112
+ $errorCode = 'Deprecated';
113
+
114
  if($this->supportsAbove('5.4')) {
115
+ $error .= ' and prohibited since PHP 5.4';
116
+ $isError = true;
117
+ $errorCode = 'NotAllowed';
118
+ }
119
+
120
+ if ($isError === true) {
121
+ $phpcsFile->addError($error, $parameter['start'], $errorCode);
122
+ } else {
123
+ $phpcsFile->addWarning($error, $parameter['start'], $errorCode);
124
  }
 
125
  }
126
  }
127
  }//end process()
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsDeclaredClassSniff.
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_ForbiddenNamesAsDeclaredClassSniff.
14
+ *
15
+ * Prohibits the use of some reserved keywords to name a class, interface, trait or namespace.
16
+ *
17
+ * @see http://php.net/manual/en/reserved.other-reserved-words.php
18
+ *
19
+ * PHP version 7
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
24
+ */
25
+ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsDeclaredSniff extends PHPCompatibility_Sniff
26
+ {
27
+
28
+ /**
29
+ * List of tokens which can not be used as class, interface, trait names or as part of a namespace.
30
+ *
31
+ * @var array
32
+ */
33
+ protected $forbiddenTokens = array(
34
+ T_NULL => '7.0',
35
+ T_TRUE => '7.0',
36
+ T_FALSE => '7.0'
37
+ );
38
+
39
+ /**
40
+ * T_STRING keywords to recognize as forbidden names.
41
+ *
42
+ * @var array
43
+ */
44
+ protected $forbiddenNames = array(
45
+ 'null' => '7.0',
46
+ 'true' => '7.0',
47
+ 'false' => '7.0',
48
+ 'bool' => '7.0',
49
+ 'int' => '7.0',
50
+ 'float' => '7.0',
51
+ 'string' => '7.0',
52
+ 'resource' => '7.0',
53
+ 'object' => '7.0',
54
+ 'mixed' => '7.0',
55
+ 'numeric' => '7.0',
56
+ );
57
+
58
+
59
+ /**
60
+ * Returns an array of tokens this test wants to listen for.
61
+ *
62
+ * @return array
63
+ */
64
+ public function register()
65
+ {
66
+ return array(
67
+ T_CLASS,
68
+ T_INTERFACE,
69
+ T_NAMESPACE,
70
+ T_TRAIT,
71
+ T_STRING, // Compat for PHPCS 1.x and PHP < 5.3.
72
+ );
73
+
74
+ }//end register()
75
+
76
+
77
+ /**
78
+ * Processes this test, when one of its tokens is encountered.
79
+ *
80
+ * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
81
+ * @param int $stackPtr The position of the current token in the
82
+ * stack passed in $tokens.
83
+ *
84
+ * @return void
85
+ */
86
+ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
87
+ {
88
+ $tokens = $phpcsFile->getTokens();
89
+ $tokenCode = $tokens[$stackPtr]['code'];
90
+ $tokenContentLc = strtolower($tokens[$stackPtr]['content']);
91
+
92
+ // For string tokens we only care about 'trait' and 'namespace' as those are
93
+ // the only ones which may not be correctly recognized as it's own token.
94
+ // This only happens in older versions of PHP where the token doesn't exist yet as a keyword.
95
+ if ($tokenCode === T_STRING && ($tokenContentLc !== 'trait' && $tokenContentLc !== 'namespace')) {
96
+ return;
97
+ }
98
+
99
+ if (in_array($tokenCode, array(T_CLASS, T_INTERFACE, T_TRAIT), true)) {
100
+ // Check for the declared name being a name which is not tokenized as T_STRING.
101
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
102
+ if ($nextNonEmpty !== false && isset($this->forbiddenTokens[$tokens[$nextNonEmpty]['code']]) === true) {
103
+ $name = $tokens[$nextNonEmpty]['content'];
104
+ } else {
105
+ // Get the declared name if it's a T_STRING.
106
+ $name = $phpcsFile->getDeclarationName($stackPtr);
107
+ }
108
+ unset($nextNonEmpty);
109
+
110
+ if (isset($name) === false || is_string($name) === false || $name === '') {
111
+ return;
112
+ }
113
+
114
+ $nameLc = strtolower($name);
115
+ if (isset($this->forbiddenNames[$nameLc]) === false) {
116
+ return;
117
+ }
118
+
119
+ } else if ($tokenCode === T_NAMESPACE) {
120
+ $namespaceName = $this->getDeclaredNamespaceName($phpcsFile, $stackPtr);
121
+
122
+ if ($namespaceName === false || $namespaceName === '') {
123
+ return;
124
+ }
125
+
126
+ $namespaceParts = explode('\\', $namespaceName);
127
+ foreach ($namespaceParts as $namespacePart) {
128
+ $partLc = strtolower($namespacePart);
129
+ if (isset($this->forbiddenNames[$partLc]) === true) {
130
+ $name = $namespacePart;
131
+ $nameLc = $partLc;
132
+ break;
133
+ }
134
+ }
135
+ } else if ($tokenCode === T_STRING) {
136
+ // Traits and namespaces which are not yet tokenized as T_TRAIT/T_NAMESPACE.
137
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
138
+ if ($nextNonEmpty === false) {
139
+ return;
140
+ }
141
+
142
+ $nextNonEmptyCode = $tokens[$nextNonEmpty]['code'];
143
+
144
+ if ($nextNonEmptyCode !== T_STRING && isset($this->forbiddenTokens[$nextNonEmptyCode]) === true) {
145
+ $name = $tokens[$nextNonEmpty]['content'];
146
+ $nameLc = strtolower($tokens[$nextNonEmpty]['content']);
147
+ } else if ($nextNonEmptyCode === T_STRING) {
148
+ $endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_OPEN_CURLY_BRACKET), ($stackPtr + 1));
149
+
150
+ do {
151
+ $nextNonEmptyLc = strtolower($tokens[$nextNonEmpty]['content']);
152
+
153
+ if (isset($this->forbiddenNames[$nextNonEmptyLc]) === true) {
154
+ $name = $tokens[$nextNonEmpty]['content'];
155
+ $nameLc = $nextNonEmptyLc;
156
+ break;
157
+ }
158
+
159
+ $nextNonEmpty = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), $endOfStatement, true);
160
+ } while ($nextNonEmpty !== false);
161
+ }
162
+ unset($nextNonEmptyCode, $nextNonEmptyLc, $endOfStatement);
163
+ }
164
+
165
+ if (isset($name, $nameLc) === false) {
166
+ return;
167
+ }
168
+
169
+ // Still here, so this is one of the reserved words.
170
+ $version = $this->forbiddenNames[$nameLc];
171
+ if ($this->supportsAbove($version) === true) {
172
+ $error = "'%s' is a reserved keyword as of PHP version %s and cannot be used to name a class, interface or trait or as part of a namespace (%s)";
173
+ $data = array(
174
+ $nameLc,
175
+ $version,
176
+ $tokens[$stackPtr]['type'],
177
+ );
178
+
179
+ $phpcsFile->addError($error, $stackPtr, 'Found', $data);
180
+ }
181
+ }//end process()
182
+
183
+
184
+ }//end class
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php CHANGED
@@ -48,9 +48,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsInvokedFunctionsSniff extends
48
  T_PUBLIC => '5.0',
49
  T_TRAIT => '5.4',
50
  T_TRY => '5.0',
51
- T_NULL => '7.0',
52
- T_TRUE => '7.0',
53
- T_FALSE => '7.0'
54
  );
55
 
56
  /**
@@ -67,14 +64,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesAsInvokedFunctionsSniff extends
67
  'callable' => '5.4',
68
  'insteadof' => '5.4',
69
  'trait' => '5.4',
70
- 'bool' => '7.0',
71
- 'int' => '7.0',
72
- 'float' => '7.0',
73
- 'string' => '7.0',
74
- 'resource' => '7.0',
75
- 'object' => '7.0',
76
- 'mixed' => '7.0',
77
- 'numeric' => '7.0',
78
  'finally' => '5.5'
79
  );
80
 
48
  T_PUBLIC => '5.0',
49
  T_TRAIT => '5.4',
50
  T_TRY => '5.0',
 
 
 
51
  );
52
 
53
  /**
64
  'callable' => '5.4',
65
  'insteadof' => '5.4',
66
  'trait' => '5.4',
 
 
 
 
 
 
 
 
67
  'finally' => '5.5'
68
  );
69
 
vendor/wimg/php-compatibility/Sniffs/PHP/ForbiddenNamesSniff.php CHANGED
@@ -89,17 +89,6 @@ class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_S
89
  '__function__' => 'all',
90
  '__method__' => 'all',
91
  '__namespace__' => '5.3',
92
- 'bool' => '7.0',
93
- 'int' => '7.0',
94
- 'float' => '7.0',
95
- 'string' => '7.0',
96
- 'null' => '7.0',
97
- 'true' => '7.0',
98
- 'false' => '7.0',
99
- 'resource' => '7.0',
100
- 'object' => '7.0',
101
- 'mixed' => '7.0',
102
- 'numeric' => '7.0'
103
  );
104
 
105
  /**
89
  '__function__' => 'all',
90
  '__method__' => 'all',
91
  '__namespace__' => '5.3',
 
 
 
 
 
 
 
 
 
 
 
92
  );
93
 
94
  /**
vendor/wimg/php-compatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php CHANGED
@@ -99,7 +99,7 @@ class PHPCompatibility_Sniffs_PHP_MbstringReplaceEModifierSniff extends PHPCompa
99
  $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
100
  }
101
 
102
- $phpcsFile->addError($error, $stackPtr, 'Found');
103
  }
104
 
105
  }//end process()
99
  $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
100
  }
101
 
102
+ $phpcsFile->addWarning($error, $stackPtr, 'Found');
103
  }
104
 
105
  }//end process()
vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionParametersSniff.php CHANGED
@@ -744,7 +744,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionParametersSniff extends PHPCompatib
744
  */
745
  public function register()
746
  {
747
- // Everyone has had a chance to figure out what forbidden functions
748
  // they want to check for, so now we can cache out the list.
749
  $this->newFunctionParametersNames = array_keys($this->newFunctionParameters);
750
 
744
  */
745
  public function register()
746
  {
747
+ // Everyone has had a chance to figure out what functions
748
  // they want to check for, so now we can cache out the list.
749
  $this->newFunctionParametersNames = array_keys($this->newFunctionParameters);
750
 
vendor/wimg/php-compatibility/Sniffs/PHP/NewFunctionsSniff.php CHANGED
@@ -24,7 +24,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
24
  *
25
  * @var array(string => array(string => int|string|null))
26
  */
27
- protected $forbiddenFunctions = array(
28
  'array_fill_keys' => array(
29
  '5.1' => false,
30
  '5.2' => true
@@ -1246,7 +1246,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1246
  *
1247
  * @var array
1248
  */
1249
- private $forbiddenFunctionNames;
1250
 
1251
 
1252
  /**
@@ -1256,11 +1256,11 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1256
  */
1257
  public function register()
1258
  {
1259
- // Everyone has had a chance to figure out what forbidden functions
1260
  // they want to check for, so now we can cache out the list.
1261
- $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions);
1262
- $this->forbiddenFunctionNames = array_map('strtolower', $this->forbiddenFunctionNames);
1263
- $this->forbiddenFunctions = array_combine($this->forbiddenFunctionNames, $this->forbiddenFunctions);
1264
 
1265
  return array(T_STRING);
1266
 
@@ -1298,7 +1298,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1298
 
1299
  $function = strtolower($tokens[$stackPtr]['content']);
1300
 
1301
- if (in_array($function, $this->forbiddenFunctionNames) === false) {
1302
  return;
1303
  }
1304
 
@@ -1323,7 +1323,7 @@ class PHPCompatibility_Sniffs_PHP_NewFunctionsSniff extends PHPCompatibility_Sni
1323
  $error = '';
1324
 
1325
  $isError = false;
1326
- foreach ($this->forbiddenFunctions[$functionLc] as $version => $present) {
1327
  if ($this->supportsBelow($version)) {
1328
  if ($present === false) {
1329
  $isError = true;
24
  *
25
  * @var array(string => array(string => int|string|null))
26
  */
27
+ protected $newFunctions = array(
28
  'array_fill_keys' => array(
29
  '5.1' => false,
30
  '5.2' => true
1246
  *
1247
  * @var array
1248
  */
1249
+ private $newFunctionNames;
1250
 
1251
 
1252
  /**
1256
  */
1257
  public function register()
1258
  {
1259
+ // Everyone has had a chance to figure out what new functions
1260
  // they want to check for, so now we can cache out the list.
1261
+ $this->newFunctionNames = array_keys($this->newFunctions);
1262
+ $this->newFunctionNames = array_map('strtolower', $this->newFunctionNames);
1263
+ $this->newFunctions = array_combine($this->newFunctionNames, $this->newFunctions);
1264
 
1265
  return array(T_STRING);
1266
 
1298
 
1299
  $function = strtolower($tokens[$stackPtr]['content']);
1300
 
1301
+ if (in_array($function, $this->newFunctionNames) === false) {
1302
  return;
1303
  }
1304
 
1323
  $error = '';
1324
 
1325
  $isError = false;
1326
+ foreach ($this->newFunctions[$functionLc] as $version => $present) {
1327
  if ($this->supportsBelow($version)) {
1328
  if ($present === false) {
1329
  $isError = true;
vendor/wimg/php-compatibility/Sniffs/PHP/PregReplaceEModifierSniff.php CHANGED
@@ -114,13 +114,22 @@ class PHPCompatibility_Sniffs_PHP_PregReplaceEModifierSniff extends PHPCompatibi
114
  $modifiers = substr($regex, $regexEndPos + 1);
115
 
116
  if (strpos($modifiers, 'e') !== false) {
 
 
 
 
 
117
  if ($this->supportsAbove('7.0')) {
118
- $error = '%s() - /e modifier is forbidden since PHP 7.0';
 
 
 
 
 
 
119
  } else {
120
- $error = '%s() - /e modifier is deprecated since PHP 5.5';
121
  }
122
- $data = array($functionName);
123
- $phpcsFile->addError($error, $stackPtr, 'Found', $data);
124
  }
125
  }
126
 
114
  $modifiers = substr($regex, $regexEndPos + 1);
115
 
116
  if (strpos($modifiers, 'e') !== false) {
117
+ $error = '%s() - /e modifier is deprecated since PHP 5.5';
118
+ $isError = false;
119
+ $errorCode = 'Deprecated';
120
+ $data = array($functionName);
121
+
122
  if ($this->supportsAbove('7.0')) {
123
+ $error .= ' and removed since PHP 7.0';
124
+ $isError = true;
125
+ $errorCode = 'Removed';
126
+ }
127
+
128
+ if ($isError === true) {
129
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
130
  } else {
131
+ $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
132
  }
 
 
133
  }
134
  }
135
 
vendor/wimg/php-compatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php CHANGED
@@ -69,7 +69,7 @@ class PHPCompatibility_Sniffs_PHP_RemovedFunctionParametersSniff extends PHPComp
69
  */
70
  public function register()
71
  {
72
- // Everyone has had a chance to figure out what forbidden functions
73
  // they want to check for, so now we can cache out the list.
74
  $this->removedFunctionParametersNames = array_keys($this->removedFunctionParameters);
75
 
69
  */
70
  public function register()
71
  {
72
+ // Everyone has had a chance to figure out what removed function parameters
73
  // they want to check for, so now we can cache out the list.
74
  $this->removedFunctionParametersNames = array_keys($this->removedFunctionParameters);
75
 
vendor/wimg/php-compatibility/Sniffs/PHP/TernaryOperatorsSniff.php CHANGED
@@ -60,7 +60,7 @@ class PHPCompatibility_Sniffs_PHP_TernaryOperatorsSniff extends PHPCompatibility
60
 
61
  if ($next !== false && $tokens[$next]['code'] === T_INLINE_ELSE) {
62
  $error = 'Middle may not be omitted from ternary operators in PHP < 5.3';
63
- $phpcsFile->addWarning($error, $stackPtr);
64
  }
65
  }
66
  }
60
 
61
  if ($next !== false && $tokens[$next]['code'] === T_INLINE_ELSE) {
62
  $error = 'Middle may not be omitted from ternary operators in PHP < 5.3';
63
+ $phpcsFile->addError($error, $stackPtr);
64
  }
65
  }
66
  }
vendor/wimg/php-compatibility/Sniffs/PHP/ValidIntegersSniff.php CHANGED
@@ -64,7 +64,7 @@ class PHPCompatibility_Sniffs_PHP_ValidIntegersSniff extends PHPCompatibility_Sn
64
  if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) {
65
  $error = 'Invalid binary integer detected. Found: %s';
66
  $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
67
- $phpcsFile->addError($error, $stackPtr, 'InvalidBinaryIntegerFound', $data);
68
  }
69
  return;
70
  }
64
  if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) {
65
  $error = 'Invalid binary integer detected. Found: %s';
66
  $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
67
+ $phpcsFile->addWarning($error, $stackPtr, 'InvalidBinaryIntegerFound', $data);
68
  }
69
  return;
70
  }
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.4
8
  Author URI: https://wpengine.com
9
  Text Domain: php-compatibility-checker
10
  */
@@ -200,12 +200,12 @@ class WPEngine_PHPCompat {
200
  $strings = array(
201
  'name' => __( 'Name', 'php-compatibility-checker' ),
202
  'compatible' => __( 'compatible', 'php-compatibility-checker' ),
203
- 'are_not' => __( 'plugins/themes are not compatible', 'php-compatibility-checker' ),
204
- 'is_not' => __( 'Your WordPress install is not PHP', 'php-compatibility-checker' ),
205
  'out_of' => __( 'out of', 'php-compatibility-checker' ),
206
  'run' => __( 'Run', 'php-compatibility-checker' ),
207
  'rerun' => __( 'Re-run', 'php-compatibility-checker' ),
208
- 'your_wp' => __( 'Your WordPress install is', 'php-compatibility-checker' ),
209
  );
210
 
211
  wp_localize_script( 'wpephpcompat', 'wpephpcompat', $strings );
@@ -245,7 +245,16 @@ class WPEngine_PHPCompat {
245
  <div style="float: right; margin-top: 10px; text-align: right;">
246
  <input type="checkbox" id="developermode" name="developermode" value="yes" /><?php esc_attr_e( 'Developer mode', 'php-compatibility-checker' ); ?>
247
  </div>
248
- <br><br>
 
 
 
 
 
 
 
 
 
249
  <h3 class="title clear"><?php esc_attr_e( 'Scan Options', 'php-compatibility-checker' ); ?></h3>
250
  <table class="form-table">
251
  <tbody>
@@ -267,6 +276,7 @@ class WPEngine_PHPCompat {
267
  </tr>
268
  </tbody>
269
  </table>
 
270
  <p>
271
  <div style="display: none;" id="wpe-progress">
272
  <label for=""><?php esc_attr_e( 'Progress', 'php-compatibility-checker' ); ?></label>
@@ -285,7 +295,7 @@ class WPEngine_PHPCompat {
285
  </div>
286
 
287
  <div id="footer" style="display: none;">
288
- <?php esc_attr_e( 'Note: Warnings are not currently an issue, but they could be in the future.', 'php-compatibility-checker' ); ?><br>
289
  <a id="downloadReport" href="#"><?php esc_attr_e( 'Download Report', 'php-compatibility-checker' ); ?></a>
290
  </div>
291
  </p>
@@ -303,7 +313,7 @@ class WPEngine_PHPCompat {
303
  </div>
304
  <div class="inner-right">
305
  <h3 style="margin: 0px;">{{plugin_name}}</h3>
306
- {{#if skipped}}<?php esc_attr_e( 'Unknown', 'php-compatibility-checker' ); ?>{{else if passed}}PHP {{test_version}} <?php esc_attr_e( 'compatible', 'php-compatibility-checker' ); ?>.{{else}}<b><?php esc_attr_e( 'Not', 'php-compatibility-checker' ); ?></b> PHP {{test_version}} <?php esc_attr_e( 'compatible', 'php-compatibility-checker' ); ?>.{{/if}}<br>
307
  {{update}}<br>
308
  <textarea style="display: none; white-space: pre;">{{logs}}</textarea><a class="view-details"><?php esc_attr_e( 'view details', 'php-compatibility-checker' ); ?></a>
309
  </div>
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.3.0
8
  Author URI: https://wpengine.com
9
  Text Domain: php-compatibility-checker
10
  */
200
  $strings = array(
201
  'name' => __( 'Name', 'php-compatibility-checker' ),
202
  'compatible' => __( 'compatible', 'php-compatibility-checker' ),
203
+ 'are_not' => __( 'plugins/themes are possibly not compatible', 'php-compatibility-checker' ),
204
+ 'is_not' => __( 'Your WordPress site is possibly not PHP', 'php-compatibility-checker' ),
205
  'out_of' => __( 'out of', 'php-compatibility-checker' ),
206
  'run' => __( 'Run', 'php-compatibility-checker' ),
207
  'rerun' => __( 'Re-run', 'php-compatibility-checker' ),
208
+ 'your_wp' => __( 'Your WordPress site is', 'php-compatibility-checker' ),
209
  );
210
 
211
  wp_localize_script( 'wpephpcompat', 'wpephpcompat', $strings );
245
  <div style="float: right; margin-top: 10px; text-align: right;">
246
  <input type="checkbox" id="developermode" name="developermode" value="yes" /><?php esc_attr_e( 'Developer mode', 'php-compatibility-checker' ); ?>
247
  </div>
248
+ <div class="clear">
249
+ <p><?php esc_attr_e( 'This plugin will lint theme and plugin code inside your WordPress file system and give you back a report of compatibility issues for you to fix. Compatibility issues are categorized into errors and warnings and will list the file and line number of the offending code, as well as the info about why that line of code is incompatible with the chosen version of PHP. The plugin will also suggest updates to themes and plugins, as a new version may offer compatible code.', 'php-compatibility-checker' ); ?></p>
250
+ <p><b><?php esc_attr_e( 'This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.', 'php-compatibility-checker' ); ?></b></p>
251
+
252
+
253
+ <p><?php printf( __( 'Please note that linting code is not perfect. This plugin cannot detect unused code paths that might be used for backwards compatibility, and thus might show false positives. You can <a href="%1$s">report false positives on our GitHub repo</a>.', 'php-compatibility-checker' ), 'https://github.com/wpengine/phpcompat/wiki/Results' ); ?></p>
254
+
255
+ <p><?php printf( __( 'This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site&#39s WP-Cron is not running correctly. Please <a href="%1$s">see the FAQ</a> for more information.', 'php-compatibility-checker' ), 'https://wordpress.org/plugins/php-compatibility-checker/faq/' ); ?></p>
256
+ </div>
257
+ <hr>
258
  <h3 class="title clear"><?php esc_attr_e( 'Scan Options', 'php-compatibility-checker' ); ?></h3>
259
  <table class="form-table">
260
  <tbody>
276
  </tr>
277
  </tbody>
278
  </table>
279
+ <hr />
280
  <p>
281
  <div style="display: none;" id="wpe-progress">
282
  <label for=""><?php esc_attr_e( 'Progress', 'php-compatibility-checker' ); ?></label>
295
  </div>
296
 
297
  <div id="footer" style="display: none;">
298
+ <?php esc_attr_e( 'Note: PHP Warnings will not cause errors, but could cause compatibility issues with future PHP versions, and could spam your PHP logs.', 'php-compatibility-checker' ); ?><br>
299
  <a id="downloadReport" href="#"><?php esc_attr_e( 'Download Report', 'php-compatibility-checker' ); ?></a>
300
  </div>
301
  </p>
313
  </div>
314
  <div class="inner-right">
315
  <h3 style="margin: 0px;">{{plugin_name}}</h3>
316
+ {{#if skipped}}<?php esc_attr_e( 'Unknown', 'php-compatibility-checker' ); ?>{{else if passed}}PHP {{test_version}} <?php esc_attr_e( 'compatible', 'php-compatibility-checker' ); ?>.{{else}}<b><?php esc_attr_e( 'Possibly not', 'php-compatibility-checker' ); ?></b> PHP {{test_version}} <?php esc_attr_e( 'compatible', 'php-compatibility-checker' ); ?>.{{/if}}<br>
317
  {{update}}<br>
318
  <textarea style="display: none; white-space: pre;">{{logs}}</textarea><a class="view-details"><?php esc_attr_e( 'view details', 'php-compatibility-checker' ); ?></a>
319
  </div>