PHP Compatibility Checker - Version 1.5.2

Version Description

  • Removed PHP 5.2 checks
  • Fixed PHP 8 issue where plugin cannot cannot be uninstalled.
Download this release

Release Info

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

Code changes from version 1.5.0 to 1.5.2

Files changed (162) hide show
  1. .github/CODEOWNERS +2 -0
  2. load-files.php +1 -8
  3. readme.txt +12 -5
  4. src/wpephpcompat.php +2 -0
  5. uninstall.php +18 -3
  6. vendor/autoload.php +1 -1
  7. vendor/composer/ClassLoader.php +142 -15
  8. vendor/composer/InstalledVersions.php +337 -0
  9. vendor/composer/autoload_classmap.php +2 -0
  10. vendor/composer/autoload_real.php +11 -6
  11. vendor/composer/autoload_static.php +6 -4
  12. vendor/composer/installed.json +342 -312
  13. vendor/composer/installed.php +68 -0
  14. vendor/composer/platform_check.php +26 -0
  15. vendor/dealerdirect/phpcodesniffer-composer-installer/.remarkrc +6 -0
  16. vendor/dealerdirect/phpcodesniffer-composer-installer/.yamllint +6 -0
  17. vendor/dealerdirect/phpcodesniffer-composer-installer/CODE_OF_CONDUCT.md +129 -0
  18. vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md +1 -1
  19. vendor/dealerdirect/phpcodesniffer-composer-installer/README.md +57 -27
  20. vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php +264 -85
  21. vendor/phpcompatibility/php-compatibility/CHANGELOG.md +914 -445
  22. vendor/phpcompatibility/php-compatibility/PHPCSAliases.php +14 -14
  23. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php +27 -12
  24. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php +42 -26
  25. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php +19 -12
  26. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php +23 -15
  27. vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php +20 -13
  28. vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php +172 -67
  29. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php +689 -264
  30. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php +3 -3
  31. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewAnonymousClassesSniff.php +16 -12
  32. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php +80 -14
  33. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php +13 -11
  34. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewLateStaticBindingSniff.php +19 -10
  35. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php +8 -1
  36. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php +3 -3
  37. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php +110 -10
  38. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewMagicClassConstantSniff.php +17 -12
  39. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/RemovedConstantsSniff.php +36 -9
  40. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/DiscouragedSwitchContinueSniff.php +26 -11
  41. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueOutsideLoopSniff.php +19 -12
  42. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php +21 -12
  43. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php +14 -12
  44. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php +53 -9
  45. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php +15 -12
  46. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php +15 -10
  47. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewMultiCatchSniff.php +14 -11
  48. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Extensions/RemovedExtensionsSniff.php +41 -12
  49. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php +14 -14
  50. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php +15 -13
  51. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php +6 -4
  52. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php +16 -12
  53. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php +39 -12
  54. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php +83 -12
  55. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php +20 -13
  56. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php +51 -9
  57. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php +33 -12
  58. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php +50 -12
  59. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php +47 -10
  60. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php +23 -11
  61. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php +21 -12
  62. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php +35 -12
  63. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php +71 -10
  64. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php +21 -5
  65. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php +18 -13
  66. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php +32 -9
  67. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php +59 -15
  68. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php +22 -8
  69. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php +83 -10
  70. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php +74 -8
  71. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php +34 -8
  72. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php +17 -12
  73. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/NewIniDirectivesSniff.php +202 -10
  74. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/RemovedIniDirectivesSniff.php +38 -12
  75. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingConstSniff.php +16 -12
  76. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php +16 -12
  77. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php +34 -12
  78. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php +20 -10
  79. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/InternalInterfacesSniff.php +19 -8
  80. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php +38 -12
  81. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php +14 -11
  82. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsDeclaredSniff.php +24 -13
  83. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php +17 -10
  84. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php +63 -12
  85. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php +35 -10
  86. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php +18 -11
  87. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php +29 -10
  88. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/AssignmentOrderSniff.php +16 -11
  89. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/ForbiddenEmptyListAssignmentSniff.php +17 -12
  90. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewKeyedListSniff.php +29 -13
  91. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewListReferenceAssignmentSniff.php +16 -9
  92. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewShortListSniff.php +17 -13
  93. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/ForbiddenToStringParametersSniff.php +6 -5
  94. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/NewDirectCallsToCloneSniff.php +23 -3
  95. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/NewPHPOpenTagEOFSniff.php +147 -0
  96. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php +20 -14
  97. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/ValidIntegersSniff.php +42 -12
  98. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ChangedConcatOperatorPrecedenceSniff.php +3 -3
  99. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php +18 -13
  100. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php +42 -19
  101. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewShortTernarySniff.php +15 -11
  102. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/RemovedTernaryAssociativitySniff.php +4 -3
  103. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php +17 -13
  104. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenStripTagsSelfClosingXHTMLSniff.php +113 -0
  105. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewArrayReduceInitialTypeSniff.php +19 -9
  106. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php +16 -9
  107. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHTMLEntitiesEncodingDefaultSniff.php +92 -0
  108. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php +26 -8
  109. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIDNVariantDefaultSniff.php +91 -0
  110. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIconvMbstringCharsetDefaultSniff.php +231 -0
  111. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php +15 -12
  112. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php +22 -10
  113. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPackFormatSniff.php +18 -9
  114. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPasswordAlgoConstantValuesSniff.php +125 -0
  115. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewProcOpenCmdArraySniff.php +136 -0
  116. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewStripTagsAllowableTagsArraySniff.php +152 -0
  117. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedHashAlgorithmsSniff.php +19 -13
  118. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php +19 -13
  119. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedImplodeFlexibleParamOrderSniff.php +323 -0
  120. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbStrrposEncodingThirdParamSniff.php +149 -0
  121. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php +24 -11
  122. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedNonCryptoHashSniff.php +19 -12
  123. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php +35 -13
  124. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php +18 -13
  125. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php +20 -14
  126. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayStringDereferencingSniff.php +118 -27
  127. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayUnpackingSniff.php +5 -0
  128. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php +121 -42
  129. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewDynamicAccessToStaticSniff.php +14 -10
  130. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php +19 -11
  131. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionArrayDereferencingSniff.php +116 -24
  132. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php +15 -10
  133. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewShortArraySniff.php +16 -13
  134. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedCurlyBraceArrayAccessSniff.php +362 -0
  135. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php +16 -13
  136. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/NewUnicodeEscapeSequenceSniff.php +162 -0
  137. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php +28 -9
  138. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/RemovedTypeCastsSniff.php +40 -9
  139. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php +45 -28
  140. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPSniff.php +182 -0
  141. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewGroupUseDeclarationsSniff.php +23 -10
  142. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php +20 -13
  143. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php +13 -12
  144. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php +12 -11
  145. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/NewUniformVariableSyntaxSniff.php +14 -11
  146. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/RemovedPredefinedGlobalVariablesSniff.php +35 -10
  147. vendor/phpcompatibility/php-compatibility/README.md +68 -30
  148. vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php +8 -1
  149. vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat/ruleset.xml +100 -4
  150. vendor/phpcompatibility/phpcompatibility-paragonie/README.md +28 -3
  151. vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml +52 -34
  152. vendor/phpcompatibility/phpcompatibility-wp/README.md +58 -35
  153. vendor/squizlabs/php_codesniffer/CodeSniffer.conf +1 -1
  154. vendor/squizlabs/php_codesniffer/CodeSniffer.php +1 -1
  155. vendor/squizlabs/php_codesniffer/CodeSniffer/File.php +2 -2
  156. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php +3 -1
  157. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/ControlSignatureSniff.php +1 -0
  158. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php +6 -0
  159. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php +1 -0
  160. vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php +2 -0
  161. vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/CSS.php +2 -2
  162. wpengine-phpcompat.php +3 -22
.github/CODEOWNERS ADDED
@@ -0,0 +1,2 @@
 
 
1
+ * @wpengine/blockheads
2
+
load-files.php CHANGED
@@ -16,14 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  */
17
  function wpephpcompat_load_files() {
18
  require_once dirname( __FILE__ ) . '/src/wpephpcompat.php';
19
-
20
- if ( version_compare( phpversion(), '5.3', '<' ) ) {
21
- $autoload_file = dirname( __FILE__ ) . '/php52/vendor/autoload_52.php';
22
- } else {
23
- $autoload_file = dirname( __FILE__ ) . '/vendor/autoload.php';
24
- }
25
-
26
- require_once $autoload_file;
27
 
28
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
29
  require_once dirname( __FILE__ ) . '/src/wpcli.php';
16
  */
17
  function wpephpcompat_load_files() {
18
  require_once dirname( __FILE__ ) . '/src/wpephpcompat.php';
19
+ require_once dirname( __FILE__ ) . '/vendor/autoload.php';
 
 
 
 
 
 
 
20
 
21
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
22
  require_once dirname( __FILE__ ) . '/src/wpcli.php';
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === PHP Compatibility Checker ===
2
- Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross, jcross
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: 5.2.2
6
- Stable tag: 1.5.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -113,6 +113,13 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
113
  2. Compatibility results screen
114
 
115
  == Changelog ==
 
 
 
 
 
 
 
116
  = 1.5.0 =
117
  - Added support for PHP 7.3 compatibility checks
118
 
1
  === PHP Compatibility Checker ===
2
+ Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross, jcross, rfmeier
3
+ Tags: php 7, php, version, compatibility, checker, wp engine, wpe, wpengine
4
+ Requires at least: 4.8
5
+ Tested up to: 5.8
6
+ Stable tag: 1.5.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
113
  2. Compatibility results screen
114
 
115
  == Changelog ==
116
+ = 1.5.2 =
117
+ - Removed PHP 5.2 checks
118
+ - Fixed PHP 8 issue where plugin cannot cannot be uninstalled.
119
+
120
+ = 1.5.1 =
121
+ - Added Smart Plugin Manager to whitelisted plugins
122
+
123
  = 1.5.0 =
124
  - Added support for PHP 7.3 compatibility checks
125
 
src/wpephpcompat.php CHANGED
@@ -69,6 +69,7 @@ class WPEPHPCompat {
69
  * @var array
70
  */
71
  public $whitelist = array(
 
72
  '*/jetpack/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#jetpack
73
  '*/wordfence/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#wordfence-security
74
  '*/woocommerce/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#woocommerce
@@ -393,6 +394,7 @@ class WPEPHPCompat {
393
  foreach ( $all_themes as $k => $v ) {
394
  if ( 'yes' === $this->only_active ) {
395
  $current_theme = wp_get_theme();
 
396
  if ( $all_themes[ $k ]->Name !== $current_theme->Name ) {
397
  continue;
398
  }
69
  * @var array
70
  */
71
  public $whitelist = array(
72
+ '*/autoupdater/*' => '7.0', // WP Engine Smart Plugin Manager uses a php5 package to maintain backwards compatibility.
73
  '*/jetpack/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#jetpack
74
  '*/wordfence/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#wordfence-security
75
  '*/woocommerce/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#woocommerce
394
  foreach ( $all_themes as $k => $v ) {
395
  if ( 'yes' === $this->only_active ) {
396
  $current_theme = wp_get_theme();
397
+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
398
  if ( $all_themes[ $k ]->Name !== $current_theme->Name ) {
399
  continue;
400
  }
uninstall.php CHANGED
@@ -11,8 +11,23 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
11
  die;
12
  }
13
 
14
- require_once dirname( __FILE__ ) . '/load-files.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- $wpephpc = new WPEPHPCompat( dirname( __FILE__ ) );
17
- $wpephpc->clean_after_scan();
18
  delete_option( 'wpephpcompat.scan_results' );
11
  die;
12
  }
13
 
14
+ delete_option( 'wpephpcompat.lock' );
15
+ delete_option( 'wpephpcompat.status' );
16
+ delete_option( 'wpephpcompat.numdirs' );
17
+
18
+ // Clear scheduled cron.
19
+ wp_clear_scheduled_hook( 'wpephpcompat_start_test_cron' );
20
+
21
+ // Make sure all directories are removed from the queue.
22
+ $args = array(
23
+ 'posts_per_page' => -1,
24
+ 'post_type' => 'wpephpcompat_jobs',
25
+ );
26
+
27
+ $directories = get_posts( $args );
28
+
29
+ foreach ( $directories as $directory ) {
30
+ wp_delete_post( $directory->ID );
31
+ }
32
 
 
 
33
  delete_option( 'wpephpcompat.scan_results' );
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit286b3d04f78898a763ebc0336108fffb::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8f5b441c1f931c6c7e2b62db37632505::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -37,57 +37,130 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
 
45
  // PSR-4
 
 
 
 
46
  private $prefixLengthsPsr4 = array();
 
 
 
 
47
  private $prefixDirsPsr4 = array();
 
 
 
 
48
  private $fallbackDirsPsr4 = array();
49
 
50
  // PSR-0
 
 
 
 
51
  private $prefixesPsr0 = array();
 
 
 
 
52
  private $fallbackDirsPsr0 = array();
53
 
 
54
  private $useIncludePath = false;
 
 
 
 
 
55
  private $classMap = array();
 
 
56
  private $classMapAuthoritative = false;
 
 
 
 
 
57
  private $missingClasses = array();
 
 
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
- return call_user_func_array('array_merge', $this->prefixesPsr0);
64
  }
65
 
66
  return array();
67
  }
68
 
 
 
 
 
69
  public function getPrefixesPsr4()
70
  {
71
  return $this->prefixDirsPsr4;
72
  }
73
 
 
 
 
 
74
  public function getFallbackDirs()
75
  {
76
  return $this->fallbackDirsPsr0;
77
  }
78
 
 
 
 
 
79
  public function getFallbackDirsPsr4()
80
  {
81
  return $this->fallbackDirsPsr4;
82
  }
83
 
 
 
 
 
84
  public function getClassMap()
85
  {
86
  return $this->classMap;
87
  }
88
 
89
  /**
90
- * @param array $classMap Class to filename map
 
 
 
91
  */
92
  public function addClassMap(array $classMap)
93
  {
@@ -102,9 +175,11 @@ class ClassLoader
102
  * Registers a set of PSR-0 directories for a given prefix, either
103
  * appending or prepending to the ones previously set for this prefix.
104
  *
105
- * @param string $prefix The prefix
106
- * @param array|string $paths The PSR-0 root directories
107
- * @param bool $prepend Whether to prepend the directories
 
 
108
  */
109
  public function add($prefix, $paths, $prepend = false)
110
  {
@@ -147,11 +222,13 @@ class ClassLoader
147
  * Registers a set of PSR-4 directories for a given namespace, either
148
  * appending or prepending to the ones previously set for this namespace.
149
  *
150
- * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
- * @param bool $prepend Whether to prepend the directories
153
  *
154
  * @throws \InvalidArgumentException
 
 
155
  */
156
  public function addPsr4($prefix, $paths, $prepend = false)
157
  {
@@ -195,8 +272,10 @@ class ClassLoader
195
  * Registers a set of PSR-0 directories for a given prefix,
196
  * replacing any others previously set for this prefix.
197
  *
198
- * @param string $prefix The prefix
199
- * @param array|string $paths The PSR-0 base directories
 
 
200
  */
201
  public function set($prefix, $paths)
202
  {
@@ -211,10 +290,12 @@ class ClassLoader
211
  * Registers a set of PSR-4 directories for a given namespace,
212
  * replacing any others previously set for this namespace.
213
  *
214
- * @param string $prefix The prefix/namespace, with trailing '\\'
215
- * @param array|string $paths The PSR-4 base directories
216
  *
217
  * @throws \InvalidArgumentException
 
 
218
  */
219
  public function setPsr4($prefix, $paths)
220
  {
@@ -234,6 +315,8 @@ class ClassLoader
234
  * Turns on searching the include path for class files.
235
  *
236
  * @param bool $useIncludePath
 
 
237
  */
238
  public function setUseIncludePath($useIncludePath)
239
  {
@@ -256,6 +339,8 @@ class ClassLoader
256
  * that have not been registered with the class map.
257
  *
258
  * @param bool $classMapAuthoritative
 
 
259
  */
260
  public function setClassMapAuthoritative($classMapAuthoritative)
261
  {
@@ -276,6 +361,8 @@ class ClassLoader
276
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
  *
278
  * @param string|null $apcuPrefix
 
 
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
@@ -296,25 +383,44 @@ class ClassLoader
296
  * Registers this instance as an autoloader.
297
  *
298
  * @param bool $prepend Whether to prepend the autoloader or not
 
 
299
  */
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
306
  * Unregisters this instance as an autoloader.
 
 
307
  */
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
314
  * Loads the given class or interface.
315
  *
316
  * @param string $class The name of the class
317
- * @return bool|null True if loaded, null otherwise
318
  */
319
  public function loadClass($class)
320
  {
@@ -323,6 +429,8 @@ class ClassLoader
323
 
324
  return true;
325
  }
 
 
326
  }
327
 
328
  /**
@@ -367,6 +475,21 @@ class ClassLoader
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
@@ -438,6 +561,10 @@ class ClassLoader
438
  * Scope isolated include.
439
  *
440
  * Prevents access to $this/self from included files.
 
 
 
 
441
  */
442
  function includeFile($file)
443
  {
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
+ /** @var ?string */
46
+ private $vendorDir;
47
+
48
  // PSR-4
49
+ /**
50
+ * @var array[]
51
+ * @psalm-var array<string, array<string, int>>
52
+ */
53
  private $prefixLengthsPsr4 = array();
54
+ /**
55
+ * @var array[]
56
+ * @psalm-var array<string, array<int, string>>
57
+ */
58
  private $prefixDirsPsr4 = array();
59
+ /**
60
+ * @var array[]
61
+ * @psalm-var array<string, string>
62
+ */
63
  private $fallbackDirsPsr4 = array();
64
 
65
  // PSR-0
66
+ /**
67
+ * @var array[]
68
+ * @psalm-var array<string, array<string, string[]>>
69
+ */
70
  private $prefixesPsr0 = array();
71
+ /**
72
+ * @var array[]
73
+ * @psalm-var array<string, string>
74
+ */
75
  private $fallbackDirsPsr0 = array();
76
 
77
+ /** @var bool */
78
  private $useIncludePath = false;
79
+
80
+ /**
81
+ * @var string[]
82
+ * @psalm-var array<string, string>
83
+ */
84
  private $classMap = array();
85
+
86
+ /** @var bool */
87
  private $classMapAuthoritative = false;
88
+
89
+ /**
90
+ * @var bool[]
91
+ * @psalm-var array<string, bool>
92
+ */
93
  private $missingClasses = array();
94
+
95
+ /** @var ?string */
96
  private $apcuPrefix;
97
 
98
+ /**
99
+ * @var self[]
100
+ */
101
+ private static $registeredLoaders = array();
102
+
103
+ /**
104
+ * @param ?string $vendorDir
105
+ */
106
+ public function __construct($vendorDir = null)
107
+ {
108
+ $this->vendorDir = $vendorDir;
109
+ }
110
+
111
+ /**
112
+ * @return string[]
113
+ */
114
  public function getPrefixes()
115
  {
116
  if (!empty($this->prefixesPsr0)) {
117
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118
  }
119
 
120
  return array();
121
  }
122
 
123
+ /**
124
+ * @return array[]
125
+ * @psalm-return array<string, array<int, string>>
126
+ */
127
  public function getPrefixesPsr4()
128
  {
129
  return $this->prefixDirsPsr4;
130
  }
131
 
132
+ /**
133
+ * @return array[]
134
+ * @psalm-return array<string, string>
135
+ */
136
  public function getFallbackDirs()
137
  {
138
  return $this->fallbackDirsPsr0;
139
  }
140
 
141
+ /**
142
+ * @return array[]
143
+ * @psalm-return array<string, string>
144
+ */
145
  public function getFallbackDirsPsr4()
146
  {
147
  return $this->fallbackDirsPsr4;
148
  }
149
 
150
+ /**
151
+ * @return string[] Array of classname => path
152
+ * @psalm-var array<string, string>
153
+ */
154
  public function getClassMap()
155
  {
156
  return $this->classMap;
157
  }
158
 
159
  /**
160
+ * @param string[] $classMap Class to filename map
161
+ * @psalm-param array<string, string> $classMap
162
+ *
163
+ * @return void
164
  */
165
  public function addClassMap(array $classMap)
166
  {
175
  * Registers a set of PSR-0 directories for a given prefix, either
176
  * appending or prepending to the ones previously set for this prefix.
177
  *
178
+ * @param string $prefix The prefix
179
+ * @param string[]|string $paths The PSR-0 root directories
180
+ * @param bool $prepend Whether to prepend the directories
181
+ *
182
+ * @return void
183
  */
184
  public function add($prefix, $paths, $prepend = false)
185
  {
222
  * Registers a set of PSR-4 directories for a given namespace, either
223
  * appending or prepending to the ones previously set for this namespace.
224
  *
225
+ * @param string $prefix The prefix/namespace, with trailing '\\'
226
+ * @param string[]|string $paths The PSR-4 base directories
227
+ * @param bool $prepend Whether to prepend the directories
228
  *
229
  * @throws \InvalidArgumentException
230
+ *
231
+ * @return void
232
  */
233
  public function addPsr4($prefix, $paths, $prepend = false)
234
  {
272
  * Registers a set of PSR-0 directories for a given prefix,
273
  * replacing any others previously set for this prefix.
274
  *
275
+ * @param string $prefix The prefix
276
+ * @param string[]|string $paths The PSR-0 base directories
277
+ *
278
+ * @return void
279
  */
280
  public function set($prefix, $paths)
281
  {
290
  * Registers a set of PSR-4 directories for a given namespace,
291
  * replacing any others previously set for this namespace.
292
  *
293
+ * @param string $prefix The prefix/namespace, with trailing '\\'
294
+ * @param string[]|string $paths The PSR-4 base directories
295
  *
296
  * @throws \InvalidArgumentException
297
+ *
298
+ * @return void
299
  */
300
  public function setPsr4($prefix, $paths)
301
  {
315
  * Turns on searching the include path for class files.
316
  *
317
  * @param bool $useIncludePath
318
+ *
319
+ * @return void
320
  */
321
  public function setUseIncludePath($useIncludePath)
322
  {
339
  * that have not been registered with the class map.
340
  *
341
  * @param bool $classMapAuthoritative
342
+ *
343
+ * @return void
344
  */
345
  public function setClassMapAuthoritative($classMapAuthoritative)
346
  {
361
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
  *
363
  * @param string|null $apcuPrefix
364
+ *
365
+ * @return void
366
  */
367
  public function setApcuPrefix($apcuPrefix)
368
  {
383
  * Registers this instance as an autoloader.
384
  *
385
  * @param bool $prepend Whether to prepend the autoloader or not
386
+ *
387
+ * @return void
388
  */
389
  public function register($prepend = false)
390
  {
391
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
+
393
+ if (null === $this->vendorDir) {
394
+ return;
395
+ }
396
+
397
+ if ($prepend) {
398
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
+ } else {
400
+ unset(self::$registeredLoaders[$this->vendorDir]);
401
+ self::$registeredLoaders[$this->vendorDir] = $this;
402
+ }
403
  }
404
 
405
  /**
406
  * Unregisters this instance as an autoloader.
407
+ *
408
+ * @return void
409
  */
410
  public function unregister()
411
  {
412
  spl_autoload_unregister(array($this, 'loadClass'));
413
+
414
+ if (null !== $this->vendorDir) {
415
+ unset(self::$registeredLoaders[$this->vendorDir]);
416
+ }
417
  }
418
 
419
  /**
420
  * Loads the given class or interface.
421
  *
422
  * @param string $class The name of the class
423
+ * @return true|null True if loaded, null otherwise
424
  */
425
  public function loadClass($class)
426
  {
429
 
430
  return true;
431
  }
432
+
433
+ return null;
434
  }
435
 
436
  /**
475
  return $file;
476
  }
477
 
478
+ /**
479
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
+ *
481
+ * @return self[]
482
+ */
483
+ public static function getRegisteredLoaders()
484
+ {
485
+ return self::$registeredLoaders;
486
+ }
487
+
488
+ /**
489
+ * @param string $class
490
+ * @param string $ext
491
+ * @return string|false
492
+ */
493
  private function findFileWithExtension($class, $ext)
494
  {
495
  // PSR-4 lookup
561
  * Scope isolated include.
562
  *
563
  * Prevents access to $this/self from included files.
564
+ *
565
+ * @param string $file
566
+ * @return void
567
+ * @private
568
  */
569
  function includeFile($file)
570
  {
vendor/composer/InstalledVersions.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer;
14
+
15
+ use Composer\Autoload\ClassLoader;
16
+ use Composer\Semver\VersionParser;
17
+
18
+ /**
19
+ * This class is copied in every Composer installed project and available to all
20
+ *
21
+ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
22
+ *
23
+ * To require its presence, you can require `composer-runtime-api ^2.0`
24
+ */
25
+ class InstalledVersions
26
+ {
27
+ private static $installed;
28
+ private static $canGetVendors;
29
+ private static $installedByVendor = array();
30
+
31
+ /**
32
+ * Returns a list of all package names which are present, either by being installed, replaced or provided
33
+ *
34
+ * @return string[]
35
+ * @psalm-return list<string>
36
+ */
37
+ public static function getInstalledPackages()
38
+ {
39
+ $packages = array();
40
+ foreach (self::getInstalled() as $installed) {
41
+ $packages[] = array_keys($installed['versions']);
42
+ }
43
+
44
+ if (1 === \count($packages)) {
45
+ return $packages[0];
46
+ }
47
+
48
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
49
+ }
50
+
51
+ /**
52
+ * Returns a list of all package names with a specific type e.g. 'library'
53
+ *
54
+ * @param string $type
55
+ * @return string[]
56
+ * @psalm-return list<string>
57
+ */
58
+ public static function getInstalledPackagesByType($type)
59
+ {
60
+ $packagesByType = array();
61
+
62
+ foreach (self::getInstalled() as $installed) {
63
+ foreach ($installed['versions'] as $name => $package) {
64
+ if (isset($package['type']) && $package['type'] === $type) {
65
+ $packagesByType[] = $name;
66
+ }
67
+ }
68
+ }
69
+
70
+ return $packagesByType;
71
+ }
72
+
73
+ /**
74
+ * Checks whether the given package is installed
75
+ *
76
+ * This also returns true if the package name is provided or replaced by another package
77
+ *
78
+ * @param string $packageName
79
+ * @param bool $includeDevRequirements
80
+ * @return bool
81
+ */
82
+ public static function isInstalled($packageName, $includeDevRequirements = true)
83
+ {
84
+ foreach (self::getInstalled() as $installed) {
85
+ if (isset($installed['versions'][$packageName])) {
86
+ return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
87
+ }
88
+ }
89
+
90
+ return false;
91
+ }
92
+
93
+ /**
94
+ * Checks whether the given package satisfies a version constraint
95
+ *
96
+ * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
97
+ *
98
+ * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
99
+ *
100
+ * @param VersionParser $parser Install composer/semver to have access to this class and functionality
101
+ * @param string $packageName
102
+ * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
103
+ * @return bool
104
+ */
105
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
106
+ {
107
+ $constraint = $parser->parseConstraints($constraint);
108
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
109
+
110
+ return $provided->matches($constraint);
111
+ }
112
+
113
+ /**
114
+ * Returns a version constraint representing all the range(s) which are installed for a given package
115
+ *
116
+ * It is easier to use this via isInstalled() with the $constraint argument if you need to check
117
+ * whether a given version of a package is installed, and not just whether it exists
118
+ *
119
+ * @param string $packageName
120
+ * @return string Version constraint usable with composer/semver
121
+ */
122
+ public static function getVersionRanges($packageName)
123
+ {
124
+ foreach (self::getInstalled() as $installed) {
125
+ if (!isset($installed['versions'][$packageName])) {
126
+ continue;
127
+ }
128
+
129
+ $ranges = array();
130
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
131
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
132
+ }
133
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
134
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
135
+ }
136
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
137
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
138
+ }
139
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
140
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
141
+ }
142
+
143
+ return implode(' || ', $ranges);
144
+ }
145
+
146
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
147
+ }
148
+
149
+ /**
150
+ * @param string $packageName
151
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
152
+ */
153
+ public static function getVersion($packageName)
154
+ {
155
+ foreach (self::getInstalled() as $installed) {
156
+ if (!isset($installed['versions'][$packageName])) {
157
+ continue;
158
+ }
159
+
160
+ if (!isset($installed['versions'][$packageName]['version'])) {
161
+ return null;
162
+ }
163
+
164
+ return $installed['versions'][$packageName]['version'];
165
+ }
166
+
167
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
168
+ }
169
+
170
+ /**
171
+ * @param string $packageName
172
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
173
+ */
174
+ public static function getPrettyVersion($packageName)
175
+ {
176
+ foreach (self::getInstalled() as $installed) {
177
+ if (!isset($installed['versions'][$packageName])) {
178
+ continue;
179
+ }
180
+
181
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
182
+ return null;
183
+ }
184
+
185
+ return $installed['versions'][$packageName]['pretty_version'];
186
+ }
187
+
188
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
189
+ }
190
+
191
+ /**
192
+ * @param string $packageName
193
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
194
+ */
195
+ public static function getReference($packageName)
196
+ {
197
+ foreach (self::getInstalled() as $installed) {
198
+ if (!isset($installed['versions'][$packageName])) {
199
+ continue;
200
+ }
201
+
202
+ if (!isset($installed['versions'][$packageName]['reference'])) {
203
+ return null;
204
+ }
205
+
206
+ return $installed['versions'][$packageName]['reference'];
207
+ }
208
+
209
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
210
+ }
211
+
212
+ /**
213
+ * @param string $packageName
214
+ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
215
+ */
216
+ public static function getInstallPath($packageName)
217
+ {
218
+ foreach (self::getInstalled() as $installed) {
219
+ if (!isset($installed['versions'][$packageName])) {
220
+ continue;
221
+ }
222
+
223
+ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
224
+ }
225
+
226
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
227
+ }
228
+
229
+ /**
230
+ * @return array
231
+ * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
232
+ */
233
+ public static function getRootPackage()
234
+ {
235
+ $installed = self::getInstalled();
236
+
237
+ return $installed[0]['root'];
238
+ }
239
+
240
+ /**
241
+ * Returns the raw installed.php data for custom implementations
242
+ *
243
+ * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
244
+ * @return array[]
245
+ * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
246
+ */
247
+ public static function getRawData()
248
+ {
249
+ @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
250
+
251
+ if (null === self::$installed) {
252
+ // only require the installed.php file if this file is loaded from its dumped location,
253
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
254
+ if (substr(__DIR__, -8, 1) !== 'C') {
255
+ self::$installed = include __DIR__ . '/installed.php';
256
+ } else {
257
+ self::$installed = array();
258
+ }
259
+ }
260
+
261
+ return self::$installed;
262
+ }
263
+
264
+ /**
265
+ * Returns the raw data of all installed.php which are currently loaded for custom implementations
266
+ *
267
+ * @return array[]
268
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
269
+ */
270
+ public static function getAllRawData()
271
+ {
272
+ return self::getInstalled();
273
+ }
274
+
275
+ /**
276
+ * Lets you reload the static array from another file
277
+ *
278
+ * This is only useful for complex integrations in which a project needs to use
279
+ * this class but then also needs to execute another project's autoloader in process,
280
+ * and wants to ensure both projects have access to their version of installed.php.
281
+ *
282
+ * A typical case would be PHPUnit, where it would need to make sure it reads all
283
+ * the data it needs from this class, then call reload() with
284
+ * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
285
+ * the project in which it runs can then also use this class safely, without
286
+ * interference between PHPUnit's dependencies and the project's dependencies.
287
+ *
288
+ * @param array[] $data A vendor/composer/installed.php data set
289
+ * @return void
290
+ *
291
+ * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
292
+ */
293
+ public static function reload($data)
294
+ {
295
+ self::$installed = $data;
296
+ self::$installedByVendor = array();
297
+ }
298
+
299
+ /**
300
+ * @return array[]
301
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
302
+ */
303
+ private static function getInstalled()
304
+ {
305
+ if (null === self::$canGetVendors) {
306
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
307
+ }
308
+
309
+ $installed = array();
310
+
311
+ if (self::$canGetVendors) {
312
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
313
+ if (isset(self::$installedByVendor[$vendorDir])) {
314
+ $installed[] = self::$installedByVendor[$vendorDir];
315
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
316
+ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
317
+ if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
318
+ self::$installed = $installed[count($installed) - 1];
319
+ }
320
+ }
321
+ }
322
+ }
323
+
324
+ if (null === self::$installed) {
325
+ // only require the installed.php file if this file is loaded from its dumped location,
326
+ // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
327
+ if (substr(__DIR__, -8, 1) !== 'C') {
328
+ self::$installed = require __DIR__ . '/installed.php';
329
+ } else {
330
+ self::$installed = array();
331
+ }
332
+ }
333
+ $installed[] = self::$installed;
334
+
335
+ return $installed;
336
+ }
337
+ }
vendor/composer/autoload_classmap.php CHANGED
@@ -6,6 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
 
9
  'Generic_Sniffs_Arrays_DisallowLongArraySyntaxSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php',
10
  'Generic_Sniffs_Arrays_DisallowShortArraySyntaxSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php',
11
  'Generic_Sniffs_Classes_DuplicateClassNameSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php',
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
+ 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin' => $vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php',
11
  'Generic_Sniffs_Arrays_DisallowLongArraySyntaxSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php',
12
  'Generic_Sniffs_Arrays_DisallowShortArraySyntaxSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php',
13
  'Generic_Sniffs_Classes_DuplicateClassNameSniff' => $vendorDir . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit286b3d04f78898a763ebc0336108fffb
6
  {
7
  private static $loader;
8
 
@@ -13,21 +13,26 @@ class ComposerAutoloaderInit286b3d04f78898a763ebc0336108fffb
13
  }
14
  }
15
 
 
 
 
16
  public static function getLoader()
17
  {
18
  if (null !== self::$loader) {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit286b3d04f78898a763ebc0336108fffb', 'loadClassLoader'), true, true);
23
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit286b3d04f78898a763ebc0336108fffb', 'loadClassLoader'));
 
 
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
- require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit286b3d04f78898a763ebc0336108fffb::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit8f5b441c1f931c6c7e2b62db37632505
6
  {
7
  private static $loader;
8
 
13
  }
14
  }
15
 
16
+ /**
17
+ * @return \Composer\Autoload\ClassLoader
18
+ */
19
  public static function getLoader()
20
  {
21
  if (null !== self::$loader) {
22
  return self::$loader;
23
  }
24
 
25
+ require __DIR__ . '/platform_check.php';
26
+
27
+ spl_autoload_register(array('ComposerAutoloaderInit8f5b441c1f931c6c7e2b62db37632505', 'loadClassLoader'), true, true);
28
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit8f5b441c1f931c6c7e2b62db37632505', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
+ require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit8f5b441c1f931c6c7e2b62db37632505::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit286b3d04f78898a763ebc0336108fffb
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'D' =>
@@ -21,6 +21,8 @@ class ComposerStaticInit286b3d04f78898a763ebc0336108fffb
21
  );
22
 
23
  public static $classMap = array (
 
 
24
  'Generic_Sniffs_Arrays_DisallowLongArraySyntaxSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php',
25
  'Generic_Sniffs_Arrays_DisallowShortArraySyntaxSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php',
26
  'Generic_Sniffs_Classes_DuplicateClassNameSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php',
@@ -278,9 +280,9 @@ class ComposerStaticInit286b3d04f78898a763ebc0336108fffb
278
  public static function getInitializer(ClassLoader $loader)
279
  {
280
  return \Closure::bind(function () use ($loader) {
281
- $loader->prefixLengthsPsr4 = ComposerStaticInit286b3d04f78898a763ebc0336108fffb::$prefixLengthsPsr4;
282
- $loader->prefixDirsPsr4 = ComposerStaticInit286b3d04f78898a763ebc0336108fffb::$prefixDirsPsr4;
283
- $loader->classMap = ComposerStaticInit286b3d04f78898a763ebc0336108fffb::$classMap;
284
 
285
  }, null, ClassLoader::class);
286
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit8f5b441c1f931c6c7e2b62db37632505
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'D' =>
21
  );
22
 
23
  public static $classMap = array (
24
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25
+ 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin' => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php',
26
  'Generic_Sniffs_Arrays_DisallowLongArraySyntaxSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php',
27
  'Generic_Sniffs_Arrays_DisallowShortArraySyntaxSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php',
28
  'Generic_Sniffs_Classes_DuplicateClassNameSniff' => __DIR__ . '/..' . '/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php',
280
  public static function getInitializer(ClassLoader $loader)
281
  {
282
  return \Closure::bind(function () use ($loader) {
283
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8f5b441c1f931c6c7e2b62db37632505::$prefixLengthsPsr4;
284
+ $loader->prefixDirsPsr4 = ComposerStaticInit8f5b441c1f931c6c7e2b62db37632505::$prefixDirsPsr4;
285
+ $loader->classMap = ComposerStaticInit8f5b441c1f931c6c7e2b62db37632505::$classMap;
286
 
287
  }, null, ClassLoader::class);
288
  }
vendor/composer/installed.json CHANGED
@@ -1,316 +1,346 @@
1
- [
2
- {
3
- "name": "dealerdirect/phpcodesniffer-composer-installer",
4
- "version": "v0.4.4",
5
- "version_normalized": "0.4.4.0",
6
- "source": {
7
- "type": "git",
8
- "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
9
- "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08"
10
- },
11
- "dist": {
12
- "type": "zip",
13
- "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08",
14
- "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08",
15
- "shasum": ""
16
- },
17
- "require": {
18
- "composer-plugin-api": "^1.0",
19
- "php": "^5.3|^7",
20
- "squizlabs/php_codesniffer": "*"
21
- },
22
- "require-dev": {
23
- "composer/composer": "*",
24
- "wimg/php-compatibility": "^8.0"
25
- },
26
- "suggest": {
27
- "dealerdirect/qa-tools": "All the PHP QA tools you'll need"
28
- },
29
- "time": "2017-12-06T16:27:17+00:00",
30
- "type": "composer-plugin",
31
- "extra": {
32
- "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
33
- },
34
- "installation-source": "dist",
35
- "autoload": {
36
- "psr-4": {
37
- "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
38
- }
39
- },
40
- "notification-url": "https://packagist.org/downloads/",
41
- "license": [
42
- "MIT"
43
- ],
44
- "authors": [
45
- {
46
- "name": "Franck Nijhof",
47
- "email": "f.nijhof@dealerdirect.nl",
48
- "homepage": "http://workingatdealerdirect.eu",
49
- "role": "Developer"
50
- }
51
- ],
52
- "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
53
- "homepage": "http://workingatdealerdirect.eu",
54
- "keywords": [
55
- "PHPCodeSniffer",
56
- "PHP_CodeSniffer",
57
- "code quality",
58
- "codesniffer",
59
- "composer",
60
- "installer",
61
- "phpcs",
62
- "plugin",
63
- "qa",
64
- "quality",
65
- "standard",
66
- "standards",
67
- "style guide",
68
- "stylecheck",
69
- "tests"
70
- ]
71
- },
72
- {
73
- "name": "phpcompatibility/php-compatibility",
74
- "version": "9.2.0",
75
- "version_normalized": "9.2.0.0",
76
- "source": {
77
- "type": "git",
78
- "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
79
- "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e"
80
- },
81
- "dist": {
82
- "type": "zip",
83
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
84
- "reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
85
- "shasum": ""
86
- },
87
- "require": {
88
- "php": ">=5.3",
89
- "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
90
- },
91
- "conflict": {
92
- "squizlabs/php_codesniffer": "2.6.2"
93
- },
94
- "require-dev": {
95
- "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
96
- },
97
- "suggest": {
98
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
99
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
100
- },
101
- "time": "2019-06-27T19:58:56+00:00",
102
- "type": "phpcodesniffer-standard",
103
- "installation-source": "dist",
104
- "notification-url": "https://packagist.org/downloads/",
105
- "license": [
106
- "LGPL-3.0-or-later"
107
- ],
108
- "authors": [
109
- {
110
- "name": "Contributors",
111
- "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
112
- },
113
- {
114
- "name": "Wim Godden",
115
- "homepage": "https://github.com/wimg",
116
- "role": "lead"
117
- },
118
- {
119
- "name": "Juliette Reinders Folmer",
120
- "homepage": "https://github.com/jrfnl",
121
- "role": "lead"
122
- }
123
- ],
124
- "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
125
- "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
126
- "keywords": [
127
- "compatibility",
128
- "phpcs",
129
- "standards"
130
- ]
131
- },
132
- {
133
- "name": "phpcompatibility/phpcompatibility-paragonie",
134
- "version": "1.0.1",
135
- "version_normalized": "1.0.1.0",
136
- "source": {
137
- "type": "git",
138
- "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
139
- "reference": "9160de79fcd683b5c99e9c4133728d91529753ea"
140
- },
141
- "dist": {
142
- "type": "zip",
143
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/9160de79fcd683b5c99e9c4133728d91529753ea",
144
- "reference": "9160de79fcd683b5c99e9c4133728d91529753ea",
145
- "shasum": ""
146
- },
147
- "require": {
148
- "phpcompatibility/php-compatibility": "^9.0"
149
- },
150
- "require-dev": {
151
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
152
- },
153
- "suggest": {
154
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
155
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
156
- },
157
- "time": "2018-12-16T19:10:44+00:00",
158
- "type": "phpcodesniffer-standard",
159
- "installation-source": "dist",
160
- "notification-url": "https://packagist.org/downloads/",
161
- "license": [
162
- "LGPL-3.0-or-later"
163
- ],
164
- "authors": [
165
- {
166
- "name": "Wim Godden",
167
- "role": "lead"
168
- },
169
- {
170
- "name": "Juliette Reinders Folmer",
171
- "role": "lead"
172
- }
173
- ],
174
- "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
175
- "homepage": "http://phpcompatibility.com/",
176
- "keywords": [
177
- "compatibility",
178
- "paragonie",
179
- "phpcs",
180
- "polyfill",
181
- "standards"
182
- ]
183
- },
184
- {
185
- "name": "phpcompatibility/phpcompatibility-wp",
186
- "version": "2.0.0",
187
- "version_normalized": "2.0.0.0",
188
- "source": {
189
- "type": "git",
190
- "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
191
- "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd"
192
- },
193
- "dist": {
194
- "type": "zip",
195
- "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
196
- "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
197
- "shasum": ""
198
- },
199
- "require": {
200
- "phpcompatibility/php-compatibility": "^9.0",
201
- "phpcompatibility/phpcompatibility-paragonie": "^1.0"
202
- },
203
- "require-dev": {
204
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
205
- },
206
- "suggest": {
207
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
208
- "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
209
- },
210
- "time": "2018-10-07T18:31:37+00:00",
211
- "type": "phpcodesniffer-standard",
212
- "installation-source": "dist",
213
- "notification-url": "https://packagist.org/downloads/",
214
- "license": [
215
- "LGPL-3.0-or-later"
216
- ],
217
- "authors": [
218
- {
219
- "name": "Wim Godden",
220
- "role": "lead"
221
- },
222
- {
223
- "name": "Juliette Reinders Folmer",
224
- "role": "lead"
225
- }
226
- ],
227
- "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
228
- "homepage": "http://phpcompatibility.com/",
229
- "keywords": [
230
- "compatibility",
231
- "phpcs",
232
- "standards",
233
- "wordpress"
234
- ]
235
- },
236
- {
237
- "name": "squizlabs/php_codesniffer",
238
- "version": "2.9.2",
239
- "version_normalized": "2.9.2.0",
240
- "source": {
241
- "type": "git",
242
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
243
- "reference": "2acf168de78487db620ab4bc524135a13cfe6745"
244
- },
245
- "dist": {
246
- "type": "zip",
247
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745",
248
- "reference": "2acf168de78487db620ab4bc524135a13cfe6745",
249
- "shasum": ""
250
- },
251
- "require": {
252
- "ext-simplexml": "*",
253
- "ext-tokenizer": "*",
254
- "ext-xmlwriter": "*",
255
- "php": ">=5.1.2"
256
  },
257
- "require-dev": {
258
- "phpunit/phpunit": "~4.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  },
260
- "time": "2018-11-07T22:31:41+00:00",
261
- "bin": [
262
- "scripts/phpcs",
263
- "scripts/phpcbf"
264
- ],
265
- "type": "library",
266
- "extra": {
267
- "branch-alias": {
268
- "dev-master": "2.x-dev"
269
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  },
271
- "installation-source": "dist",
272
- "autoload": {
273
- "classmap": [
274
- "CodeSniffer.php",
275
- "CodeSniffer/CLI.php",
276
- "CodeSniffer/Exception.php",
277
- "CodeSniffer/File.php",
278
- "CodeSniffer/Fixer.php",
279
- "CodeSniffer/Report.php",
280
- "CodeSniffer/Reporting.php",
281
- "CodeSniffer/Sniff.php",
282
- "CodeSniffer/Tokens.php",
283
- "CodeSniffer/Reports/",
284
- "CodeSniffer/Tokenizers/",
285
- "CodeSniffer/DocGenerators/",
286
- "CodeSniffer/Standards/AbstractPatternSniff.php",
287
- "CodeSniffer/Standards/AbstractScopeSniff.php",
288
- "CodeSniffer/Standards/AbstractVariableSniff.php",
289
- "CodeSniffer/Standards/IncorrectPatternException.php",
290
- "CodeSniffer/Standards/Generic/Sniffs/",
291
- "CodeSniffer/Standards/MySource/Sniffs/",
292
- "CodeSniffer/Standards/PEAR/Sniffs/",
293
- "CodeSniffer/Standards/PSR1/Sniffs/",
294
- "CodeSniffer/Standards/PSR2/Sniffs/",
295
- "CodeSniffer/Standards/Squiz/Sniffs/",
296
- "CodeSniffer/Standards/Zend/Sniffs/"
297
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  },
299
- "notification-url": "https://packagist.org/downloads/",
300
- "license": [
301
- "BSD-3-Clause"
302
- ],
303
- "authors": [
304
- {
305
- "name": "Greg Sherwood",
306
- "role": "lead"
307
- }
308
- ],
309
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
310
- "homepage": "http://www.squizlabs.com/php-codesniffer",
311
- "keywords": [
312
- "phpcs",
313
- "standards"
314
- ]
315
- }
316
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
5
+ "version": "v0.7.1",
6
+ "version_normalized": "0.7.1.0",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
10
+ "reference": "fe390591e0241955f22eb9ba327d137e501c771c"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c",
15
+ "reference": "fe390591e0241955f22eb9ba327d137e501c771c",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "composer-plugin-api": "^1.0 || ^2.0",
20
+ "php": ">=5.3",
21
+ "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0"
22
+ },
23
+ "require-dev": {
24
+ "composer/composer": "*",
25
+ "phpcompatibility/php-compatibility": "^9.0",
26
+ "sensiolabs/security-checker": "^4.1.0"
27
+ },
28
+ "time": "2020-12-07T18:04:37+00:00",
29
+ "type": "composer-plugin",
30
+ "extra": {
31
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
32
+ },
33
+ "installation-source": "dist",
34
+ "autoload": {
35
+ "psr-4": {
36
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
37
+ }
38
+ },
39
+ "notification-url": "https://packagist.org/downloads/",
40
+ "license": [
41
+ "MIT"
42
+ ],
43
+ "authors": [
44
+ {
45
+ "name": "Franck Nijhof",
46
+ "email": "franck.nijhof@dealerdirect.com",
47
+ "homepage": "http://www.frenck.nl",
48
+ "role": "Developer / IT Manager"
49
+ }
50
+ ],
51
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
52
+ "homepage": "http://www.dealerdirect.com",
53
+ "keywords": [
54
+ "PHPCodeSniffer",
55
+ "PHP_CodeSniffer",
56
+ "code quality",
57
+ "codesniffer",
58
+ "composer",
59
+ "installer",
60
+ "phpcs",
61
+ "plugin",
62
+ "qa",
63
+ "quality",
64
+ "standard",
65
+ "standards",
66
+ "style guide",
67
+ "stylecheck",
68
+ "tests"
69
+ ],
70
+ "support": {
71
+ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
72
+ "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
73
+ },
74
+ "install-path": "../dealerdirect/phpcodesniffer-composer-installer"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  },
76
+ {
77
+ "name": "phpcompatibility/php-compatibility",
78
+ "version": "9.3.5",
79
+ "version_normalized": "9.3.5.0",
80
+ "source": {
81
+ "type": "git",
82
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
83
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
84
+ },
85
+ "dist": {
86
+ "type": "zip",
87
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
88
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
89
+ "shasum": ""
90
+ },
91
+ "require": {
92
+ "php": ">=5.3",
93
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
94
+ },
95
+ "conflict": {
96
+ "squizlabs/php_codesniffer": "2.6.2"
97
+ },
98
+ "require-dev": {
99
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
100
+ },
101
+ "suggest": {
102
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
103
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
104
+ },
105
+ "time": "2019-12-27T09:44:58+00:00",
106
+ "type": "phpcodesniffer-standard",
107
+ "installation-source": "dist",
108
+ "notification-url": "https://packagist.org/downloads/",
109
+ "license": [
110
+ "LGPL-3.0-or-later"
111
+ ],
112
+ "authors": [
113
+ {
114
+ "name": "Wim Godden",
115
+ "homepage": "https://github.com/wimg",
116
+ "role": "lead"
117
+ },
118
+ {
119
+ "name": "Juliette Reinders Folmer",
120
+ "homepage": "https://github.com/jrfnl",
121
+ "role": "lead"
122
+ },
123
+ {
124
+ "name": "Contributors",
125
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
126
+ }
127
+ ],
128
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
129
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
130
+ "keywords": [
131
+ "compatibility",
132
+ "phpcs",
133
+ "standards"
134
+ ],
135
+ "support": {
136
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
137
+ "source": "https://github.com/PHPCompatibility/PHPCompatibility"
138
+ },
139
+ "install-path": "../phpcompatibility/php-compatibility"
140
  },
141
+ {
142
+ "name": "phpcompatibility/phpcompatibility-paragonie",
143
+ "version": "1.3.1",
144
+ "version_normalized": "1.3.1.0",
145
+ "source": {
146
+ "type": "git",
147
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
148
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43"
149
+ },
150
+ "dist": {
151
+ "type": "zip",
152
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
153
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43",
154
+ "shasum": ""
155
+ },
156
+ "require": {
157
+ "phpcompatibility/php-compatibility": "^9.0"
158
+ },
159
+ "require-dev": {
160
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
161
+ "paragonie/random_compat": "dev-master",
162
+ "paragonie/sodium_compat": "dev-master"
163
+ },
164
+ "suggest": {
165
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
166
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
167
+ },
168
+ "time": "2021-02-15T10:24:51+00:00",
169
+ "type": "phpcodesniffer-standard",
170
+ "installation-source": "dist",
171
+ "notification-url": "https://packagist.org/downloads/",
172
+ "license": [
173
+ "LGPL-3.0-or-later"
174
+ ],
175
+ "authors": [
176
+ {
177
+ "name": "Wim Godden",
178
+ "role": "lead"
179
+ },
180
+ {
181
+ "name": "Juliette Reinders Folmer",
182
+ "role": "lead"
183
+ }
184
+ ],
185
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
186
+ "homepage": "http://phpcompatibility.com/",
187
+ "keywords": [
188
+ "compatibility",
189
+ "paragonie",
190
+ "phpcs",
191
+ "polyfill",
192
+ "standards"
193
+ ],
194
+ "support": {
195
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
196
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
197
+ },
198
+ "install-path": "../phpcompatibility/phpcompatibility-paragonie"
199
  },
200
+ {
201
+ "name": "phpcompatibility/phpcompatibility-wp",
202
+ "version": "2.1.2",
203
+ "version_normalized": "2.1.2.0",
204
+ "source": {
205
+ "type": "git",
206
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
207
+ "reference": "a792ab623069f0ce971b2417edef8d9632e32f75"
208
+ },
209
+ "dist": {
210
+ "type": "zip",
211
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/a792ab623069f0ce971b2417edef8d9632e32f75",
212
+ "reference": "a792ab623069f0ce971b2417edef8d9632e32f75",
213
+ "shasum": ""
214
+ },
215
+ "require": {
216
+ "phpcompatibility/php-compatibility": "^9.0",
217
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
218
+ },
219
+ "require-dev": {
220
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7"
221
+ },
222
+ "suggest": {
223
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
224
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
225
+ },
226
+ "time": "2021-07-21T11:09:57+00:00",
227
+ "type": "phpcodesniffer-standard",
228
+ "installation-source": "dist",
229
+ "notification-url": "https://packagist.org/downloads/",
230
+ "license": [
231
+ "LGPL-3.0-or-later"
232
+ ],
233
+ "authors": [
234
+ {
235
+ "name": "Wim Godden",
236
+ "role": "lead"
237
+ },
238
+ {
239
+ "name": "Juliette Reinders Folmer",
240
+ "role": "lead"
241
+ }
242
+ ],
243
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
244
+ "homepage": "http://phpcompatibility.com/",
245
+ "keywords": [
246
+ "compatibility",
247
+ "phpcs",
248
+ "standards",
249
+ "wordpress"
250
+ ],
251
+ "support": {
252
+ "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
253
+ "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
254
+ },
255
+ "install-path": "../phpcompatibility/phpcompatibility-wp"
256
  },
257
+ {
258
+ "name": "squizlabs/php_codesniffer",
259
+ "version": "2.9.2",
260
+ "version_normalized": "2.9.2.0",
261
+ "source": {
262
+ "type": "git",
263
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
264
+ "reference": "2acf168de78487db620ab4bc524135a13cfe6745"
265
+ },
266
+ "dist": {
267
+ "type": "zip",
268
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745",
269
+ "reference": "2acf168de78487db620ab4bc524135a13cfe6745",
270
+ "shasum": ""
271
+ },
272
+ "require": {
273
+ "ext-simplexml": "*",
274
+ "ext-tokenizer": "*",
275
+ "ext-xmlwriter": "*",
276
+ "php": ">=5.1.2"
277
+ },
278
+ "require-dev": {
279
+ "phpunit/phpunit": "~4.0"
280
+ },
281
+ "time": "2018-11-07T22:31:41+00:00",
282
+ "bin": [
283
+ "scripts/phpcs",
284
+ "scripts/phpcbf"
285
+ ],
286
+ "type": "library",
287
+ "extra": {
288
+ "branch-alias": {
289
+ "dev-master": "2.x-dev"
290
+ }
291
+ },
292
+ "installation-source": "dist",
293
+ "autoload": {
294
+ "classmap": [
295
+ "CodeSniffer.php",
296
+ "CodeSniffer/CLI.php",
297
+ "CodeSniffer/Exception.php",
298
+ "CodeSniffer/File.php",
299
+ "CodeSniffer/Fixer.php",
300
+ "CodeSniffer/Report.php",
301
+ "CodeSniffer/Reporting.php",
302
+ "CodeSniffer/Sniff.php",
303
+ "CodeSniffer/Tokens.php",
304
+ "CodeSniffer/Reports/",
305
+ "CodeSniffer/Tokenizers/",
306
+ "CodeSniffer/DocGenerators/",
307
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
308
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
309
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
310
+ "CodeSniffer/Standards/IncorrectPatternException.php",
311
+ "CodeSniffer/Standards/Generic/Sniffs/",
312
+ "CodeSniffer/Standards/MySource/Sniffs/",
313
+ "CodeSniffer/Standards/PEAR/Sniffs/",
314
+ "CodeSniffer/Standards/PSR1/Sniffs/",
315
+ "CodeSniffer/Standards/PSR2/Sniffs/",
316
+ "CodeSniffer/Standards/Squiz/Sniffs/",
317
+ "CodeSniffer/Standards/Zend/Sniffs/"
318
+ ]
319
+ },
320
+ "notification-url": "https://packagist.org/downloads/",
321
+ "license": [
322
+ "BSD-3-Clause"
323
+ ],
324
+ "authors": [
325
+ {
326
+ "name": "Greg Sherwood",
327
+ "role": "lead"
328
+ }
329
+ ],
330
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
331
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
332
+ "keywords": [
333
+ "phpcs",
334
+ "standards"
335
+ ],
336
+ "support": {
337
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
338
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer",
339
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
340
+ },
341
+ "install-path": "../squizlabs/php_codesniffer"
342
+ }
343
+ ],
344
+ "dev": false,
345
+ "dev-package-names": []
346
+ }
vendor/composer/installed.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php return array(
2
+ 'root' => array(
3
+ 'pretty_version' => 'v1.5.2',
4
+ 'version' => '1.5.2.0',
5
+ 'type' => 'wordpress-plugin',
6
+ 'install_path' => __DIR__ . '/../../',
7
+ 'aliases' => array(),
8
+ 'reference' => 'a798c26a1bad3479bce22a1f0062d59466a68b7b',
9
+ 'name' => 'wpengine/phpcompat',
10
+ 'dev' => false,
11
+ ),
12
+ 'versions' => array(
13
+ 'dealerdirect/phpcodesniffer-composer-installer' => array(
14
+ 'pretty_version' => 'v0.7.1',
15
+ 'version' => '0.7.1.0',
16
+ 'type' => 'composer-plugin',
17
+ 'install_path' => __DIR__ . '/../dealerdirect/phpcodesniffer-composer-installer',
18
+ 'aliases' => array(),
19
+ 'reference' => 'fe390591e0241955f22eb9ba327d137e501c771c',
20
+ 'dev_requirement' => false,
21
+ ),
22
+ 'phpcompatibility/php-compatibility' => array(
23
+ 'pretty_version' => '9.3.5',
24
+ 'version' => '9.3.5.0',
25
+ 'type' => 'phpcodesniffer-standard',
26
+ 'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
27
+ 'aliases' => array(),
28
+ 'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
29
+ 'dev_requirement' => false,
30
+ ),
31
+ 'phpcompatibility/phpcompatibility-paragonie' => array(
32
+ 'pretty_version' => '1.3.1',
33
+ 'version' => '1.3.1.0',
34
+ 'type' => 'phpcodesniffer-standard',
35
+ 'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
36
+ 'aliases' => array(),
37
+ 'reference' => 'ddabec839cc003651f2ce695c938686d1086cf43',
38
+ 'dev_requirement' => false,
39
+ ),
40
+ 'phpcompatibility/phpcompatibility-wp' => array(
41
+ 'pretty_version' => '2.1.2',
42
+ 'version' => '2.1.2.0',
43
+ 'type' => 'phpcodesniffer-standard',
44
+ 'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
45
+ 'aliases' => array(),
46
+ 'reference' => 'a792ab623069f0ce971b2417edef8d9632e32f75',
47
+ 'dev_requirement' => false,
48
+ ),
49
+ 'squizlabs/php_codesniffer' => array(
50
+ 'pretty_version' => '2.9.2',
51
+ 'version' => '2.9.2.0',
52
+ 'type' => 'library',
53
+ 'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
54
+ 'aliases' => array(),
55
+ 'reference' => '2acf168de78487db620ab4bc524135a13cfe6745',
56
+ 'dev_requirement' => false,
57
+ ),
58
+ 'wpengine/phpcompat' => array(
59
+ 'pretty_version' => 'v1.5.2',
60
+ 'version' => '1.5.2.0',
61
+ 'type' => 'wordpress-plugin',
62
+ 'install_path' => __DIR__ . '/../../',
63
+ 'aliases' => array(),
64
+ 'reference' => 'a798c26a1bad3479bce22a1f0062d59466a68b7b',
65
+ 'dev_requirement' => false,
66
+ ),
67
+ ),
68
+ );
vendor/composer/platform_check.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // platform_check.php @generated by Composer
4
+
5
+ $issues = array();
6
+
7
+ if (!(PHP_VERSION_ID >= 50300)) {
8
+ $issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.0". You are running ' . PHP_VERSION . '.';
9
+ }
10
+
11
+ if ($issues) {
12
+ if (!headers_sent()) {
13
+ header('HTTP/1.1 500 Internal Server Error');
14
+ }
15
+ if (!ini_get('display_errors')) {
16
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
17
+ fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
18
+ } elseif (!headers_sent()) {
19
+ echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
20
+ }
21
+ }
22
+ trigger_error(
23
+ 'Composer detected issues in your platform: ' . implode(' ', $issues),
24
+ E_USER_ERROR
25
+ );
26
+ }
vendor/dealerdirect/phpcodesniffer-composer-installer/.remarkrc ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ {
2
+ "plugins": [
3
+ "remark-preset-lint-recommended",
4
+ ["remark-lint-list-item-indent", "space"]
5
+ ]
6
+ }
vendor/dealerdirect/phpcodesniffer-composer-installer/.yamllint ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ ---
2
+ extends: default
3
+ rules:
4
+ line-length:
5
+ level: warning
6
+ max: 120
vendor/dealerdirect/phpcodesniffer-composer-installer/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ <potherca@gmail.com>.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121
+
122
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
123
+ enforcement ladder](https://github.com/mozilla/diversity).
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
  MIT License
2
 
3
- Copyright (c) 2016-2017 Dealerdirect B.V.
4
 
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
  of this software and associated documentation files (the "Software"), to deal
1
  MIT License
2
 
3
+ Copyright (c) 2016-2020 Dealerdirect B.V.
4
 
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
  of this software and associated documentation files (the "Software"), to deal
vendor/dealerdirect/phpcodesniffer-composer-installer/README.md CHANGED
@@ -1,16 +1,17 @@
1
  # PHP_CodeSniffer Standards Composer Installer Plugin
2
 
3
  ![Project Stage][project-stage-shield]
4
- ![Maintenance][maintenance-shield]
5
  ![Awesome][awesome-shield]
6
  [![License][license-shield]](LICENSE.md)
7
 
8
  [![Travis][travis-shield]][travis]
9
  [![Scrutinizer][scrutinizer-shield]][scrutinizer]
10
- [![Dependency Status][versioneye-shield]][versioneye]
11
  [![Latest Version on Packagist][packagist-version-shield]][packagist-version]
12
  [![Packagist][packagist-shield]][packagist]
13
 
 
 
14
  This composer installer plugin allows for easy installation of [PHP_CodeSniffer][codesniffer] coding standards (rulesets).
15
 
16
  No more symbolic linking of directories, checking out repositories on specific locations or changing
@@ -20,7 +21,7 @@ _Note: This plugin is compatible with both version 2.x and 3.x of_ [PHP_CodeSnif
20
 
21
  ## Usage
22
 
23
- Installation can be done with [composer], by requiring this package as a development dependency:
24
 
25
  ```bash
26
  composer require --dev dealerdirect/phpcodesniffer-composer-installer
@@ -32,7 +33,7 @@ That's it.
32
 
33
  Basically, this plugin executes the following steps:
34
 
35
- - This plugin search for `phpcodesniffer-standard` packages in all of your currently installed Composer packages.
36
  - Matching packages and the project itself are scanned for PHP_CodeSniffer rulesets.
37
  - The plugin will call PHP_CodeSniffer and configure the `installed_paths` option.
38
 
@@ -50,7 +51,7 @@ multiple `phpcodesniffer-standard` packages.
50
  "require-dev": {
51
  "dealerdirect/phpcodesniffer-composer-installer": "*",
52
  "object-calisthenics/phpcs-calisthenics-rules": "*",
53
- "wimg/php-compatibility": "*",
54
  "wp-coding-standards/wpcs": "*"
55
  }
56
  }
@@ -106,12 +107,26 @@ referenced from other script configurations, as follows:
106
  For more details about Composer scripts, please refer to [the section on scripts
107
  in the Composer manual][composer-manual-scripts].
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  ### Caveats
110
 
111
  When this plugin is installed globally, composer will load the _global_ plugin rather
112
  than the one from the local repository. Despite [this behavior being documented
113
  in the composer manual][using-composer-plugins], it could potentially confuse
114
- as an other version of the plugin could be run and not the one specified by the project.
115
 
116
  ## Developing Coding Standards
117
 
@@ -125,7 +140,7 @@ Create a composer package of your coding standard by adding a `composer.json` fi
125
  "description" : "Package contains all coding standards of the Acme company",
126
  "require" : {
127
  "php" : ">=5.4.0,<8.0.0-dev",
128
- "squizlabs/php_codesniffer" : "^2.0"
129
  },
130
  "type" : "phpcodesniffer-standard"
131
  }
@@ -136,6 +151,36 @@ Requirements:
136
  * Each standard can have a separate directory no deeper than 3 levels from the repository root.
137
  * The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger.
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  ## Changelog
140
 
141
  This repository does not contain a `CHANGELOG.md` file, however, we do publish a changelog on each release
@@ -154,25 +199,13 @@ Thank you for being involved! :heart_eyes:
154
 
155
  The original idea and setup of this repository is by [Franck Nijhof][frenck], employee @ Dealerdirect.
156
 
157
- For a full list off all author and/or contributors, check [the contributors page][contributors].
158
-
159
- ## Working @ Dealerdirect
160
-
161
- Dealerdirect is always on the looking for energetic and hard working developers
162
- and devops engineers.
163
-
164
- Interested in working at Dealerdirect?
165
- Then please be sure to check out [our vacancies][vacancies].
166
-
167
- Did not find a matching vacancy? Just [get in touch][get-in-touch]!
168
-
169
- [dealerdirect.com][dealerdirectcom]
170
 
171
  ## License
172
 
173
  The MIT License (MIT)
174
 
175
- Copyright (c) 2016-2017 Dealerdirect B.V.
176
 
177
  Permission is hereby granted, free of charge, to any person obtaining a copy
178
  of this software and associated documentation files (the "Software"), to deal
@@ -194,17 +227,17 @@ THE SOFTWARE.
194
 
195
  [awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg
196
  [changelog]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
 
 
197
  [codesniffer]: https://github.com/squizlabs/PHP_CodeSniffer
198
  [composer-manual-scripts]: https://getcomposer.org/doc/articles/scripts.md
199
  [composer]: https://getcomposer.org/
200
  [contributing-guidelines]: CONTRIBUTING.md
201
  [contributors]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors
202
- [dealerdirectcom]: http://www.dealerdirect.com/en
203
  [definition-ci]: https://en.wikipedia.org/wiki/Continuous_integration
204
  [frenck]: https://github.com/frenck
205
- [get-in-touch]: https://www.dealerdirect.com/en/contact
206
  [license-shield]: https://img.shields.io/github/license/dealerdirect/phpcodesniffer-composer-installer.svg
207
- [maintenance-shield]: https://img.shields.io/maintenance/yes/2017.svg
208
  [packagist-shield]: https://img.shields.io/packagist/dt/dealerdirect/phpcodesniffer-composer-installer.svg
209
  [packagist-version-shield]: https://img.shields.io/packagist/v/dealerdirect/phpcodesniffer-composer-installer.svg
210
  [packagist-version]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
@@ -216,6 +249,3 @@ THE SOFTWARE.
216
  [travis]: https://travis-ci.org/Dealerdirect/phpcodesniffer-composer-installer
217
  [tutorial]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial
218
  [using-composer-plugins]: https://getcomposer.org/doc/articles/plugins.md#using-plugins
219
- [vacancies]: https://www.dealerdirect.com/en/vacancies
220
- [versioneye-shield]: https://www.versioneye.com/user/projects/580be0d1d65a7716b613a790/badge.svg
221
- [versioneye]: https://www.versioneye.com/user/projects/580be0d1d65a7716b613a790
1
  # PHP_CodeSniffer Standards Composer Installer Plugin
2
 
3
  ![Project Stage][project-stage-shield]
4
+ ![Last Commit][last-updated-shield]
5
  ![Awesome][awesome-shield]
6
  [![License][license-shield]](LICENSE.md)
7
 
8
  [![Travis][travis-shield]][travis]
9
  [![Scrutinizer][scrutinizer-shield]][scrutinizer]
 
10
  [![Latest Version on Packagist][packagist-version-shield]][packagist-version]
11
  [![Packagist][packagist-shield]][packagist]
12
 
13
+ [![Contributor Covenant][code-of-conduct-shield]][code-of-conduct]
14
+
15
  This composer installer plugin allows for easy installation of [PHP_CodeSniffer][codesniffer] coding standards (rulesets).
16
 
17
  No more symbolic linking of directories, checking out repositories on specific locations or changing
21
 
22
  ## Usage
23
 
24
+ Installation can be done with [Composer][composer], by requiring this package as a development dependency:
25
 
26
  ```bash
27
  composer require --dev dealerdirect/phpcodesniffer-composer-installer
33
 
34
  Basically, this plugin executes the following steps:
35
 
36
+ - This plugin searches for `phpcodesniffer-standard` packages in all of your currently installed Composer packages.
37
  - Matching packages and the project itself are scanned for PHP_CodeSniffer rulesets.
38
  - The plugin will call PHP_CodeSniffer and configure the `installed_paths` option.
39
 
51
  "require-dev": {
52
  "dealerdirect/phpcodesniffer-composer-installer": "*",
53
  "object-calisthenics/phpcs-calisthenics-rules": "*",
54
+ "phpcompatibility/php-compatibility": "*",
55
  "wp-coding-standards/wpcs": "*"
56
  }
57
  }
107
  For more details about Composer scripts, please refer to [the section on scripts
108
  in the Composer manual][composer-manual-scripts].
109
 
110
+ ### Changing the Coding Standards search depth
111
+
112
+ By default, this plugin searches up for Coding Standards up to three directories
113
+ deep. In most cases, this should be sufficient. However, this plugin allows
114
+ you to customize the search depth setting if needed.
115
+
116
+ ```json
117
+ {
118
+ "extra": {
119
+ "phpcodesniffer-search-depth": 5
120
+ }
121
+ }
122
+ ```
123
+
124
  ### Caveats
125
 
126
  When this plugin is installed globally, composer will load the _global_ plugin rather
127
  than the one from the local repository. Despite [this behavior being documented
128
  in the composer manual][using-composer-plugins], it could potentially confuse
129
+ as another version of the plugin could be run and not the one specified by the project.
130
 
131
  ## Developing Coding Standards
132
 
140
  "description" : "Package contains all coding standards of the Acme company",
141
  "require" : {
142
  "php" : ">=5.4.0,<8.0.0-dev",
143
+ "squizlabs/php_codesniffer" : "^3.0"
144
  },
145
  "type" : "phpcodesniffer-standard"
146
  }
151
  * Each standard can have a separate directory no deeper than 3 levels from the repository root.
152
  * The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger.
153
 
154
+ ### Requiring the plugin from within your coding standard
155
+
156
+ If your coding standard itself depends on additional external PHPCS standards, this plugin can
157
+ make life easier on your end-users by taking care of the installation of all standards - yours
158
+ and your dependencies - for them.
159
+
160
+ This can help reduce the number of support questions about setting the `installed_paths`, as well
161
+ as simplify your standard's installation instructions.
162
+
163
+ For this to work, make sure your external standard adds this plugin to the `composer.json` config
164
+ via `require`, **not** `require-dev`.
165
+
166
+ > :warning: Your end-user may already `require-dev` this plugin and/or other external standards used
167
+ > by your end-users may require this plugin as well.
168
+ >
169
+ > To prevent your end-users getting into "_dependency hell_", make sure to make the version requirement
170
+ > for this plugin flexible.
171
+ >
172
+ > As, for now, this plugin is still regarded as "unstable" (version < 1.0), remember that Composer
173
+ > treats unstable minors as majors and will not be able to resolve one config requiring this plugin
174
+ > at version `^0.5`, while another requires it at version `^0.6`.
175
+ > Either allow multiple minors or use `*` as the version requirement.
176
+ >
177
+ > Some examples of flexible requirements which can be used:
178
+ > ```bash
179
+ > composer require dealerdirect/phpcodesniffer-composer-installer:"*"
180
+ > composer require dealerdirect/phpcodesniffer-composer-installer:"0.*"
181
+ > composer require dealerdirect/phpcodesniffer-composer-installer:"^0.4 || ^0.5 || ^0.6"
182
+ > ```
183
+
184
  ## Changelog
185
 
186
  This repository does not contain a `CHANGELOG.md` file, however, we do publish a changelog on each release
199
 
200
  The original idea and setup of this repository is by [Franck Nijhof][frenck], employee @ Dealerdirect.
201
 
202
+ For a full list of all author and/or contributors, check [the contributors page][contributors].
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  ## License
205
 
206
  The MIT License (MIT)
207
 
208
+ Copyright (c) 2016-2020 Dealerdirect B.V.
209
 
210
  Permission is hereby granted, free of charge, to any person obtaining a copy
211
  of this software and associated documentation files (the "Software"), to deal
227
 
228
  [awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg
229
  [changelog]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases
230
+ [code-of-conduct-shield]: https://img.shields.io/badge/Contributor%20Covenant-v2.0-ff69b4.svg
231
+ [code-of-conduct]: CODE_OF_CONDUCT.md
232
  [codesniffer]: https://github.com/squizlabs/PHP_CodeSniffer
233
  [composer-manual-scripts]: https://getcomposer.org/doc/articles/scripts.md
234
  [composer]: https://getcomposer.org/
235
  [contributing-guidelines]: CONTRIBUTING.md
236
  [contributors]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors
 
237
  [definition-ci]: https://en.wikipedia.org/wiki/Continuous_integration
238
  [frenck]: https://github.com/frenck
239
+ [last-updated-shield]: https://img.shields.io/github/last-commit/Dealerdirect/phpcodesniffer-composer-installer.svg
240
  [license-shield]: https://img.shields.io/github/license/dealerdirect/phpcodesniffer-composer-installer.svg
 
241
  [packagist-shield]: https://img.shields.io/packagist/dt/dealerdirect/phpcodesniffer-composer-installer.svg
242
  [packagist-version-shield]: https://img.shields.io/packagist/v/dealerdirect/phpcodesniffer-composer-installer.svg
243
  [packagist-version]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
249
  [travis]: https://travis-ci.org/Dealerdirect/phpcodesniffer-composer-installer
250
  [tutorial]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial
251
  [using-composer-plugins]: https://getcomposer.org/doc/articles/plugins.md#using-plugins
 
 
 
vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  * This file is part of the Dealerdirect PHP_CodeSniffer Standards
5
  * Composer Installer Plugin package.
6
  *
7
- * @copyright 2016-2017 Dealerdirect B.V.
8
  * @license MIT
9
  */
10
 
@@ -15,41 +15,57 @@ use Composer\EventDispatcher\EventSubscriberInterface;
15
  use Composer\IO\IOInterface;
16
  use Composer\Package\AliasPackage;
17
  use Composer\Package\PackageInterface;
18
- use Composer\Package\RootpackageInterface;
19
  use Composer\Plugin\PluginInterface;
20
  use Composer\Script\Event;
21
  use Composer\Script\ScriptEvents;
 
 
22
  use Symfony\Component\Finder\Finder;
23
  use Symfony\Component\Process\Exception\LogicException;
24
  use Symfony\Component\Process\Exception\ProcessFailedException;
25
  use Symfony\Component\Process\Exception\RuntimeException;
26
- use Symfony\Component\Process\ProcessBuilder;
27
 
28
  /**
29
  * PHP_CodeSniffer standard installation manager.
30
  *
31
- * @author Franck Nijhof <f.nijhof@dealerdirect.nl>
32
  */
33
  class Plugin implements PluginInterface, EventSubscriberInterface
34
  {
35
- const MESSAGE_RUNNING_INSTALLER = 'Running PHPCodeSniffer Composer Installer';
36
- const MESSAGE_NOTHING_TO_INSTALL = 'Nothing to install or update';
 
 
 
37
  const MESSAGE_NOT_INSTALLED = 'PHPCodeSniffer is not installed';
 
 
 
38
 
39
  const PACKAGE_NAME = 'squizlabs/php_codesniffer';
40
  const PACKAGE_TYPE = 'phpcodesniffer-standard';
41
 
 
42
  const PHPCS_CONFIG_KEY = 'installed_paths';
43
 
 
 
44
  /**
45
  * @var Composer
46
  */
47
  private $composer;
48
 
49
  /**
50
- * @var IOInterface
51
  */
52
- private $io;
 
 
 
 
 
53
 
54
  /**
55
  * @var array
@@ -57,9 +73,14 @@ class Plugin implements PluginInterface, EventSubscriberInterface
57
  private $installedPaths;
58
 
59
  /**
60
- * @var ProcessBuilder
 
 
 
 
 
61
  */
62
- private $processBuilder;
63
 
64
  /**
65
  * Triggers the plugin's main functionality.
@@ -92,8 +113,8 @@ class Plugin implements PluginInterface, EventSubscriberInterface
92
  *
93
  * @throws \RuntimeException
94
  * @throws LogicException
95
- * @throws RuntimeException
96
  * @throws ProcessFailedException
 
97
  */
98
  public function activate(Composer $composer, IOInterface $io)
99
  {
@@ -103,6 +124,20 @@ class Plugin implements PluginInterface, EventSubscriberInterface
103
  $this->init();
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Prepares the plugin so it's main functionality can be run.
108
  *
@@ -113,12 +148,11 @@ class Plugin implements PluginInterface, EventSubscriberInterface
113
  */
114
  private function init()
115
  {
 
116
  $this->installedPaths = array();
117
 
118
- $this->processBuilder = new ProcessBuilder();
119
- $this->processBuilder->setPrefix($this->composer->getConfig()->get('bin-dir') . DIRECTORY_SEPARATOR . 'phpcs');
120
-
121
- $this->loadInstalledPaths();
122
  }
123
 
124
  /**
@@ -140,54 +174,82 @@ class Plugin implements PluginInterface, EventSubscriberInterface
140
  * Entry point for post install and post update events.
141
  *
142
  * @throws \InvalidArgumentException
143
- * @throws RuntimeException
144
  * @throws LogicException
145
  * @throws ProcessFailedException
 
146
  */
147
  public function onDependenciesChangedEvent()
148
  {
149
  $io = $this->io;
150
  $isVerbose = $io->isVerbose();
 
151
 
152
  if ($isVerbose) {
153
  $io->write(sprintf('<info>%s</info>', self::MESSAGE_RUNNING_INSTALLER));
154
  }
155
 
156
  if ($this->isPHPCodeSnifferInstalled() === true) {
 
157
  $installPathCleaned = $this->cleanInstalledPaths();
158
  $installPathUpdated = $this->updateInstalledPaths();
159
 
160
  if ($installPathCleaned === true || $installPathUpdated === true) {
161
- $this->saveInstalledPaths();
162
  } elseif ($isVerbose) {
163
  $io->write(sprintf('<info>%s</info>', self::MESSAGE_NOTHING_TO_INSTALL));
164
  }
165
- } elseif ($isVerbose) {
166
- $io->write(sprintf('<info>%s</info>', self::MESSAGE_NOT_INSTALLED));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
 
 
168
  }
169
 
170
  /**
171
  * Load all paths from PHP_CodeSniffer into an array.
172
  *
173
- * @throws RuntimeException
174
  * @throws LogicException
175
  * @throws ProcessFailedException
 
176
  */
177
  private function loadInstalledPaths()
178
  {
179
  if ($this->isPHPCodeSnifferInstalled() === true) {
180
- $output = $this->processBuilder
181
- ->setArguments(array('--config-show', self::PHPCS_CONFIG_KEY))
182
- ->getProcess()
183
- ->mustRun()
184
- ->getOutput();
 
 
 
185
 
186
- $phpcsInstalledPaths = str_replace(self::PHPCS_CONFIG_KEY . ': ', '', $output);
187
- $phpcsInstalledPaths = trim($phpcsInstalledPaths);
 
 
188
 
189
- if ($phpcsInstalledPaths !== '') {
190
- $this->installedPaths = explode(',', $phpcsInstalledPaths);
 
191
  }
192
  }
193
  }
@@ -195,14 +257,17 @@ class Plugin implements PluginInterface, EventSubscriberInterface
195
  /**
196
  * Save all coding standard paths back into PHP_CodeSniffer
197
  *
198
- * @throws RuntimeException
199
  * @throws LogicException
200
  * @throws ProcessFailedException
 
 
 
201
  */
202
  private function saveInstalledPaths()
203
  {
204
  // Check if we found installed paths to set.
205
  if (count($this->installedPaths) !== 0) {
 
206
  $paths = implode(',', $this->installedPaths);
207
  $arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths);
208
  $configMessage = sprintf(
@@ -219,18 +284,113 @@ class Plugin implements PluginInterface, EventSubscriberInterface
219
  );
220
  }
221
 
222
- $this->io->write($configMessage);
 
 
 
 
223
 
224
- $configResult = $this->processBuilder
225
- ->setArguments($arguments)
226
- ->getProcess()
227
- ->mustRun()
228
- ->getOutput()
229
- ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
 
231
  if ($this->io->isVerbose() && !empty($configResult)) {
232
  $this->io->write(sprintf('<info>%s</info>', $configResult));
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
235
 
236
  /**
@@ -248,7 +408,8 @@ class Plugin implements PluginInterface, EventSubscriberInterface
248
  // This might be a relative path as well
249
  $alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . DIRECTORY_SEPARATOR . $path);
250
 
251
- if ((is_dir($path) === false || is_readable($path) === false) &&
 
252
  (is_dir($alternativePath) === false || is_readable($alternativePath) === false)
253
  ) {
254
  unset($this->installedPaths[$key]);
@@ -271,37 +432,43 @@ class Plugin implements PluginInterface, EventSubscriberInterface
271
  {
272
  $changes = false;
273
 
274
- $searchPaths = array(getcwd());
275
  $codingStandardPackages = $this->getPHPCodingStandardPackages();
276
  foreach ($codingStandardPackages as $package) {
277
- $searchPaths[] = $this->composer->getInstallationManager()->getInstallPath($package);
 
 
 
 
 
 
278
  }
279
 
280
  $finder = new Finder();
281
  $finder->files()
 
 
282
  ->ignoreUnreadableDirs()
283
  ->ignoreVCS(true)
284
- ->depth('< 4')
285
- ->name('ruleset.xml')
286
- ->in($searchPaths);
287
-
288
- // Only version 3.x and higher has support for having coding standard in the root of the directory.
289
- if ($this->isPHPCodeSnifferInstalled('>= 3.0.0') !== true) {
290
- $finder->depth('>= 1');
291
- }
292
 
293
  // Process each found possible ruleset.
294
  foreach ($finder as $ruleset) {
295
  $standardsPath = $ruleset->getPath();
296
 
297
  // Pick the directory above the directory containing the standard, unless this is the project root.
298
- if ($standardsPath !== getcwd()) {
299
  $standardsPath = dirname($standardsPath);
300
  }
301
 
302
  // Use relative paths for local project repositories.
303
  if ($this->isRunningGlobally() === false) {
304
- $standardsPath = $this->getRelativePath($standardsPath);
 
 
 
 
305
  }
306
 
307
  // De-duplicate and add when directory is not configured.
@@ -335,7 +502,8 @@ class Plugin implements PluginInterface, EventSubscriberInterface
335
  }
336
  );
337
 
338
- if (! $this->composer->getPackage() instanceof RootpackageInterface
 
339
  && $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
340
  ) {
341
  $codingStandardPackages[] = $this->composer->getPackage();
@@ -394,48 +562,59 @@ class Plugin implements PluginInterface, EventSubscriberInterface
394
  */
395
  private function isRunningGlobally()
396
  {
397
- return ($this->composer->getConfig()->get('home') === getcwd());
398
  }
399
 
400
  /**
401
- * Returns the relative path to PHP_CodeSniffer from any other absolute path
402
  *
403
- * @param string $to Absolute path
404
  *
405
- * @return string Relative path
406
  */
407
- private function getRelativePath($to)
408
  {
409
- $from = $this->getPHPCodeSnifferInstallPath();
410
-
411
- // Some compatibility fixes for Windows paths
412
- $from = is_dir($from) ? rtrim($from, '\/') . '/' : $from;
413
- $to = is_dir($to) ? rtrim($to, '\/') . '/' : $to;
414
- $from = str_replace('\\', '/', $from);
415
- $to = str_replace('\\', '/', $to);
416
-
417
- $from = explode('/', $from);
418
- $to = explode('/', $to);
419
- $relPath = $to;
420
-
421
- foreach ($from as $depth => $dir) {
422
- // Find first non-matching dir
423
- if ($dir === $to[$depth]) {
424
- // Ignore this directory
425
- array_shift($relPath);
426
- } else {
427
- // Get number of remaining dirs to $from
428
- $remaining = count($from) - $depth;
429
- if ($remaining > 1) {
430
- // Add traversals up to first matching dir
431
- $padLength = (count($relPath) + $remaining - 1) * -1;
432
- $relPath = array_pad($relPath, $padLength, '..');
433
- break;
434
- } else {
435
- $relPath[0] = './' . $relPath[0];
436
- }
437
  }
438
  }
439
- return implode('/', $relPath);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  }
441
  }
4
  * This file is part of the Dealerdirect PHP_CodeSniffer Standards
5
  * Composer Installer Plugin package.
6
  *
7
+ * @copyright 2016-2020 Dealerdirect B.V.
8
  * @license MIT
9
  */
10
 
15
  use Composer\IO\IOInterface;
16
  use Composer\Package\AliasPackage;
17
  use Composer\Package\PackageInterface;
18
+ use Composer\Package\RootPackageInterface;
19
  use Composer\Plugin\PluginInterface;
20
  use Composer\Script\Event;
21
  use Composer\Script\ScriptEvents;
22
+ use Composer\Util\Filesystem;
23
+ use Composer\Util\ProcessExecutor;
24
  use Symfony\Component\Finder\Finder;
25
  use Symfony\Component\Process\Exception\LogicException;
26
  use Symfony\Component\Process\Exception\ProcessFailedException;
27
  use Symfony\Component\Process\Exception\RuntimeException;
28
+ use Symfony\Component\Process\PhpExecutableFinder;
29
 
30
  /**
31
  * PHP_CodeSniffer standard installation manager.
32
  *
33
+ * @author Franck Nijhof <franck.nijhof@dealerdirect.com>
34
  */
35
  class Plugin implements PluginInterface, EventSubscriberInterface
36
  {
37
+
38
+ const KEY_MAX_DEPTH = 'phpcodesniffer-search-depth';
39
+
40
+ const MESSAGE_ERROR_WRONG_MAX_DEPTH =
41
+ 'The value of "%s" (in the composer.json "extra".section) must be an integer larger then %d, %s given.';
42
  const MESSAGE_NOT_INSTALLED = 'PHPCodeSniffer is not installed';
43
+ const MESSAGE_NOTHING_TO_INSTALL = 'Nothing to install or update';
44
+ const MESSAGE_PLUGIN_UNINSTALLED = 'PHPCodeSniffer Composer Installer is uninstalled';
45
+ const MESSAGE_RUNNING_INSTALLER = 'Running PHPCodeSniffer Composer Installer';
46
 
47
  const PACKAGE_NAME = 'squizlabs/php_codesniffer';
48
  const PACKAGE_TYPE = 'phpcodesniffer-standard';
49
 
50
+ const PHPCS_CONFIG_REGEX = '`%s:[^\r\n]+`';
51
  const PHPCS_CONFIG_KEY = 'installed_paths';
52
 
53
+ const PLUGIN_NAME = 'dealerdirect/phpcodesniffer-composer-installer';
54
+
55
  /**
56
  * @var Composer
57
  */
58
  private $composer;
59
 
60
  /**
61
+ * @var string
62
  */
63
+ private $cwd;
64
+
65
+ /**
66
+ * @var Filesystem
67
+ */
68
+ private $filesystem;
69
 
70
  /**
71
  * @var array
73
  private $installedPaths;
74
 
75
  /**
76
+ * @var IOInterface
77
+ */
78
+ private $io;
79
+
80
+ /**
81
+ * @var ProcessExecutor
82
  */
83
+ private $processExecutor;
84
 
85
  /**
86
  * Triggers the plugin's main functionality.
113
  *
114
  * @throws \RuntimeException
115
  * @throws LogicException
 
116
  * @throws ProcessFailedException
117
+ * @throws RuntimeException
118
  */
119
  public function activate(Composer $composer, IOInterface $io)
120
  {
124
  $this->init();
125
  }
126
 
127
+ /**
128
+ * {@inheritDoc}
129
+ */
130
+ public function deactivate(Composer $composer, IOInterface $io)
131
+ {
132
+ }
133
+
134
+ /**
135
+ * {@inheritDoc}
136
+ */
137
+ public function uninstall(Composer $composer, IOInterface $io)
138
+ {
139
+ }
140
+
141
  /**
142
  * Prepares the plugin so it's main functionality can be run.
143
  *
148
  */
149
  private function init()
150
  {
151
+ $this->cwd = getcwd();
152
  $this->installedPaths = array();
153
 
154
+ $this->processExecutor = new ProcessExecutor($this->io);
155
+ $this->filesystem = new Filesystem($this->processExecutor);
 
 
156
  }
157
 
158
  /**
174
  * Entry point for post install and post update events.
175
  *
176
  * @throws \InvalidArgumentException
 
177
  * @throws LogicException
178
  * @throws ProcessFailedException
179
+ * @throws RuntimeException
180
  */
181
  public function onDependenciesChangedEvent()
182
  {
183
  $io = $this->io;
184
  $isVerbose = $io->isVerbose();
185
+ $exitCode = 0;
186
 
187
  if ($isVerbose) {
188
  $io->write(sprintf('<info>%s</info>', self::MESSAGE_RUNNING_INSTALLER));
189
  }
190
 
191
  if ($this->isPHPCodeSnifferInstalled() === true) {
192
+ $this->loadInstalledPaths();
193
  $installPathCleaned = $this->cleanInstalledPaths();
194
  $installPathUpdated = $this->updateInstalledPaths();
195
 
196
  if ($installPathCleaned === true || $installPathUpdated === true) {
197
+ $exitCode = $this->saveInstalledPaths();
198
  } elseif ($isVerbose) {
199
  $io->write(sprintf('<info>%s</info>', self::MESSAGE_NOTHING_TO_INSTALL));
200
  }
201
+ } else {
202
+ $pluginPackage = $this
203
+ ->composer
204
+ ->getRepositoryManager()
205
+ ->getLocalRepository()
206
+ ->findPackages(self::PLUGIN_NAME)
207
+ ;
208
+
209
+ $isPluginUninstalled = count($pluginPackage) === 0;
210
+
211
+ if ($isPluginUninstalled) {
212
+ if ($isVerbose) {
213
+ $io->write(sprintf('<info>%s</info>', self::MESSAGE_PLUGIN_UNINSTALLED));
214
+ }
215
+ } else {
216
+ $exitCode = 1;
217
+ if ($isVerbose) {
218
+ $io->write(sprintf('<error>%s</error>', self::MESSAGE_NOT_INSTALLED));
219
+ }
220
+ }
221
  }
222
+
223
+ return $exitCode;
224
  }
225
 
226
  /**
227
  * Load all paths from PHP_CodeSniffer into an array.
228
  *
 
229
  * @throws LogicException
230
  * @throws ProcessFailedException
231
+ * @throws RuntimeException
232
  */
233
  private function loadInstalledPaths()
234
  {
235
  if ($this->isPHPCodeSnifferInstalled() === true) {
236
+ $this->processExecutor->execute(
237
+ sprintf(
238
+ 'phpcs --config-show %s',
239
+ self::PHPCS_CONFIG_KEY
240
+ ),
241
+ $output,
242
+ $this->composer->getConfig()->get('bin-dir')
243
+ );
244
 
245
+ $regex = sprintf(self::PHPCS_CONFIG_REGEX, self::PHPCS_CONFIG_KEY);
246
+ if (preg_match($regex, $output, $match) === 1) {
247
+ $phpcsInstalledPaths = str_replace(self::PHPCS_CONFIG_KEY . ': ', '', $match[0]);
248
+ $phpcsInstalledPaths = trim($phpcsInstalledPaths);
249
 
250
+ if ($phpcsInstalledPaths !== '') {
251
+ $this->installedPaths = explode(',', $phpcsInstalledPaths);
252
+ }
253
  }
254
  }
255
  }
257
  /**
258
  * Save all coding standard paths back into PHP_CodeSniffer
259
  *
 
260
  * @throws LogicException
261
  * @throws ProcessFailedException
262
+ * @throws RuntimeException
263
+ *
264
+ * @return int Exit code. 0 for success, 1 or higher for failure.
265
  */
266
  private function saveInstalledPaths()
267
  {
268
  // Check if we found installed paths to set.
269
  if (count($this->installedPaths) !== 0) {
270
+ sort($this->installedPaths);
271
  $paths = implode(',', $this->installedPaths);
272
  $arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths);
273
  $configMessage = sprintf(
284
  );
285
  }
286
 
287
+ // Prepare message in case of failure
288
+ $failMessage = sprintf(
289
+ 'Failed to set PHP CodeSniffer <info>%s</info> Config',
290
+ self::PHPCS_CONFIG_KEY
291
+ );
292
 
293
+ // Determine the path to the main PHPCS file.
294
+ $phpcsPath = $this->getPHPCodeSnifferInstallPath();
295
+ if (file_exists($phpcsPath . '/bin/phpcs') === true) {
296
+ // PHPCS 3.x.
297
+ $phpcsExecutable = './bin/phpcs';
298
+ } else {
299
+ // PHPCS 2.x.
300
+ $phpcsExecutable = './scripts/phpcs';
301
+ }
302
+
303
+ // Okay, lets rock!
304
+ $command = vsprintf(
305
+ '%s %s %s',
306
+ array(
307
+ 'php executable' => $this->getPhpExecCommand(),
308
+ 'phpcs executable' => $phpcsExecutable,
309
+ 'arguments' => implode(' ', $arguments)
310
+ )
311
+ );
312
+
313
+ $exitCode = $this->processExecutor->execute($command, $configResult, $phpcsPath);
314
+ if ($exitCode === 0) {
315
+ $exitCode = $this->verifySaveSuccess();
316
+ }
317
+
318
+ if ($exitCode === 0) {
319
+ $this->io->write($configMessage);
320
+ } else {
321
+ $this->io->write($failMessage);
322
+ }
323
 
324
  if ($this->io->isVerbose() && !empty($configResult)) {
325
  $this->io->write(sprintf('<info>%s</info>', $configResult));
326
  }
327
+
328
+ return $exitCode;
329
+ }
330
+
331
+ /**
332
+ * Verify that the paths which were expected to be saved, have been.
333
+ *
334
+ * @return int Exit code. 0 for success, 1 for failure.
335
+ */
336
+ private function verifySaveSuccess()
337
+ {
338
+ $exitCode = 1;
339
+ $expectedPaths = $this->installedPaths;
340
+
341
+ // Request the currently set installed paths after the save.
342
+ $this->loadInstalledPaths();
343
+
344
+ $registeredPaths = array_intersect($this->installedPaths, $expectedPaths);
345
+ $registeredCount = count($registeredPaths);
346
+ $expectedCount = count($expectedPaths);
347
+
348
+ if ($expectedCount === $registeredCount) {
349
+ $exitCode = 0;
350
+ }
351
+
352
+ if ($exitCode === 1 && $this->io->isVerbose()) {
353
+ $verificationMessage = sprintf(
354
+ "Paths to external standards found by the plugin: <info>%s</info>\n"
355
+ . 'Actual paths registered with PHPCS: <info>%s</info>',
356
+ implode(', ', $expectedPaths),
357
+ implode(', ', $this->installedPaths)
358
+ );
359
+ $this->io->write($verificationMessage);
360
+ }
361
+
362
+ return $exitCode;
363
+ }
364
+
365
+ /**
366
+ * Get the path to the current PHP version being used.
367
+ *
368
+ * Duplicate of the same in the EventDispatcher class in Composer itself.
369
+ */
370
+ protected function getPhpExecCommand()
371
+ {
372
+ $finder = new PhpExecutableFinder();
373
+
374
+ $phpPath = $finder->find(false);
375
+
376
+ if ($phpPath === false) {
377
+ throw new \RuntimeException('Failed to locate PHP binary to execute ' . $phpPath);
378
+ }
379
+
380
+ $phpArgs = $finder->findArguments();
381
+ $phpArgs = $phpArgs
382
+ ? ' ' . implode(' ', $phpArgs)
383
+ : ''
384
+ ;
385
+
386
+ $command = ProcessExecutor::escape($phpPath) .
387
+ $phpArgs .
388
+ ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen')) .
389
+ ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions')) .
390
+ ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'))
391
+ ;
392
+
393
+ return $command;
394
  }
395
 
396
  /**
408
  // This might be a relative path as well
409
  $alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . DIRECTORY_SEPARATOR . $path);
410
 
411
+ if (
412
+ (is_dir($path) === false || is_readable($path) === false) &&
413
  (is_dir($alternativePath) === false || is_readable($alternativePath) === false)
414
  ) {
415
  unset($this->installedPaths[$key]);
432
  {
433
  $changes = false;
434
 
435
+ $searchPaths = array($this->cwd);
436
  $codingStandardPackages = $this->getPHPCodingStandardPackages();
437
  foreach ($codingStandardPackages as $package) {
438
+ $installPath = $this->composer->getInstallationManager()->getInstallPath($package);
439
+ if ($this->filesystem->isAbsolutePath($installPath) === false) {
440
+ $installPath = $this->filesystem->normalizePath(
441
+ $this->cwd . DIRECTORY_SEPARATOR . $installPath
442
+ );
443
+ }
444
+ $searchPaths[] = $installPath;
445
  }
446
 
447
  $finder = new Finder();
448
  $finder->files()
449
+ ->depth('<= ' . $this->getMaxDepth())
450
+ ->depth('>= ' . $this->getMinDepth())
451
  ->ignoreUnreadableDirs()
452
  ->ignoreVCS(true)
453
+ ->in($searchPaths)
454
+ ->name('ruleset.xml');
 
 
 
 
 
 
455
 
456
  // Process each found possible ruleset.
457
  foreach ($finder as $ruleset) {
458
  $standardsPath = $ruleset->getPath();
459
 
460
  // Pick the directory above the directory containing the standard, unless this is the project root.
461
+ if ($standardsPath !== $this->cwd) {
462
  $standardsPath = dirname($standardsPath);
463
  }
464
 
465
  // Use relative paths for local project repositories.
466
  if ($this->isRunningGlobally() === false) {
467
+ $standardsPath = $this->filesystem->findShortestPath(
468
+ $this->getPHPCodeSnifferInstallPath(),
469
+ $standardsPath,
470
+ true
471
+ );
472
  }
473
 
474
  // De-duplicate and add when directory is not configured.
502
  }
503
  );
504
 
505
+ if (
506
+ ! $this->composer->getPackage() instanceof RootPackageInterface
507
  && $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
508
  ) {
509
  $codingStandardPackages[] = $this->composer->getPackage();
562
  */
563
  private function isRunningGlobally()
564
  {
565
+ return ($this->composer->getConfig()->get('home') === $this->cwd);
566
  }
567
 
568
  /**
569
+ * Determines the maximum search depth when searching for Coding Standards.
570
  *
571
+ * @return int
572
  *
573
+ * @throws \InvalidArgumentException
574
  */
575
+ private function getMaxDepth()
576
  {
577
+ $maxDepth = 3;
578
+
579
+ $extra = $this->composer->getPackage()->getExtra();
580
+
581
+ if (array_key_exists(self::KEY_MAX_DEPTH, $extra)) {
582
+ $maxDepth = $extra[self::KEY_MAX_DEPTH];
583
+ $minDepth = $this->getMinDepth();
584
+
585
+ if (
586
+ (string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
587
+ || $maxDepth <= $minDepth /* Larger than the minimum */
588
+ || is_float($maxDepth) === true /* Within the boundaries of integer */
589
+ ) {
590
+ $message = vsprintf(
591
+ self::MESSAGE_ERROR_WRONG_MAX_DEPTH,
592
+ array(
593
+ 'key' => self::KEY_MAX_DEPTH,
594
+ 'min' => $minDepth,
595
+ 'given' => var_export($maxDepth, true),
596
+ )
597
+ );
598
+
599
+ throw new \InvalidArgumentException($message);
 
 
 
 
 
600
  }
601
  }
602
+
603
+ return (int) $maxDepth;
604
+ }
605
+
606
+ /**
607
+ * Returns the minimal search depth for Coding Standard packages.
608
+ *
609
+ * Usually this is 0, unless PHP_CodeSniffer >= 3 is used.
610
+ *
611
+ * @return int
612
+ */
613
+ private function getMinDepth()
614
+ {
615
+ if ($this->isPHPCodeSnifferInstalled('>= 3.0.0') !== true) {
616
+ return 1;
617
+ }
618
+ return 0;
619
  }
620
  }
vendor/phpcompatibility/php-compatibility/CHANGELOG.md CHANGED
@@ -7,8 +7,6 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
7
  Up to version 8.0.0, the `major.minor` version numbers were based on the PHP version for which compatibility check support was added, with `patch` version numbers being specific to this library.
8
  From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
9
 
10
- **IMPORTANT**: The 8.0.0 release contains a **breaking change**. Please read the v [8.0.0 changelog](CHANGELOG.md#800---2017-08-03) carefully before upgrading.
11
-
12
  <!-- Legend to the icons used: https://github.com/PHPCompatibility/PHPCompatibility/pull/506#discussion_r131650488 -->
13
 
14
 
@@ -16,6 +14,451 @@ From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
16
 
17
  _Nothing yet._
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  ## [8.2.0] - 2018-07-17
20
 
21
  See all related issues and PRs in the [8.2.0 milestone].
@@ -137,41 +580,41 @@ Thanks go out to [Michael Babker] and [Juliette Reinders Folmer] for their contr
137
  See all related issues and PRs in the [8.1.0 milestone].
138
 
139
  ### Added
140
- - :star2: New `NewConstants` and `RemovedConstants` sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. [#526](https://github.com/wimg/PHPCompatibility/pull/525), [#551](https://github.com/wimg/PHPCompatibility/pull/551), [#566](https://github.com/wimg/PHPCompatibility/pull/566). Fixes [#263](https://github.com/wimg/PHPCompatibility/issues/263).
141
- - :star2: New `MagicAutoloadDeprecation` sniff to detect deprecated `__autoload()` functions as deprecated in PHP 7.2. [#540](https://github.com/wimg/PHPCompatibility/pull/540)
142
- - :star2: New `OptionalRequiredFunctionParameter` sniff to check for missing function call parameters which were required and only became optional in a later PHP version. [#524](https://github.com/wimg/PHPCompatibility/pull/524)
143
- - :star2: New `DynamicAccessToStatic` sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. [#535](https://github.com/wimg/PHPCompatibility/pull/535). Fixes [#534](https://github.com/wimg/PHPCompatibility/issues/534).
144
- - :star: `DeprecatedFunctions` sniff: recognize yet more PHP 7.2 deprecated functions. [#561](https://github.com/wimg/PHPCompatibility/pull/561), [#566](https://github.com/wimg/PHPCompatibility/pull/566)
145
- - :star: `DeprecatedIniDirectives` sniff: recognize the last of the PHP 7.2 deprecated ini directives. [#566](https://github.com/wimg/PHPCompatibility/pull/566), [#567](https://github.com/wimg/PHPCompatibility/pull/567)
146
- - :star: `NewFunctions` : detection of all new PHP 7.2 functions added. [#522](https://github.com/wimg/PHPCompatibility/pull/522), [#545](https://github.com/wimg/PHPCompatibility/pull/545), [#551](https://github.com/wimg/PHPCompatibility/pull/551), [#565](https://github.com/wimg/PHPCompatibility/pull/565)
147
- - :star: `RemovedExtensions` : report on usage of the `mcrypt` extension which has been removed in PHP 7.2. [#566](https://github.com/wimg/PHPCompatibility/pull/566)
148
- - :star: `RemovedGlobalVariables` : detection of the use of `$php_errormsg` with `track_errors` which has been deprecated in PHP 7.2. [#528](https://github.com/wimg/PHPCompatibility/pull/528)
149
- - :books: Documentation : added reporting usage instructions. [#533](https://github.com/wimg/PHPCompatibility/pull/533), [#552](https://github.com/wimg/PHPCompatibility/pull/552)
150
 
151
  ### Changed
152
- - :pushpin: `NewClosures` : downgraded "$this found in closure outside class" to warning. [#536](https://github.com/wimg/PHPCompatibility/pull/535). Fixes [#527](https://github.com/wimg/PHPCompatibility/issues/527).
153
- - :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw an error for each variable in a `global` statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown per `global` statement. [#564](https://github.com/wimg/PHPCompatibility/pull/564)
154
- - :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw `warning`s for non-bare variables used in a `global` statement as those are discouraged since PHP 7.0. [#564](https://github.com/wimg/PHPCompatibility/pull/564)
155
- - :rewind: `NewLanguageConstructs` : updated the version number for `T_COALESCE_EQUAL`. [#523](https://github.com/wimg/PHPCompatibility/pull/523)
156
- - :pencil2: `Sniff::getTestVersion()` : simplified regex logic. [#520](https://github.com/wimg/PHPCompatibility/pull/520)
157
- - :green_heart: Travis : build tests are now being run against PHP 7.2 as well. [#511](https://github.com/wimg/PHPCompatibility/pull/511)
158
- - :wrench: Improved check for superfluous whitespaces in files. [#542](https://github.com/wimg/PHPCompatibility/pull/542)
159
- - :wrench: Build/PHPCS : stabilized the exclude patterns. [#529](https://github.com/wimg/PHPCompatibility/pull/529)
160
- - :wrench: Build/PHPCS : added array indentation check. [#538](https://github.com/wimg/PHPCompatibility/pull/538)
161
- - :white_check_mark: PHPCS cross-version compatibility : sync `FindExtendedClassname()` method with upstream. [#507](https://github.com/wimg/PHPCompatibility/pull/507)
162
- - :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.4.3`. [#548](https://github.com/wimg/PHPCompatibility/pull/548)
163
 
164
  ### Fixed
165
- - :bug: `ForbiddenCallTimePassByReference` : a false positive was being thrown when a global constant was followed by a _bitwise and_. [#562](https://github.com/wimg/PHPCompatibility/pull/562). Fixes [#39](https://github.com/wimg/PHPCompatibility/issues/39).
166
- - :bug: `ForbiddenGlobalVariableVariable` : the sniff was overzealous and would also report on `global` in combination with variable variables which are still supported. [#564](https://github.com/wimg/PHPCompatibility/pull/564). Fixes [#537](https://github.com/wimg/PHPCompatibility/issues/537).
167
- - :bug: `ForbiddenGlobalVariableVariable` : variables interspersed with whitespace and/or comments were not being reported. [#564](https://github.com/wimg/PHPCompatibility/pull/564)
168
- - :rewind: `ForbiddenNamesAsInvokedFunctions` : improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. [#516](https://github.com/wimg/PHPCompatibility/pull/516). Fixes [#515](https://github.com/wimg/PHPCompatibility/issues/515)
169
- - :bug: `VariableVariables` : variables interspersed with whitespace and/or comments were not being reported. [#563](https://github.com/wimg/PHPCompatibility/pull/563)
170
- - :umbrella: Fixed some unintentional syntax errors in test files. [#539](https://github.com/wimg/PHPCompatibility/pull/539)
171
- - :umbrella: Tests : fixed case numbering error. [#525](https://github.com/wimg/PHPCompatibility/pull/525)
172
- - :books: Tests : added missing test skip explanation. [#521](https://github.com/wimg/PHPCompatibility/pull/521)
173
- - :wrench: Fixed PHPCS whitespaces. [#543](https://github.com/wimg/PHPCompatibility/pull/543)
174
- - :wrench: Fixed code test coverage verification. [#550](https://github.com/wimg/PHPCompatibility/pull/550). Fixes [#549](https://github.com/wimg/PHPCompatibility/issues/549).
175
 
176
  ### Credits
177
  Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their contributions to this version. :clap:
@@ -182,20 +625,20 @@ Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their c
182
  See all related issues and PRs in the [8.0.1 milestone].
183
 
184
  ### Added
185
- - :star2: New `DeprecatedTypeCasts` sniff to detect deprecated and removed type casts, such as the `(unset)` type cast as deprecated in PHP 7.2. [#498](https://github.com/wimg/PHPCompatibility/pull/498)
186
- - :star2: New `NewTypeCasts` sniff to detect type casts not present in older PHP versions such as the `(binary)` type cast as added in PHP 5.2.1. [#497](https://github.com/wimg/PHPCompatibility/pull/497)
187
- - :star: `NewGroupUseDeclaration`: Detection of PHP 7.2 trailing comma's in group use statements. [#504](https://github.com/wimg/PHPCompatibility/pull/504)
188
- - :star: `DeprecatedFunctions` sniff: recognize some more PHP 7.2 deprecated functions. [#501](https://github.com/wimg/PHPCompatibility/pull/501)
189
- - :star: `DeprecatedIniDirectives` sniff: recognize more PHP 7.2 deprecated ini directives. [#500](https://github.com/wimg/PHPCompatibility/pull/500)
190
- - :star: `ForbiddenNames` sniff: recognize `object` as a forbidden keyword since PHP 7.2. [#499](https://github.com/wimg/PHPCompatibility/pull/499)
191
- - :star: `NewReturnTypeDeclarations` sniff: recognize generic `parent`, PHP 7.1 `iterable` and PHP 7.2 `object` return type declarations. [#505](https://github.com/wimg/PHPCompatibility/pull/505), [#499](https://github.com/wimg/PHPCompatibility/pull/499)
192
- - :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.2 `object` type declarion. [#499](https://github.com/wimg/PHPCompatibility/pull/499)
193
 
194
  ### Changed
195
- :pencil2: Improved clarity of the deprecated functions alternative in the error message. [#502](https://github.com/wimg/PHPCompatibility/pull/502)
196
 
197
  ### Fixed
198
- :fire_engine: Temporary hotfix for installed_paths (pending [upstream fix](https://github.com/squizlabs/PHP_CodeSniffer/issues/1591).) [#503](https://github.com/wimg/PHPCompatibility/pull/503)
199
 
200
  ### Credits
201
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -312,24 +755,24 @@ If you run PHPCompatibility against your code as part of your Travis build:
312
  See all related issues and PRs in the [8.0.0 milestone].
313
 
314
  ### Added
315
- - :two_hearts: Support for PHP CodeSniffer 3.x. [#482](https://github.com/wimg/PHPCompatibility/pull/482), [#481](https://github.com/wimg/PHPCompatibility/pull/481), [#480](https://github.com/wimg/PHPCompatibility/pull/480), [#488](https://github.com/wimg/PHPCompatibility/pull/488), [#489](https://github.com/wimg/PHPCompatibility/pull/489), [#495](https://github.com/wimg/PHPCompatibility/pull/495)
316
 
317
  ### Changed
318
  - :gift: As of this version PHPCompatibility will use semantic versioning.
319
- - :fire: The directory structure of the repository has changed for better compatibility with installation via Composer. [#446](https://github.com/wimg/PHPCompatibility/pull/446). Fixes [#102](https://github.com/wimg/PHPCompatibility/issues/102), [#107](https://github.com/wimg/PHPCompatibility/issues/107)
320
- - :pencil2: The custom `functionWhitelist` property for the `PHPCompatibility.PHP.RemovedExtensions` sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). [#482](https://github.com/wimg/PHPCompatibility/pull/482)
321
- - :wrench: Improved the information provided to Composer from the `composer.json` file. [#446](https://github.com/wimg/PHPCompatibility/pull/446), [#482](https://github.com/wimg/PHPCompatibility/pull/482), [#486](https://github.com/wimg/PHPCompatibility/pull/486)
322
- - :wrench: Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with `--prefer-source` or by checking out a git clone of the repository. [#494](https://github.com/wimg/PHPCompatibility/pull/494)
323
- - :wrench: A variety of minor improvements to the build process. [#485](https://github.com/wimg/PHPCompatibility/pull/485), [#486](https://github.com/wimg/PHPCompatibility/pull/486), [#487](https://github.com/wimg/PHPCompatibility/pull/487)
324
- - :wrench: Some files for use by contributors have been renamed to use `.dist` extensions or moved for easier access. [#478](https://github.com/wimg/PHPCompatibility/pull/478), [#479](https://github.com/wimg/PHPCompatibility/pull/479), [#483](https://github.com/wimg/PHPCompatibility/pull/483), [#493](https://github.com/wimg/PHPCompatibility/pull/493)
325
- - :books: The installation instructions in the Readme. [#496](https://github.com/wimg/PHPCompatibility/pull/496)
326
- - :books: The unit test instructions in the Contributing file. [#496](https://github.com/wimg/PHPCompatibility/pull/496)
327
- - :books: Improved the example code in the Readme. [#490](https://github.com/wimg/PHPCompatibility/pull/490)
328
 
329
  ### Removed
330
  - :no_entry_sign: Support for PHP 5.1 and 5.2.
331
 
332
- The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. [#484](https://github.com/wimg/PHPCompatibility/pull/484), [#482](https://github.com/wimg/PHPCompatibility/pull/482)
333
 
334
  ### Credits
335
  Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contributions to this version. :clap:
@@ -340,32 +783,32 @@ Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contribut
340
  See all related issues and PRs in the [7.1.5 milestone].
341
 
342
  ### Added
343
- - :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/wimg/PHPCompatibility/pull/477). Fixes [#476](https://github.com/wimg/PHPCompatibility/issues/476)
344
- - :books: The LGPL-3.0 license. [#447](https://github.com/wimg/PHPCompatibility/pull/447)
345
 
346
  ### Changed
347
- - :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/wimg/PHPCompatibility/pull/451)
348
- - :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/wimg/PHPCompatibility/pull/452)
349
- - :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/wimg/PHPCompatibility/pull/454)
350
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/wimg/PHPCompatibility/pull/443), [#474](https://github.com/wimg/PHPCompatibility/pull/474)
351
- - :pencil2: Renamed a test file for consistency. [#453](https://github.com/wimg/PHPCompatibility/pull/453)
352
- - :wrench: Code style clean up. [#429](https://github.com/wimg/PHPCompatibility/pull/429)
353
- - :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/wimg/PHPCompatibility/pull/444)
354
- - :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/wimg/PHPCompatibility/pull/429)
355
- - :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/wimg/PHPCompatibility/pull/450)
356
- - :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/wimg/PHPCompatibility/pull/444)
357
- - :books: Minor improvements to the Readme. [#448](https://github.com/wimg/PHPCompatibility/pull/448), [#449](https://github.com/wimg/PHPCompatibility/pull/449), [#468](https://github.com/wimg/PHPCompatibility/pull/468)
358
- - :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/wimg/PHPCompatibility/pull/467)
359
 
360
  ### Removed
361
- - :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/wimg/PHPCompatibility/pull/458). Fixes [#457](https://github.com/wimg/PHPCompatibility/issues/457)
362
- - :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/wimg/PHPCompatibility/pull/442). Fixes [#436](https://github.com/wimg/PHPCompatibility/issues/436)
363
 
364
  ### Fixed
365
- - :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/wimg/PHPCompatibility/pull/441). Fixes [#440](https://github.com/wimg/PHPCompatibility/issues/440).
366
- - :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/wimg/PHPCompatibility/pull/462). Fixes [#460](https://github.com/wimg/PHPCompatibility/issues/460)
367
- - :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/wimg/PHPCompatibility/pull/463).
368
- - :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/wimg/PHPCompatibility/pull/465). Fixes [#464](https://github.com/wimg/PHPCompatibility/issues/464)
369
 
370
  ### Credits
371
  Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
@@ -376,55 +819,55 @@ Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contri
376
  See all related issues and PRs in the [7.1.4 milestone].
377
 
378
  ### Added
379
- - :star2: New `CaseSensitiveKeywords` sniff to detect use of non-lowercase `self`, `static` and `parent` keywords which could cause compatibility issues pre-PHP 5.5. [#382](https://github.com/wimg/PHPCompatibility/pull/382)
380
- - :star2: New `ConstantArraysUsingConst` sniff to detect constants defined using the `const` keyword being assigned an array value which was not supported prior to PHP 5.6. [#397](https://github.com/wimg/PHPCompatibility/pull/397)
381
- - :star2: New `ForbiddenClosureUseVariableNames` sniff to detect PHP 7.1 forbidden variable names in closure use statements. [#386](https://github.com/wimg/PHPCompatibility/pull/386). Fixes [#374](https://github.com/wimg/PHPCompatibility/issues/374)
382
- - :star2: New `NewArrayStringDereferencing` sniff to detect array and string literal dereferencing as introduced in PHP 5.5. [#388](https://github.com/wimg/PHPCompatibility/pull/388)
383
- - :star2: New `NewHeredocInitialize` sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. [#391](https://github.com/wimg/PHPCompatibility/pull/391). Fixes [#51](https://github.com/wimg/PHPCompatibility/issues/51)
384
- - :star2: New `NewMagicClassConstant` sniff to detect use of the magic `::class` constant as introduced in PHP 5.5. [#403](https://github.com/wimg/PHPCompatibility/pull/403). Fixes [#364](https://github.com/wimg/PHPCompatibility/issues/364).
385
- - :star2: New `NewUseConstFunction` sniff to detect use statements importing constants and functions as introduced in PHP 5.6. [#401](https://github.com/wimg/PHPCompatibility/pull/401)
386
- - :star: `DeprecatedFunctions` sniff: recognize PHP 7.2 deprecated GD functions. [#392](https://github.com/wimg/PHPCompatibility/pull/392)
387
- - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.2 deprecated `mbstring.func_overload` directive. [#377](https://github.com/wimg/PHPCompatibility/pull/377)
388
- - :star: `NewClasses` sniff: check for the PHP 5.1 `libXMLError` class. [#412](https://github.com/wimg/PHPCompatibility/pull/412)
389
- - :star: `NewClasses` sniff: recognize all native PHP Exception classes. [#418](https://github.com/wimg/PHPCompatibility/pull/418)
390
- - :star: `NewClosures` sniff: check for closures being declared as static and closures using `$this`. Both of which was not supported pre-PHP 5.4. [#389](https://github.com/wimg/PHPCompatibility/pull/389). Fixes [#24](https://github.com/wimg/PHPCompatibility/issues/24).
391
- - :star: `NewFunctionParameters` sniff: recognize new `exclude_disabled` parameter for the `get_defined_functions()` function as introduced in PHP 7.0.15. [#375](https://github.com/wimg/PHPCompatibility/pull/375)
392
- - :star: `NewFunctions` sniff: recognize new PHP 7.2 socket related functions. [#376](https://github.com/wimg/PHPCompatibility/pull/376)
393
- - :star: `NewInterfaces` sniff: check for some more PHP native interfaces. [#411](https://github.com/wimg/PHPCompatibility/pull/411)
394
- - :star: New `isClassProperty()`, `isClassConstant()` and `validDirectScope()` utility methods to the `PHPCompatibility_Sniff` class. [#393](https://github.com/wimg/PHPCompatibility/pull/393), [#391](https://github.com/wimg/PHPCompatibility/pull/391).
395
- - :star: New `getTypeHintsFromFunctionDeclaration()` utility method to the `PHPCompatibility_Sniff` class. [#414](https://github.com/wimg/PHPCompatibility/pull/414).
396
- - :umbrella: Unit tests against false positives for the `NewMagicMethods` sniff. [#381](https://github.com/wimg/PHPCompatibility/pull/381)
397
- - :umbrella: More unit tests for the `getTestVersion()` utility method. [#405](https://github.com/wimg/PHPCompatibility/pull/405), [#430](https://github.com/wimg/PHPCompatibility/pull/430)
398
- - :green_heart: The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. [#433](https://github.com/wimg/PHPCompatibility/pull/433)
399
- - :books: Readme: information about setting `installed_paths` via a custom ruleset. [#407](https://github.com/wimg/PHPCompatibility/pull/407)
400
- - :books: `Changelog.md` file containing a record of notable changes since the first tagged release. [#421](https://github.com/wimg/PHPCompatibility/pull/421)
401
 
402
  ### Changed
403
- - :pushpin: The `ForbiddenNamesAsDeclared` sniff will now emit `warning`s for soft reserved keywords. [#406](https://github.com/wimg/PHPCompatibility/pull/406), [#370](https://github.com/wimg/PHPCompatibility/pull/370).
404
- - :pushpin: The `ForbiddenNames` sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. [#417](https://github.com/wimg/PHPCompatibility/pull/417)
405
- - :pushpin: The `InternalInterfaces`, `NewClasses`, `NewConstVisibility`, `NewInterfaces`, `NewMagicMethods`, `NonStaticMagicMethods` and `RemovedGlobalVariables` sniffs will now also sniff for and correctly report violations in combination with anonymous classes. [#378](https://github.com/wimg/PHPCompatibility/pull/378), [#383](https://github.com/wimg/PHPCompatibility/pull/383), [#393](https://github.com/wimg/PHPCompatibility/pull/393), [#394](https://github.com/wimg/PHPCompatibility/pull/394), [#395](https://github.com/wimg/PHPCompatibility/pull/395), [#396](https://github.com/wimg/PHPCompatibility/pull/396). Fixes [#351](https://github.com/wimg/PHPCompatibility/issues/351) and [#333](https://github.com/wimg/PHPCompatibility/issues/333).
406
- - :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as type hints. [#414](https://github.com/wimg/PHPCompatibility/pull/414), [#416](https://github.com/wimg/PHPCompatibility/pull/416). Fixes [#352](https://github.com/wimg/PHPCompatibility/issues/352)
407
- - :pushpin: The `NewClasses` sniff will now also report on Exception classes when used in (multi-)`catch` statements. [#418](https://github.com/wimg/PHPCompatibility/pull/418). Fixes [#373](https://github.com/wimg/PHPCompatibility/issues/373).
408
- - :pushpin: The `NewScalarTypeDeclarations` sniff will now report on new type hints even when the type hint is nullable. [#379](https://github.com/wimg/PHPCompatibility/pull/379)
409
- - :twisted_rightwards_arrows: The `NewNowdoc` sniff has been renamed to `NewNowdocQuotedHeredoc` and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. [#390](https://github.com/wimg/PHPCompatibility/pull/390)
410
- - :rewind: The `NewClasses` sniff will now also report anonymous classes which `extend` a new sniff when used in combination with PHPCS 2.4.0-2.8.0. [#432](https://github.com/wimg/PHPCompatibility/pull/432). Fixes [#334](https://github.com/wimg/PHPCompatibility/issues/334).
411
- - :pencil2: `NewFunctionParameter` sniff: version number precision for two parameters. [#384](https://github.com/wimg/PHPCompatibility/pull/384), [#428](https://github.com/wimg/PHPCompatibility/pull/428)
412
- - :umbrella: Skipping two unit tests for the `ForbiddenClosureUseVariable` sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. [#408](https://github.com/wimg/PHPCompatibility/pull/408)
413
- - :umbrella: Skipping unit tests involving `trait`s in combination with PHP < 5.4 and PHPCS < 2.4.0 as `trait`s are not recognized in those circumstances. [#431](https://github.com/wimg/PHPCompatibility/pull/431)
414
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#385](https://github.com/wimg/PHPCompatibility/pull/385), [#387](https://github.com/wimg/PHPCompatibility/pull/387), [#415](https://github.com/wimg/PHPCompatibility/pull/415), [#423](https://github.com/wimg/PHPCompatibility/pull/423), [#424](https://github.com/wimg/PHPCompatibility/pull/424)
415
- - :recycle: Minor simplification of the PHPUnit 6 compatibility layer and other test code. [#426](https://github.com/wimg/PHPCompatibility/pull/426), [#425](https://github.com/wimg/PHPCompatibility/pull/425)
416
- - General housekeeping. [#398](https://github.com/wimg/PHPCompatibility/pull/398), [#400](https://github.com/wimg/PHPCompatibility/pull/400)
417
- - :wrench: Minor tweaks to the Travis build script. [#409](https://github.com/wimg/PHPCompatibility/pull/409)
418
- - :green_heart: The sniffs are now also tested against PHP nightly for consistent results. [#380](https://github.com/wimg/PHPCompatibility/pull/380)
419
 
420
  ### Fixed
421
- - :fire: Using unbounded ranges in `testVersion` resulted in unreported errors when used with sniffs using the `supportsBelow()` method. This affected the results of approximately half the sniffs. [#430](https://github.com/wimg/PHPCompatibility/pull/430)
422
- - :bug: The `ForbiddenNames` sniff would throw false positives for `use` statements with the `final` modifier in traits. [#402](https://github.com/wimg/PHPCompatibility/pull/402).
423
- - :bug: The `ForbiddenNames` sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. [#413](https://github.com/wimg/PHPCompatibility/pull/413)
424
- - :bug: The `ForbiddenNames` sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. [#419](https://github.com/wimg/PHPCompatibility/pull/419)
425
- - :bug: The `ForbiddenNames` sniff would not always correctly report on use statements importing constants or functions using reserved keywords. [#420](https://github.com/wimg/PHPCompatibility/pull/420)
426
- - :bug: The `NewKeywords` sniff would sometimes fail to report on the `const` keyword when used in a class, but not for a class constant. [#424](https://github.com/wimg/PHPCompatibility/pull/424)
427
- - :green_heart: PHPCS has released version 3.0 and updated the `master` branch to reflect this. This was causing the builds to fail. [#422](https://github.com/wimg/PHPCompatibility/pull/422)
428
 
429
  ### Credits
430
  Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
@@ -438,35 +881,35 @@ See all related issues and PRs in the [7.1.3 milestone].
438
  - :zap: The `testVersion` config parameter now allows for specifying unbounded ranges.
439
  For example: specifying `-5.6` means: check for compatibility with all PHP versions up to and including PHP 5.6;
440
  Specifying `7.0-` means: check for compatibility with all PHP versions from PHP 7.0 upwards.
441
- For more information about setting the `testVersion`, see [Using the compatibility sniffs](https://github.com/wimg/PHPCompatibility#using-the-compatibility-sniffs) in the readme.
442
- - :umbrella: Unit test for multi-line short arrays for the `ShortArray` sniff. [#347](https://github.com/wimg/PHPCompatibility/pull/347)
443
- - :umbrella: Various additional unit tests against false positives. [#345](https://github.com/wimg/PHPCompatibility/pull/345), [#369](https://github.com/wimg/PHPCompatibility/pull/369)
444
- - :umbrella: Unit tests for the `supportsBelow()`, `supportsAbove()` and `getTestVersion()` utility methods. [#363](https://github.com/wimg/PHPCompatibility/pull/363)
445
- - :books: Readme: information about installation of the standard using git check-out. [#349](https://github.com/wimg/PHPCompatibility/pull/349)
446
- - :books: `Contributing.md` file with information about reporting bugs, requesting features, making pull requests and running the unit tests. [#350](https://github.com/wimg/PHPCompatibility/pull/350)
447
 
448
  ### Changed
449
- - :pushpin: The `ForbiddenFunctionParametersWithSameName`, `NewScalarTypeDeclarations`, `ParameterShadowSuperGlobals` sniff will now also sniff for and report violations in closures. [#331](https://github.com/wimg/PHPCompatibility/pull/331)
450
- - :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3 `nowdoc` structure has been moved from the `NewKeywords` sniff to a new stand-alone `NewNowdoc` sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. [#335](https://github.com/wimg/PHPCompatibility/pull/335)
451
- - :rewind: The `ForbiddenNames` sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. [#362](https://github.com/wimg/PHPCompatibility/pull/362)
452
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#360](https://github.com/wimg/PHPCompatibility/pull/360)
453
  - :recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with `testVersion` settings and makes the unit tests run ~6 x faster.
454
- Relevant additional unit tests have been added and others adjusted. [#369](https://github.com/wimg/PHPCompatibility/pull/369)
455
- - :recycle: Refactoring/tidying up of some unit test code. [#343](https://github.com/wimg/PHPCompatibility/pull/343), [#345](https://github.com/wimg/PHPCompatibility/pull/345), [#356](https://github.com/wimg/PHPCompatibility/pull/356), [#355](https://github.com/wimg/PHPCompatibility/pull/355), [#359](https://github.com/wimg/PHPCompatibility/pull/359)
456
- - General housekeeping. [#346](https://github.com/wimg/PHPCompatibility/pull/346)
457
- - :books: Readme: Clarify minimum requirements and influence on the results. [#348](https://github.com/wimg/PHPCompatibility/pull/348)
458
 
459
  ### Removed
460
- - :twisted_rightwards_arrows: Removed the `LongArrays` sniff. The checks it contained have been moved into the `RemovedGlobalVariables` sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. [#354](https://github.com/wimg/PHPCompatibility/pull/354)
461
 
462
  ### Fixed
463
- - :bug: The `PregReplaceEModifier` sniff would throw a false positive if a quote character was used as the regex delimiter. [#357](https://github.com/wimg/PHPCompatibility/pull/357)
464
- - :bug: `RemovedGlobalVariables` sniff would report false positives for class properties shadowing the removed `$HTTP_RAW_POST_DATA` variables. [#354](https://github.com/wimg/PHPCompatibility/pull/354).
465
- - :bug: The `getFQClassNameFromNewToken()` utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). [#338](https://github.com/wimg/PHPCompatibility/pull/338), [#342](https://github.com/wimg/PHPCompatibility/pull/342)
466
- - :bug: The `determineNamespace()` utility method would in certain cases not break out a loop. [#358](https://github.com/wimg/PHPCompatibility/pull/358)
467
- - :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. [#341](https://github.com/wimg/PHPCompatibility/pull/341)
468
- - :wrench: The unit test suite is now also compatible with PHPUnit 6. [#365](https://github.com/wimg/PHPCompatibility/pull/365)
469
- - :books: Readme: Typo in the composer instructions. [#344](https://github.com/wimg/PHPCompatibility/pull/344)
470
 
471
  ### Credits
472
  Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap:
@@ -477,42 +920,42 @@ Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] an
477
  See all related issues and PRs in the [7.1.2 milestone].
478
 
479
  ### Added
480
- - :star2: New `VariableVariables` sniff to detect variables variables for which the behaviour has changed in PHP 7.0. [#310](https://github.com/wimg/PHPCompatibility/pull/310) Fixes [#309](https://github.com/wimg/PHPCompatibility/issues/309).
481
- - :star: The `NewReturnTypeDeclarations` sniff will now also sniff for non-scalar return type declarations, i.e. `array`, `callable`, `self` or a class name. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
482
- - :star: The `NewLanguageConstructs` sniff will now also sniff for the null coalesce equal operator `??=`. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. [#340](https://github.com/wimg/PHPCompatibility/pull/340)
483
- - :star: New `getReturnTypeHintToken()` utility method to the `PHPCompatibility_Sniff` class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. [#323](https://github.com/wimg/PHPCompatibility/pull/323).
484
- - :star: New `stripVariables()` utility method to the `PHPCompatibility_Sniff` class to strip variables from interpolated text strings. [#341](https://github.com/wimg/PHPCompatibility/pull/314).
485
- - :umbrella: Additional unit tests covering previously uncovered code. [#308](https://github.com/wimg/PHPCompatibility/pull/308)
486
 
487
  ### Changed
488
- - :pushpin: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and `NewExecutionDirectives` sniffs will now also correctly interpret double quoted text strings with interpolated variables. [#341](https://github.com/wimg/PHPCompatibility/pull/314), [#324](https://github.com/wimg/PHPCompatibility/pull/324).
489
- - :pushpin: The `NewNullableTypes` sniff will now also report on nullable (return) type hints when used with closures. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
490
- - :pushpin: The `NewReturnTypeDeclarations` sniff will now also report on return type hints when used with closures. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
491
- - :pushpin: Allow for anonymous classes in the `inClassScope()` utility method. [#315](https://github.com/wimg/PHPCompatibility/pull/315)
492
- - :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. [#300](https://github.com/wimg/PHPCompatibility/pull/300)
493
- - :twisted_rightwards_arrows: The `NewScalarReturnTypeDeclarations` sniff has been renamed to `NewReturnTypeDeclarations`. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
494
- - :rewind: The `ForbiddenNames` sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. [#319](https://github.com/wimg/PHPCompatibility/pull/319)
495
- - :rewind: The `NewAnonymousClasses` sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. [#325](https://github.com/wimg/PHPCompatibility/pull/325)
496
- - :rewind: The `NewGroupUseDeclarations` sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. [#320](https://github.com/wimg/PHPCompatibility/pull/320)
497
- - :rewind: The `NewNullableTypes` sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
498
- - :rewind: The `NewReturnTypeDeclarations` sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
499
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#317](https://github.com/wimg/PHPCompatibility/pull/317)
500
- - :recycle: Defer to upstream `hasCondition()` utility method where appropriate. [#315](https://github.com/wimg/PHPCompatibility/pull/315)
501
- - :recycle: Minor refactoring of some unit test code. [#304](https://github.com/wimg/PHPCompatibility/pull/304), [#303](https://github.com/wimg/PHPCompatibility/pull/303), [#318](https://github.com/wimg/PHPCompatibility/pull/318)
502
- - :wrench: All unit tests now have appropriate `@group` annotations allowing for quicker/easier testing of a select group of tests/sniffs. [#305](https://github.com/wimg/PHPCompatibility/pull/305)
503
- - :wrench: All unit tests now have appropriate `@covers` annotations to improve code coverage reporting and remove bleed through of accidental coverage. [#307](https://github.com/wimg/PHPCompatibility/pull/307)
504
- - :wrench: Minor tweaks to the travis script. [#322](https://github.com/wimg/PHPCompatibility/pull/322)
505
- - :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. [#322](https://github.com/wimg/PHPCompatibility/pull/322)
506
 
507
  ### Fixed
508
- - :bug: The `ConstantArraysUsingDefine` sniff would throw false positives if the value of the `define()` was retrieved via a function call and an array parameter was passed. [#327](https://github.com/wimg/PHPCompatibility/pull/327)
509
- - :bug: The `ForbiddenCallTimePassByReference` sniff would throw false positives on assign by reference within function calls or conditions. [#302](https://github.com/wimg/PHPCompatibility/pull/302) Fixes the last two cases reported in [#68](https://github.com/wimg/PHPCompatibility/issues/68#issuecomment-231366445)
510
- - :bug: The `ForbiddenGlobalVariableVariableSniff` sniff would only examine the first variable in a `global ...` statement causing unreported issues if subsequent variables were variable variables. [#316](https://github.com/wimg/PHPCompatibility/pull/316)
511
- - :bug: The `NewKeywords` sniff would throw a false positive for the `const` keyword when encountered in an interface. [#312](https://github.com/wimg/PHPCompatibility/pull/312)
512
- - :bug: The `NewNullableTypes` sniff would not report on nullable return types for namespaced classnames used as a type hint. [#323](https://github.com/wimg/PHPCompatibility/pull/323)
513
- - :bug: The `PregReplaceEModifier` sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of the `e` modifier when an array of regexes was passed. [#300](https://github.com/wimg/PHPCompatibility/pull/300)
514
- - :bug: The `PregReplaceEModifier` sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. [#300](https://github.com/wimg/PHPCompatibility/pull/300)
515
- - :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). [#313](https://github.com/wimg/PHPCompatibility/pull/313), [#323](https://github.com/wimg/PHPCompatibility/pull/323), [#326](https://github.com/wimg/PHPCompatibility/pull/326), [#340](https://github.com/wimg/PHPCompatibility/pull/340)
516
 
517
  ### Credits
518
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -523,10 +966,10 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
523
  See all related issues and PRs in the [7.1.1 milestone].
524
 
525
  ### Added
526
- - :star: `ForbiddenNamesAsDeclared` sniff: detection of the PHP 7.1 `iterable` and `void` reserved keywords when used to name classes, interfaces or traits. [#298](https://github.com/wimg/PHPCompatibility/pull/298)
527
 
528
  ### Fixed
529
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `clone` keyword was used with parenthesis. [#299](https://github.com/wimg/PHPCompatibility/pull/299). Fixes [#284](https://github.com/wimg/PHPCompatibility/issues/284)
530
 
531
  ### Credits
532
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -537,14 +980,14 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
537
  See all related issues and PRs in the [7.1.0 milestone].
538
 
539
  ### Added
540
- - :star: New `stringToErrorCode()`, `arrayKeysToLowercase()` and `addMessage()` utility methods to the `PHPCompatibility_Sniff` class. [#291](https://github.com/wimg/PHPCompatibility/pull/291).
541
 
542
  ### Changed
543
- - :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. [#291](https://github.com/wimg/PHPCompatibility/pull/291)
544
- - :pencil2: Minor changes to some of the error message texts for consistency across sniffs. [#291](https://github.com/wimg/PHPCompatibility/pull/291)
545
- - :recycle: Refactored the complex version sniffs to reduce code duplication. [#291](https://github.com/wimg/PHPCompatibility/pull/291)
546
- - :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. [#291](https://github.com/wimg/PHPCompatibility/pull/291)
547
- - :umbrella: The unit tests for the `RemovedExtensions` sniff now verify that the correct alternative extension is being suggested. [#291](https://github.com/wimg/PHPCompatibility/pull/291)
548
 
549
  ### Credits
550
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -555,28 +998,28 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
555
  See all related issues and PRs in the [7.0.8 milestone].
556
 
557
  ### Added
558
- - :star2: New `ForbiddenNamesAsDeclared` sniff: detection of the [other reserved keywords](http://php.net/manual/en/reserved.other-reserved-words.php) which are reserved as of PHP 7.0 (or higher). [#287](https://github.com/wimg/PHPCompatibility/pull/287). Fixes [#115](https://github.com/wimg/PHPCompatibility/issues/115).
559
  These were previously sniffed for by the `ForbiddenNames` and `ForbiddenNamesAsInvokedFunctions` sniffs causing false positives as the rules for their reservation are different from the rules for "normal" [reserved keywords](http://php.net/manual/en/reserved.keywords.php).
560
- - :star: New `inUseScope()` utility method to the `PHPCompatibility_Sniff` class which handles PHPCS cross-version compatibility when determining the scope of a `use` statement. [#271](https://github.com/wimg/PHPCompatibility/pull/271).
561
- - :umbrella: More unit tests for the `ForbiddenNames` sniff. [#271](https://github.com/wimg/PHPCompatibility/pull/271).
562
 
563
  ### Changed
564
- - :pushpin: _Deprecated_ functionality should throw a `warning`. _Removed_ or otherwise unavailable functionality should throw an `error`. This distinction was previously not consistently applied everywhere. [#286](https://github.com/wimg/PHPCompatibility/pull/286)
565
  This change affects the following sniffs:
566
  * `DeprecatedPHP4StyleConstructors` will now throw a `warning` instead of an `error` for deprecated PHP4 style class constructors.
567
  * `ForbiddenCallTimePassByReference` will now throw a `warning` if the `testVersion` is `5.3` and an `error` if the `testVersion` if `5.4` or higher.
568
  * `MbstringReplaceEModifier` will now throw a `warning` instead of an `error` for usage of the deprecated `e` modifier.
569
- * `PregReplaceEModifier` will now throw a `warning` if the `testVersion` is `5.5` or `5.6` and an `error` if the `testVersion` if `7.0` or higher. Fixes [#290](https://github.com/wimg/PHPCompatibility/issues/290).
570
  * `TernaryOperators` will now throw an `error` when the `testVersion` < `5.3` and the middle part has been omitted.
571
  * `ValidIntegers` will now throw a `warning` when an invalid binary integer is detected.
572
- - :pencil2: `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs: minor change in the sniff error message text. Use _"removed"_ rather than the ominous _"forbidden"_. [#285](https://github.com/wimg/PHPCompatibility/pull/285)
573
  Also updated relevant internal variable names and documentation to match.
574
 
575
  ### Fixed
576
- - :bug: `ForbiddenNames` sniff would throw false positives for `use` statements which changed the visibility of methods in traits. [#271](https://github.com/wimg/PHPCompatibility/pull/271).
577
- - :bug: `ForbiddenNames` sniff would not report reserved keywords when used in combination with `use function` or `use const`. [#271](https://github.com/wimg/PHPCompatibility/pull/271).
578
- - :bug: `ForbiddenNames` sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. [#271](https://github.com/wimg/PHPCompatibility/pull/271).
579
- - :wrench: Composer config: `prefer-stable` should be a root element of the json file. Fixes [#277](https://github.com/wimg/PHPCompatibility/issues/277).
580
 
581
  ### Credits
582
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -587,39 +1030,39 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
587
  See all related issues and PRs in the [7.0.7 milestone].
588
 
589
  ### Added
590
- - :star2: New `ForbiddenBreakContinueOutsideLoop` sniff: verify that `break`/`continue` is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. [#278](https://github.com/wimg/PHPCompatibility/pull/278). Fixes [#275](https://github.com/wimg/PHPCompatibility/issues/275)
591
- - :star2: New `NewConstVisibility` sniff: detect visibility indicators for `class` and `interface` constants as introduced in PHP 7.1. [#280](https://github.com/wimg/PHPCompatibility/pull/280). Fixes [#249](https://github.com/wimg/PHPCompatibility/issues/249)
592
- - :star2: New `NewHashAlgorithms` sniff to check used hash algorithms against the PHP version in which they were introduced. [#242](https://github.com/wimg/PHPCompatibility/pull/242)
593
- - :star2: New `NewMultiCatch` sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. [#281](https://github.com/wimg/PHPCompatibility/pull/281). Fixes [#251](https://github.com/wimg/PHPCompatibility/issues/251)
594
- - :star2: New `NewNullableTypes` sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. [#282](https://github.com/wimg/PHPCompatibility/pull/282). Fixes [#247](https://github.com/wimg/PHPCompatibility/issues/247)
595
- - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.1 removed `session` ini directives. [#256](https://github.com/wimg/PHPCompatibility/pull/256)
596
- - :star: `NewFunctions` sniff: recognize new `socket_export_stream()` function as introduced in PHP 7.0.7. [#264](https://github.com/wimg/PHPCompatibility/pull/264)
597
- - :star: `NewFunctions` sniff: recognize new `curl_...()`, `is_iterable()`, `pcntl_async_signals()`, `session_create_id()`, `session_gc()` functions as introduced in PHP 7.1. [#273](https://github.com/wimg/PHPCompatibility/pull/273)
598
- - :star: `NewFunctionParameters` sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. [#258](https://github.com/wimg/PHPCompatibility/pull/258)
599
- - :star: `NewIniDirectives` sniff: recognize new `session` ini directives as introduced in PHP 7.1. [#259](https://github.com/wimg/PHPCompatibility/pull/259)
600
- - :star: `NewScalarReturnTypeDeclarations` sniff: recognize PHP 7.1 `void` return type hint. [#250](https://github.com/wimg/PHPCompatibility/pull/250)
601
- - :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.1 `iterable` type hint. [#255](https://github.com/wimg/PHPCompatibility/pull/255)
602
- - :star: Recognize the PHP 7.1 deprecated `mcrypt` functionality in the `RemovedExtensions`, `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs. [#257](https://github.com/wimg/PHPCompatibility/pull/257)
603
 
604
  ### Changed
605
- - :pushpin: `LongArrays` sniff used to only throw `warning`s. It will now throw `error`s for PHP versions in which the long superglobals have been removed. [#270](https://github.com/wimg/PHPCompatibility/pull/270)
606
- - :pushpin: The `NewIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a new ini directive is used in combination with `ini_set()`. [#246](https://github.com/wimg/PHPCompatibility/pull/246).
607
- - :pushpin: `RemovedHashAlgorithms` sniff: also recognize removed algorithms when used with the PHP 5.5+ `hash_pbkdf2()` function. [#240](https://github.com/wimg/PHPCompatibility/pull/240)
608
- - :pushpin: Properly recognize nullable type hints in the `getMethodParameters()` utility method. [#282](https://github.com/wimg/PHPCompatibility/pull/282)
609
- - :pencil2: `DeprecatedPHP4StyleConstructors` sniff: minor error message text fix. [#236](https://github.com/wimg/PHPCompatibility/pull/236)
610
- - :pencil2: `NewIniDirectives` sniff: improved precision for the introduction version numbers being reported. [#246](https://github.com/wimg/PHPCompatibility/pull/246)
611
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#238](https://github.com/wimg/PHPCompatibility/pull/238), [#244](https://github.com/wimg/PHPCompatibility/pull/244), [#240](https://github.com/wimg/PHPCompatibility/pull/240), [#276](https://github.com/wimg/PHPCompatibility/pull/276)
612
- - :umbrella: Re-activate the unit tests for the `NewScalarReturnTypeDeclarations` sniff. [#250](https://github.com/wimg/PHPCompatibility/pull/250)
613
 
614
  ### Fixed
615
- - :bug: The `DeprecatedPHP4StyleConstructors` sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. [#236](https://github.com/wimg/PHPCompatibility/pull/236)
616
- - :bug: `LongArrays` sniff would report false positives for class properties shadowing removed PHP superglobals. [#270](https://github.com/wimg/PHPCompatibility/pull/270). Fixes [#268](https://github.com/wimg/PHPCompatibility/issues/268).
617
- - :bug: The `NewClasses` sniff would not report errors when the case of the class name used and "official" class name did not match. [#237](https://github.com/wimg/PHPCompatibility/pull/237)
618
- - :bug: The `NewIniDirectives` sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. [#246](https://github.com/wimg/PHPCompatibility/pull/246)
619
- - :bug: `PregReplaceEModifier` sniff would report false positives for compound regex parameters with different quote types. [#266](https://github.com/wimg/PHPCompatibility/pull/266). Fixes [#265](https://github.com/wimg/PHPCompatibility/issues/265).
620
- - :bug: `RemovedGlobalVariables` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#245](https://github.com/wimg/PHPCompatibility/pull/245).
621
- - :bug: The `RemovedHashAlgorithms` sniff would not report errors when the case of the hash function name used and "official" class name did not match. [#240](https://github.com/wimg/PHPCompatibility/pull/240)
622
- - :bug: The `ShortArray` sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. [#238](https://github.com/wimg/PHPCompatibility/pull/238)
623
 
624
  ### Credits
625
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -630,27 +1073,27 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
630
  See all related issues and PRs in the [7.0.6 milestone].
631
 
632
  ### Added
633
- - :star: New `stripQuotes()` utility method in the `PHPCompatibility_Sniff` base class to strip quotes which surround text strings in a consistent manner. [#224](https://github.com/wimg/PHPCompatibility/pull/224)
634
- - :books: Readme: Add _PHP Version Support_ section. [#225](https://github.com/wimg/PHPCompatibility/pull/225)
635
 
636
  ### Changed
637
- - :pushpin: The `ForbiddenCallTimePassByReference` sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. [#203](https://github.com/wimg/PHPCompatibility/pull/203)
638
- - :pushpin: The `NewFunctionArrayDereferencing` sniff will now also check _method_ calls for array dereferencing, not just function calls. [#229](https://github.com/wimg/PHPCompatibility/pull/229). Fixes [#227](https://github.com/wimg/PHPCompatibility/issues/227).
639
- - :pencil2: The `NewExecutionDirectives` sniff will now throw `warning`s instead of `error`s for invalid values encountered in execution directives. [#223](https://github.com/wimg/PHPCompatibility/pull/223)
640
- - :pencil2: Minor miscellaneous fixes. [#231](https://github.com/wimg/PHPCompatibility/pull/231)
641
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#219](https://github.com/wimg/PHPCompatibility/pull/219), [#203](https://github.com/wimg/PHPCompatibility/pull/203)
642
- - :recycle: Defer to upstream `findImplementedInterfaceNames()` utility method when it exists. [#222](https://github.com/wimg/PHPCompatibility/pull/222)
643
- - :wrench: Exclude the test files from analysis by Scrutinizer CI. [#230](https://github.com/wimg/PHPCompatibility/pull/230)
644
 
645
  ### Removed
646
- - :no_entry_sign: Some redundant code. [#232](https://github.com/wimg/PHPCompatibility/pull/232)
647
 
648
  ### Fixed
649
- - :bug: The `EmptyNonVariable` sniff would throw false positives for variable variables and for array access with a (partially) variable array index. [#212](https://github.com/wimg/PHPCompatibility/pull/212). Fixes [#210](https://github.com/wimg/PHPCompatibility/issues/210).
650
- - :bug: The `NewFunctionArrayDereferencing` sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. [#228](https://github.com/wimg/PHPCompatibility/pull/228). Fixes [#226](https://github.com/wimg/PHPCompatibility/issues/226).
651
- - :bug: `ParameterShadowSuperGlobals` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#218](https://github.com/wimg/PHPCompatibility/pull/218). Fixes [#214](https://github.com/wimg/PHPCompatibility/issues/214).
652
- - :bug: The `determineNamespace()` utility method now accounts properly for namespaces within scoped `declare()` statements. [#221](https://github.com/wimg/PHPCompatibility/pull/221)
653
- - :books: Readme: Logo alignment in the Credits section. [#233](https://github.com/wimg/PHPCompatibility/pull/233)
654
 
655
  ### Credits
656
  Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
@@ -661,36 +1104,36 @@ Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clement
661
  See all related issues and PRs in the [7.0.5 milestone].
662
 
663
  ### Added
664
- - :star2: New `MbstringReplaceEModifier` sniff to detect the use of the PHP 7.1 deprecated `e` modifier in Mbstring regex functions. [#202](https://github.com/wimg/PHPCompatibility/pull/202)
665
- - :star: The `ForbiddenBreakContinueVariableArguments` sniff will now also report on `break 0`/`continue 0` which is not allowed since PHP 5.4. [#209](https://github.com/wimg/PHPCompatibility/pull/209)
666
- - :star: New `getFunctionCallParameters()`, `getFunctionCallParameter()` utility methods in the `PHPCompatibility_Sniff` base class. [#170](https://github.com/wimg/PHPCompatibility/pull/170)
667
- - :star: New `tokenHasScope()` utility method in the `PHPCompatibility_Sniff` base class. [#189](https://github.com/wimg/PHPCompatibility/pull/189)
668
- - :umbrella: Unit test for `goto` and `callable` detection and some other miscellanous extra unit tests for the `NewKeywords` sniff. [#189](https://github.com/wimg/PHPCompatibility/pull/189)
669
- - :books: Readme: Information for sniff developers about running unit tests for _other_ sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. [#217](https://github.com/wimg/PHPCompatibility/pull/217)
670
 
671
  ### Changed
672
- - :pushpin: The `ForbiddenNames` sniff will now also check interface declarations for usage of reserved keywords. [#200](https://github.com/wimg/PHPCompatibility/pull/200)
673
- - :pushpin: `PregReplaceEModifier` sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. [#201](https://github.com/wimg/PHPCompatibility/pull/201)
674
- - :rewind: The `NewKeywords` sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. [#189](https://github.com/wimg/PHPCompatibility/pull/189)
675
- - :pencil2: `PregReplaceEModifier` sniff: minor improvement to the error message text. [#201](https://github.com/wimg/PHPCompatibility/pull/201)
676
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#170](https://github.com/wimg/PHPCompatibility/pull/170), [#188](https://github.com/wimg/PHPCompatibility/pull/188), [#189](https://github.com/wimg/PHPCompatibility/pull/189), [#199](https://github.com/wimg/PHPCompatibility/pull/199), [#200](https://github.com/wimg/PHPCompatibility/pull/200), [#201](https://github.com/wimg/PHPCompatibility/pull/201), [#208](https://github.com/wimg/PHPCompatibility/pull/208)
677
- - :wrench: The unit tests for the utility methods have been moved to their own subdirectory within `Tests`. [#215](https://github.com/wimg/PHPCompatibility/pull/215)
678
- - :green_heart: The sniffs are now also tested against PHP 7.1 for consistent results. [#216](https://github.com/wimg/PHPCompatibility/pull/216)
679
 
680
  ### Removed
681
- - :no_entry_sign: Some redundant code. [26d0b6](https://github.com/wimg/PHPCompatibility/commit/26d0b6cf0921f75d93a4faaf09c390f386dde9ff) and [841616](https://github.com/wimg/PHPCompatibility/commit/8416162ea81f4067226324f5948f4a50f7958a9b)
682
 
683
  ### Fixed
684
- - :bug: `ConstantArraysUsingDefine` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#199](https://github.com/wimg/PHPCompatibility/pull/199)
685
- - :bug: The `DeprecatedIniDirectives` and `NewIniDirectives` sniffs could potentially trigger on the ini value instead of the ini directive name. [#170](https://github.com/wimg/PHPCompatibility/pull/170)
686
- - :bug: `ForbiddenNames` sniff: Reserved keywords when used as the name of a constant declared using `define()` would always be reported independently of the `testVersion` set. [#200](https://github.com/wimg/PHPCompatibility/pull/200)
687
- - :bug: `PregReplaceEModifier` sniff would not report errors when the function name used was not in lowercase. [#201](https://github.com/wimg/PHPCompatibility/pull/201)
688
- - :bug: `TernaryOperators` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#188](https://github.com/wimg/PHPCompatibility/pull/188)
689
- - :bug: The `getFQClassNameFromNewToken()` and `getFQClassNameFromDoubleColonToken()` utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. [#206](https://github.com/wimg/PHPCompatibility/pull/206). Fixes [#205](https://github.com/wimg/PHPCompatibility/issues/205).
690
- - :bug: The `getFunctionCallParameters()` utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The `getFunctionCallParameters()` utility method also did not handle parameters passed as short arrays correctly. [#213](https://github.com/wimg/PHPCompatibility/pull/213). Fixes [#211](https://github.com/wimg/PHPCompatibility/issues/211).
691
- - :umbrella: Unit tests for the `NewFunctionArrayDereferencing` sniff were not being run due to a naming error. [#208](https://github.com/wimg/PHPCompatibility/pull/208)
692
- - :books: Readme: Information about setting the `testVersion` from a custom ruleset was incorrect. [#204](https://github.com/wimg/PHPCompatibility/pull/204)
693
- - :wrench: Path to PHPCS in the unit tests breaking for non-Composer installs. [#198](https://github.com/wimg/PHPCompatibility/pull/198)
694
 
695
  ### Credits
696
  Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their contributions to this version. :clap:
@@ -701,32 +1144,32 @@ Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their con
701
  See all related issues and PRs in the [7.0.4 milestone].
702
 
703
  ### Added
704
- - :star2: New `EmptyNonVariable` sniff: detection of empty being used on non-variables for PHP < 5.5. [#187](https://github.com/wimg/PHPCompatibility/pull/187)
705
- - :star2: New `NewMagicMethods` sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the `__toString()` magic method in PHP 5.2. [#176](https://github.com/wimg/PHPCompatibility/pull/176). Fixes [#64](https://github.com/wimg/PHPCompatibility/issues/64).
706
- - :star2: New `RemovedAlternativePHPTags` sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. [#184](https://github.com/wimg/PHPCompatibility/pull/184), [#193](https://github.com/wimg/PHPCompatibility/pull/193). Fixes [#127](https://github.com/wimg/PHPCompatibility/issues/127).
707
  - :star: `NonStaticMagicMethods` sniff: detection of the `__callStatic()`, `__sleep()`, `__toString()` and `__set_state()` magic methods.
708
- - :green_heart: Lint all non-test case files for syntax errors during the build testing by Travis. [#192](https://github.com/wimg/PHPCompatibility/pull/192)
709
 
710
  ### Changed
711
- - :pushpin: `NonStaticMagicMethods` sniff: will now also sniff `trait`s for magic methods. [#174](https://github.com/wimg/PHPCompatibility/pull/174)
712
- - :pushpin: `NonStaticMagicMethods` sniff: will now also check for magic methods which should be declared as `static`. [#174](https://github.com/wimg/PHPCompatibility/pull/174)
713
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#178](https://github.com/wimg/PHPCompatibility/pull/178), [#179](https://github.com/wimg/PHPCompatibility/pull/179), [#174](https://github.com/wimg/PHPCompatibility/pull/174), [#171](https://github.com/wimg/PHPCompatibility/pull/171)
714
- - :recycle: The unit test suite now internally caches PHPCS run results in combination with a set `testVersion` to speed up the running of the unit tests. These are now ~3 x faster. [#148](https://github.com/wimg/PHPCompatibility/pull/148)
715
  - :books: Readme: Minor clarification of the minimum requirements.
716
  - :books: Readme: Advise to use the latest stable version of this repository.
717
- - :wrench: The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. [#191](https://github.com/wimg/PHPCompatibility/pull/191).
718
- - :wrench: Improved coveralls configuration and compatibility. [#194](https://github.com/wimg/PHPCompatibility/pull/194)
719
- - :green_heart: The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. [#196](https://github.com/wimg/PHPCompatibility/pull/196)
720
 
721
  ### Fixed
722
- - :bug: The `ForbiddenBreakContinueVariableArguments` sniff would not report on `break`/`continue` with a closure as an argument. [#171](https://github.com/wimg/PHPCompatibility/pull/171)
723
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on reserved keywords which were not lowercase. [#186](https://github.com/wimg/PHPCompatibility/pull/186)
724
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on the `goto` and `namespace` keywords when run on PHP 5.2. [#193](https://github.com/wimg/PHPCompatibility/pull/193)
725
- - :bug: `NewAnonymousClasses` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#195](https://github.com/wimg/PHPCompatibility/pull/195).
726
- - :bug: `NewGroupUseDeclarations` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#190](https://github.com/wimg/PHPCompatibility/pull/190).
727
- - :bug: The `NonStaticMagicMethods` sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. [#174](https://github.com/wimg/PHPCompatibility/pull/174)
728
- - :wrench: The unit tests would exit with `0` if PHPCS could not be found. [#191](https://github.com/wimg/PHPCompatibility/pull/191)
729
- - :green_heart: The PHPCompatibility library itself was not fully compatible with PHP 5.2. [#193](https://github.com/wimg/PHPCompatibility/pull/193)
730
 
731
  ### Credits
732
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -737,65 +1180,65 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
737
  See all related issues and PRs in the [7.0.3 milestone].
738
 
739
  ### Added
740
- - :star2: New `InternalInterfaces` sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. [#144](https://github.com/wimg/PHPCompatibility/pull/144)
741
- - :star2: New `LateStaticBinding` sniff: detection of PHP 5.3 late static binding. [#177](https://github.com/wimg/PHPCompatibility/pull/177)
742
- - :star2: New `NewExecutionDirectives` sniff: verify execution directives set with `declare()`. [#169](https://github.com/wimg/PHPCompatibility/pull/169)
743
- - :star2: New `NewInterfaces` sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the `Serializable` interface. [#144](https://github.com/wimg/PHPCompatibility/pull/144)
744
- - :star2: New `RequiredOptionalFunctionParameters` sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. [#165](https://github.com/wimg/PHPCompatibility/pull/165)
745
- - :star2: New `ValidIntegers` sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. [#160](https://github.com/wimg/PHPCompatibility/pull/160). Fixes [#55](https://github.com/wimg/PHPCompatibility/issues/55).
746
- - :star: `DeprecatedExtensions` sniff: detect removal of the `ereg` extension in PHP 7. [#149](https://github.com/wimg/PHPCompatibility/pull/149)
747
- - :star: `DeprecatedFunctions` sniff: detection of the PHP 5.0.5 deprecated `php_check_syntax()` and PHP 5.4 deprecated `mysqli_get_cache_stats()` functions. [#155](https://github.com/wimg/PHPCompatibility/pull/155).
748
- - :star: `DeprecatedFunctions` sniff: detect deprecation of a number of the `mysqli` functions in PHP 5.3. [#149](https://github.com/wimg/PHPCompatibility/pull/149)
749
- - :star: `DeprecatedFunctions` sniff: detect removal of the `call_user_method()`, `ldap_sort()`, `ereg_*()` and `mysql_*()` functions in PHP 7.0. [#149](https://github.com/wimg/PHPCompatibility/pull/149)
750
- - :star: `DeprecatedIniDirectives` sniff: detection of a _lot_ more deprecated/removed ini directives. [#146](https://github.com/wimg/PHPCompatibility/pull/146)
751
- - :star: `NewFunctionParameters` sniff: detection of a _lot_ more new function parameters. [#164](https://github.com/wimg/PHPCompatibility/pull/164)
752
- - :star: `NewFunctions` sniff: detection of numerous extra new functions. [#161](https://github.com/wimg/PHPCompatibility/pull/161)
753
- - :star: `NewIniDirectives` sniff: detection of a _lot_ more new ini directives. [#146](https://github.com/wimg/PHPCompatibility/pull/146)
754
- - :star: `NewLanguageConstructs` sniff: detection of the PHP 5.6 ellipsis `...` construct. [#175](https://github.com/wimg/PHPCompatibility/pull/175)
755
- - :star: `NewScalarTypeDeclarations` sniff: detection of PHP 5.1 `array` and PHP 5.4 `callable` type hints. [#168](https://github.com/wimg/PHPCompatibility/pull/168)
756
- - :star: `RemovedFunctionParameters` sniff: detection of a few extra removed function parameters. [#163](https://github.com/wimg/PHPCompatibility/pull/163)
757
- - :star: Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream `Generic.NamingConventions.CamelCapsFunctionName` sniff is re-used for this with some customization. [#173](https://github.com/wimg/PHPCompatibility/pull/173)
758
- - :star: New `getFQClassNameFromNewToken()`, `getFQExtendedClassName()`, `getFQClassNameFromDoubleColonToken()`, `getFQName()`, `isNamespaced()`, `determineNamespace()` and `getDeclaredNamespaceName()` utility methods in the `PHPCompatibility_Sniff` base class for namespace determination. [#162](https://github.com/wimg/PHPCompatibility/pull/162)
759
- - :recycle: New `inClassScope()` utility method in the `PHPCompatibility_Sniff` base class. [#168](https://github.com/wimg/PHPCompatibility/pull/168)
760
- - :recycle: New `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods in the `PHPCompatibility_Sniff` base class. [#153](https://github.com/wimg/PHPCompatibility/pull/153)
761
  - :umbrella: Unit test for `__halt_compiler()` detection by the `NewKeywords` sniff.
762
- - :umbrella: Unit tests for the `NewFunctions` sniff. [#161](https://github.com/wimg/PHPCompatibility/pull/161)
763
- - :umbrella: Unit tests for the `ParameterShadowSuperGlobals` sniff. [#180](https://github.com/wimg/PHPCompatibility/pull/180)
764
- - :wrench: Minimal config for Scrutinizer CI. [#145](https://github.com/wimg/PHPCompatibility/pull/145).
765
 
766
  ### Changed
767
- - :pushpin: The `DeprecatedIniDirectives` and the `NewIniDirectives` sniffs will now indicate an alternative ini directive in case the directive has been renamed. [#146](https://github.com/wimg/PHPCompatibility/pull/146)
768
- - :pushpin: The `NewClasses` sniff will now also report on new classes being extended by child classes. [#140](https://github.com/wimg/PHPCompatibility/pull/140).
769
- - :pushpin: The `NewClasses` sniff will now also report on static use of new classes. [#162](https://github.com/wimg/PHPCompatibility/pull/162).
770
- - :pushpin: The `NewScalarTypeDeclarations` sniff will now throw an error on use of type hints pre-PHP 5.0. [#168](https://github.com/wimg/PHPCompatibility/pull/168)
771
- - :pushpin: The `NewScalarTypeDeclarations` sniff will now verify type hints used against typical mistakes. [#168](https://github.com/wimg/PHPCompatibility/pull/168)
772
- - :pushpin: The `ParameterShadowSuperGlobals` sniff will now do a case-insensitive variable name compare. [#180](https://github.com/wimg/PHPCompatibility/pull/180)
773
- - :pushpin: The `RemovedFunctionParameters` sniff will now also report `warning`s on deprecation of function parameters. [#163](https://github.com/wimg/PHPCompatibility/pull/163)
774
- - :twisted_rightwards_arrows: The check for `JsonSerializable` has been moved from the `NewClasses` sniff to the `NewInterfaces` sniff. [#162](https://github.com/wimg/PHPCompatibility/pull/162)
775
- - :rewind: The `NewLanguageConstructs` sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. [#175](https://github.com/wimg/PHPCompatibility/pull/175)
776
- - :pencil2: `NewFunctionParameters` sniff: use correct name for the new parameter for the `dirname()` function. [#164](https://github.com/wimg/PHPCompatibility/pull/164)
777
- - :pencil2: `NewScalarTypeDeclarations` sniff: minor change in the sniff error message text. [#168](https://github.com/wimg/PHPCompatibility/pull/168)
778
- - :pencil2: `RemovedFunctionParameters` sniff: minor change in the sniff error message text. [#163](https://github.com/wimg/PHPCompatibility/pull/163)
779
- - :pencil2: The `ParameterShadowSuperGlobals` sniff now extends the `PHPCompatibility_Sniff` class. [#180](https://github.com/wimg/PHPCompatibility/pull/180)
780
- - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#181](https://github.com/wimg/PHPCompatibility/pull/181), [#182](https://github.com/wimg/PHPCompatibility/pull/182), [#166](https://github.com/wimg/PHPCompatibility/pull/166), [#167](https://github.com/wimg/PHPCompatibility/pull/167), [#172](https://github.com/wimg/PHPCompatibility/pull/172), [#180](https://github.com/wimg/PHPCompatibility/pull/180), [#146](https://github.com/wimg/PHPCompatibility/pull/146), [#138](https://github.com/wimg/PHPCompatibility/pull/138)
781
- - :recycle: Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. [#139](https://github.com/wimg/PHPCompatibility/pull/139), [#149](https://github.com/wimg/PHPCompatibility/pull/149)
782
 
783
  ### Fixed
784
- - :bug: The `DeprecatedFunctions` sniff was reporting an incorrect deprecation/removal version number for a few functions. [#149](https://github.com/wimg/PHPCompatibility/pull/149)
785
- - :bug: The `DeprecatedIniDirectives` sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. [#146](https://github.com/wimg/PHPCompatibility/pull/146)
786
- - :bug: The `DeprecatedPHP4StyleConstructors` sniff would cause false positives for methods with the same name as the class in namespaced classes. [#167](https://github.com/wimg/PHPCompatibility/pull/167)
787
- - :bug: The `ForbiddenEmptyListAssignment` sniff did not report errors when there were only comments or parentheses between the list parentheses. [#166](https://github.com/wimg/PHPCompatibility/pull/166)
788
- - :bug: The `ForbiddenEmptyListAssignment` sniff will no longer cause false positives during live coding. [#166](https://github.com/wimg/PHPCompatibility/pull/166)
789
- - :bug: The `NewClasses` sniff would potentially misidentify namespaced classes as PHP native classes. [#161](https://github.com/wimg/PHPCompatibility/pull/162)
790
- - :bug: The `NewFunctions` sniff would fail to identify called functions when the function call was not lowercase. [#161](https://github.com/wimg/PHPCompatibility/pull/161)
791
- - :bug: The `NewFunctions` sniff would potentially misidentify namespaced userland functions as new functions. [#161](https://github.com/wimg/PHPCompatibility/pull/161)
792
- - :bug: The `NewIniDirectives` sniff was reporting an incorrect introduction version number for a few ini directives. [#146](https://github.com/wimg/PHPCompatibility/pull/146)
793
- - :bug: `NewKeywords` sniff: the use of the `const` keyword should only be reported when used outside of a class for PHP < 5.3. [#147](https://github.com/wimg/PHPCompatibility/pull/147). Fixes [#129](https://github.com/wimg/PHPCompatibility/issues/129).
794
- - :bug: The `RemovedExtensions` sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. [#156](https://github.com/wimg/PHPCompatibility/pull/156)
795
- - :bug: :recycle: The `NewFunctionParameters` and `RemovedFunctionParameters` now use the new `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods for improved accuracy in identifying function parameters. This fixes several false positives. [#153](https://github.com/wimg/PHPCompatibility/pull/153) Fixes [#120](https://github.com/wimg/PHPCompatibility/issues/120), [#151](https://github.com/wimg/PHPCompatibility/issues/151), [#152](https://github.com/wimg/PHPCompatibility/issues/152).
796
- - :bug: A number of sniffs would return `false` if the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. [#138](https://github.com/wimg/PHPCompatibility/pull/138)
797
- - :wrench: The unit tests would fail to run when used in combination with a PEAR install of PHPCS. [#157](https://github.com/wimg/PHPCompatibility/pull/157).
798
- - :green_heart: Unit tests failing against PHPCS 2.6.1. [#158](https://github.com/wimg/PHPCompatibility/pull/158)
799
  The unit tests *will* still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context.
800
 
801
  ### Credits
@@ -807,13 +1250,13 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
807
  See all related issues and PRs in the [7.0.2 milestone].
808
 
809
  ### Added
810
- - :star: `RemovedExtensions` sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. [#130](https://github.com/wimg/PHPCompatibility/pull/130). Fixes [#123](https://github.com/wimg/PHPCompatibility/issues/123).
811
- To use this feature, add the `functionWhitelist` property in your custom ruleset. For more information, see the [README](https://github.com/wimg/PHPCompatibility#phpcompatibility-specific-options).
812
 
813
  ### Changed
814
- - :pencil2: A number of sniffs contained `public` class properties. Within PHPCS, `public` properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to `protected`. [#135](https://github.com/wimg/PHPCompatibility/pull/135)
815
  - :wrench: Composer config: Stable packages are preferred over unstable/dev.
816
- - :pencil2: Ruleset name. [#134](https://github.com/wimg/PHPCompatibility/pull/134)
817
 
818
  ### Credits
819
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
@@ -824,18 +1267,18 @@ Thanks go out to [Juliette Reinders Folmer] for her contributions to this versio
824
  See all related issues and PRs in the [7.0.1 milestone].
825
 
826
  ### Changed
827
- - :pushpin: The `DeprecatedIniDirectives` sniff used to throw an `error` when a deprecated ini directive was used in combination with `ini_get()`. It will now throw a `warning` instead. [#122](https://github.com/wimg/PHPCompatibility/pull/122) Fixes [#119](https://github.com/wimg/PHPCompatibility/issues/119).
828
  Usage of deprecated ini directives in combination with `ini_set()` will still throw an `error`.
829
- - :pushpin: The `PregReplaceEModifier` sniff now also detects the `e` modifier when used with the `preg_filter()` function. While this is undocumented, the `e` modifier was supported by the `preg_filter()` function as well. [#128](https://github.com/wimg/PHPCompatibility/pull/128)
830
- - :pencil2: The `RemovedExtensions` sniff contained superfluous deprecation information in the error message. [#131](https://github.com/wimg/PHPCompatibility/pull/131)
831
 
832
  ### Removed
833
- - :wrench: Duplicate builds from the Travis CI build matrix. [#132](https://github.com/wimg/PHPCompatibility/pull/132)
834
 
835
  ### Fixed
836
- - :bug: The `ForbiddenNames` sniff did not allow for the PHP 5.6 `use function ...` and `use const ...` syntax. [#126](https://github.com/wimg/PHPCompatibility/pull/126) Fixes [#124](https://github.com/wimg/PHPCompatibility/issues/124).
837
- - :bug: The `NewClasses` sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. `new NewClass;`. [#121](https://github.com/wimg/PHPCompatibility/pull/121)
838
- - :bug: The `PregReplaceEModifier` sniff failed to detect the `e` modifier when using bracket delimiters for the regex other than the `{}` brackets. [#128](https://github.com/wimg/PHPCompatibility/pull/128)
839
  - :green_heart: Unit tests failing against PHPCS 2.6.1.
840
 
841
  ### Credits
@@ -847,57 +1290,58 @@ Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Ryan Neufeld
847
  See all related issues and PRs in the [7.0 milestone].
848
 
849
  ### Added
850
- - :zap: Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. `--runtime-set testVersion 5.0-5.4` will now test your code for compatibility with PHP 5.0 up to PHP 5.4. [#99](https://github.com/wimg/PHPCompatibility/pull/99)
851
- - :star2: New `NewFunctionArrayDereferencing` sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes [#52](https://github.com/wimg/PHPCompatibility/issues/52).
852
- - :star2: New `ShortArray` sniff to detect short array syntax as introduced in PHP 5.4. [#97](https://github.com/wimg/PHPCompatibility/pull/97). Fixes [#47](https://github.com/wimg/PHPCompatibility/issues/47).
853
- - :star2: New `TernaryOperators` sniff to detect ternaries without the middle part (`elvis` operator) as introduced in PHP 5.3. [#101](https://github.com/wimg/PHPCompatibility/pull/101), [#103](https://github.com/wimg/PHPCompatibility/pull/103). Fixes [#49](https://github.com/wimg/PHPCompatibility/issues/49).
854
- - :star2: New `ConstantArraysUsingDefine` sniff to detect constants declared using `define()` being assigned an `array` value which was not allowed prior to PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
855
- - :star2: New `DeprecatedPHP4StyleConstructors` sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. [#109](https://github.com/wimg/PHPCompatibility/pull/109).
856
- - :star2: New `ForbiddenEmptyListAssignment` sniff to detect empty list() assignments which have been removed in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
857
- - :star2: New `ForbiddenFunctionParametersWithSameName` sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
858
- - :star2: New `ForbiddenGlobalVariableVariable` sniff to detect variable variables being made `global` which is not allowed since PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
859
- - :star2: New `ForbiddenNegativeBitshift` sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
860
- - :star2: New `ForbiddenSwitchWithMultipleDefaultBlocks` sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
861
- - :star2: New `NewAnonymousClasses` sniff to detect anonymous classes as introduced in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
862
- - :star2: New `NewFunctionParameters` sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+ `before_needle` parameter for the `strstr()` function. [#110](https://github.com/wimg/PHPCompatibility/pull/110), [#112](https://github.com/wimg/PHPCompatibility/pull/112). Fixes [#27](https://github.com/wimg/PHPCompatibility/issues/27).
863
- - :star2: New `NewGroupUseDeclarations` sniff to detect group use declarations as introduced in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
864
- - :star2: New `NewScalarReturnTypeDeclarations` sniff to detect scalar return type hints as introduced in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
865
- - :star2: New `NewScalarTypeDeclarations` sniff to detect scalar function parameter type hints as introduced in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
866
- - :star2: New `RemovedFunctionParameters` sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
867
- - :star2: New `RemovedGlobalVariables` sniff to detect the PHP 7.0 removed `$HTTP_RAW_POST_DATA` superglobal. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
868
- - :star: `DeprecatedFunctions` sniff: detection of the PHP 5.4 deprecated OCI8 functions. [#93](https://github.com/wimg/PHPCompatibility/pull/93)
869
- - :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize PHP 5.5 `finally` as a reserved keywords when invoked as a function. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
870
- - :star: `NewKeywords` sniff: detection of the use of the PHP 5.1+ `__halt_compiler` keyword. Fixes [#50](https://github.com/wimg/PHPCompatibility/issues/50).
871
- - :star: `NewKeywords` sniff: detection of the PHP 5.3+ `nowdoc` syntax. Fixes [#48](https://github.com/wimg/PHPCompatibility/issues/48).
872
- - :star: `NewKeywords` sniff: detection of the use of the `const` keyword outside of a class for PHP < 5.3. Fixes [#50](https://github.com/wimg/PHPCompatibility/issues/50).
873
- - :star: `DeprecatedFunctions` sniff: recognize PHP 7.0 deprecated and removed functions. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
874
- - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.0 removed ini directives. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
875
- - :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
876
- - :star: `ForbiddenNames` sniff: recognize new PHP 7.0 reserved keywords. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
877
- - :star: `NewFunctions` sniff: recognize new functions as introduced in PHP 7.0. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
878
- - :star: `NewLanguageConstructs` sniff: recognize new PHP 7.0 `<=>` "spaceship" and `??` null coalescing operators. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
879
- - :star: `RemovedExtensions` sniff: recognize PHP 7.0 removed `ereg`, `mssql`, `mysql` and `sybase_ct` extensions. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
880
- - :umbrella: Additional unit tests for the `NewLanguageConstructs` sniff. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
 
881
  - :books: Readme: New section containing information about the use of the `testVersion` config variable.
882
  - :books: Readme: Sponsor credits.
883
 
884
  ### Changed
885
- - :pushpin: The `DeprecatedIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a removed ini directive is used. [#110](https://github.com/wimg/PHPCompatibility/pull/110).
886
- - :pushpin: The `DeprecatedNewReference` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
887
- - :pushpin: The `ForbiddenNames` sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. [#108](https://github.com/wimg/PHPCompatibility/pull/108), [#110](https://github.com/wimg/PHPCompatibility/pull/110).
888
- - :pushpin: The `PregReplaceEModifier` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/wimg/PHPCompatibility/pull/110)
889
- - :pencil2: `NewKeywords` sniff: clarified the error message text for the `use` keyword. Fixes [#46](https://github.com/wimg/PHPCompatibility/issues/46).
890
- - :recycle: Minor refactor of the `testVersion` related utility functions. [#98](https://github.com/wimg/PHPCompatibility/pull/98)
891
- - :wrench: Add autoload to the `composer.json` file. [#96](https://github.com/wimg/PHPCompatibility/pull/96) Fixes [#67](https://github.com/wimg/PHPCompatibility/issues/67).
892
- - :wrench: Minor other updates to the `composer.json` file. [#75](https://github.com/wimg/PHPCompatibility/pull/75)
893
  - :wrench: Improved creation of the code coverage reports needed by coveralls via Travis.
894
  - :green_heart: The sniffs are now also tested against PHP 7.0 for consistent results.
895
 
896
  ### Fixed
897
- - :bug: The `ForbiddenCallTimePassByReference` sniff was throwing `Undefined index` notices when used in combination with PHPCS 2.2.0. [#100](https://github.com/wimg/PHPCompatibility/pull/100). Fixes [#42](https://github.com/wimg/PHPCompatibility/issues/42).
898
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `throw` keyword was used with parenthesis. Fixes [#118](https://github.com/wimg/PHPCompatibility/issues/118).
899
- - :bug: The `PregReplaceEModifier` sniff incorrectly identified `e`'s in the pattern as the `e` modifier when using `{}` bracket delimiters for the regex. [#94](https://github.com/wimg/PHPCompatibility/pull/94)
900
- - :bug: The `RemovedExtensions` sniff was throwing an `error` instead of a `warning` for deprecated, but not (yet) removed extensions. Fixes [#62](https://github.com/wimg/PHPCompatibility/issues/62).
901
 
902
  ### Credits
903
  Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [Eugene Maslovich], [Ken Guest], Koen Eelen, [Komarov Alexey], [Mark Clements] and [Remko van Bezooijen] for their contributions to this version. :clap:
@@ -908,32 +1352,32 @@ Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [E
908
  See all related issues and PRs in the [5.6 milestone].
909
 
910
  ### Added
911
- - :star2: New: `NewLanguageConstructs` sniff. The initial version of this sniff checks for the PHP 5.6 `**` power operator and the `**=` power assignment operator. [#87](https://github.com/wimg/PHPCompatibility/pull/87). Fixes [#60](https://github.com/wimg/PHPCompatibility/issues/60).
912
- - :star2: New: `ParameterShadowSuperGlobals` sniff which covers the PHP 5.4 change _Parameter names that shadow super globals now cause a fatal error.`_. [#74](https://github.com/wimg/PHPCompatibility/pull/74)
913
- - :star2: New: `PregReplaceEModifier` sniff which detects usage of the `e` modifier in literal regular expressions used with `preg_replace()`. The `e` modifier will not (yet) be detected when the regex passed is a variable or constant. [#81](https://github.com/wimg/PHPCompatibility/pull/81), [#84](https://github.com/wimg/PHPCompatibility/pull/84). Fixes [#71](https://github.com/wimg/PHPCompatibility/issues/71), [#83](https://github.com/wimg/PHPCompatibility/issues/83).
914
  - :star: `DeprecatedIniDirectives` sniff: PHP 5.6 deprecated ini directives.
915
- - :star: `NewKeywords` sniff: detection of the `goto` keyword introduced in PHP 5.3 and the `callable` keyword introduced in PHP 5.4. [#57](https://github.com/wimg/PHPCompatibility/pull/57)
916
- - :recycle: `PHPCompatibility_Sniff` base class initially containing the `supportsAbove()` and `supportsBelow()` utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set `testVersion`. [#77](https://github.com/wimg/PHPCompatibility/pull/77)
917
- - :books: Readme: Composer installation instructions. [#32](https://github.com/wimg/PHPCompatibility/pull/32), [#61](https://github.com/wimg/PHPCompatibility/pull/61)
918
- - :wrench: `.gitignore` to ignore vendor and IDE related directories. [#78](https://github.com/wimg/PHPCompatibility/pull/78)
919
  - :green_heart: Code coverage checking via coveralls.
920
 
921
  ### Changed
922
- - :twisted_rightwards_arrows: The check for the `\` namespace separator has been moved from the `NewKeywords` sniff to the `NewLanguageConstructs` sniff. [#88](https://github.com/wimg/PHPCompatibility/pull/88)
923
  - :pencil2: `DeprecatedIniDirectives` sniff: minor change in the sniff error message text.
924
  - :pencil2: `DeprecatedFunctions` sniff: minor change in the sniff error message text.
925
- - :wrench: Minor updates to the `composer.json` file. [#31](https://github.com/wimg/PHPCompatibility/pull/31), [34](https://github.com/wimg/PHPCompatibility/pull/34), [#70](https://github.com/wimg/PHPCompatibility/pull/70)
926
  - :wrench: Tests: The unit tests can now be run without configuration.
927
- - :wrench: Tests: Skipped unit tests will now be annotated as such. [#85](https://github.com/wimg/PHPCompatibility/pull/85)
928
  - :green_heart: The sniffs are now also tested against PHP 5.6 for consistent results.
929
  - :green_heart: The sniffs are now also tested against PHPCS 2.0+.
930
- - :green_heart: The sniffs are now tested using the new container-based infrastructure in Travis CI. [#37](https://github.com/wimg/PHPCompatibility/pull/37)
931
 
932
  ### Fixed
933
- - :bug: The `ForbiddenCallTimePassByReference` sniff was throwing false positives when a bitwise and `&` was used in combination with class constants and class properties within function calls. [#44](https://github.com/wimg/PHPCompatibility/pull/44). Fixes [#39](https://github.com/wimg/PHPCompatibility/issues/39).
934
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was throwing false positives in certain cases when a comment separated a `try` from the `catch` block. [#29](https://github.com/wimg/PHPCompatibility/pull/29)
935
- - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was incorrectly reporting `instanceof` as being introduced in PHP 5.4 while it has been around since PHP 5.0. [#80](https://github.com/wimg/PHPCompatibility/pull/80)
936
- - :white_check_mark: Compatibility with PHPCS 2.0 - 2.3. [#63](https://github.com/wimg/PHPCompatibility/pull/63), [#65](https://github.com/wimg/PHPCompatibility/pull/65)
937
 
938
  ### Credits
939
  Thanks go out to Daniel Jänecke, [Declan Kelly], [Dominic], [Jaap van Otterdijk], [Marin Crnkovic], [Mark Clements], [Nick Pack], [Oliver Klee], [Rowan Collins] and [Sam Van der Borght] for their contributions to this version. :clap:
@@ -947,49 +1391,69 @@ See all related issues and PRs in the [5.5 milestone].
947
 
948
 
949
 
950
- [Unreleased]: https://github.com/wimg/PHPCompatibility/compare/8.2.0...HEAD
951
- [8.2.0]: https://github.com/wimg/PHPCompatibility/compare/8.1.0...8.2.0
952
- [8.1.0]: https://github.com/wimg/PHPCompatibility/compare/8.0.1...8.1.0
953
- [8.0.1]: https://github.com/wimg/PHPCompatibility/compare/8.0.0...8.0.1
954
- [8.0.0]: https://github.com/wimg/PHPCompatibility/compare/7.1.5...8.0.0
955
- [7.1.5]: https://github.com/wimg/PHPCompatibility/compare/7.1.4...7.1.5
956
- [7.1.4]: https://github.com/wimg/PHPCompatibility/compare/7.1.3...7.1.4
957
- [7.1.3]: https://github.com/wimg/PHPCompatibility/compare/7.1.2...7.1.3
958
- [7.1.2]: https://github.com/wimg/PHPCompatibility/compare/7.1.1...7.1.2
959
- [7.1.1]: https://github.com/wimg/PHPCompatibility/compare/7.1.0...7.1.1
960
- [7.1.0]: https://github.com/wimg/PHPCompatibility/compare/7.0.8...7.1.0
961
- [7.0.8]: https://github.com/wimg/PHPCompatibility/compare/7.0.7...7.0.8
962
- [7.0.7]: https://github.com/wimg/PHPCompatibility/compare/7.0.6...7.0.7
963
- [7.0.6]: https://github.com/wimg/PHPCompatibility/compare/7.0.5...7.0.6
964
- [7.0.5]: https://github.com/wimg/PHPCompatibility/compare/7.0.4...7.0.5
965
- [7.0.4]: https://github.com/wimg/PHPCompatibility/compare/7.0.3...7.0.4
966
- [7.0.3]: https://github.com/wimg/PHPCompatibility/compare/7.0.2...7.0.3
967
- [7.0.2]: https://github.com/wimg/PHPCompatibility/compare/7.0.1...7.0.2
968
- [7.0.1]: https://github.com/wimg/PHPCompatibility/compare/7.0...7.0.1
969
- [7.0]: https://github.com/wimg/PHPCompatibility/compare/5.6...7.0
970
- [5.6]: https://github.com/wimg/PHPCompatibility/compare/5.5...5.6
971
-
972
- [8.2.0 milestone]: https://github.com/wimg/PHPCompatibility/milestone/22
973
- [8.1.0 milestone]: https://github.com/wimg/PHPCompatibility/milestone/21
974
- [8.0.1 milestone]: https://github.com/wimg/PHPCompatibility/milestone/20
975
- [8.0.0 milestone]: https://github.com/wimg/PHPCompatibility/milestone/19
976
- [7.1.5 milestone]: https://github.com/wimg/PHPCompatibility/milestone/17
977
- [7.1.4 milestone]: https://github.com/wimg/PHPCompatibility/milestone/15
978
- [7.1.3 milestone]: https://github.com/wimg/PHPCompatibility/milestone/14
979
- [7.1.2 milestone]: https://github.com/wimg/PHPCompatibility/milestone/13
980
- [7.1.1 milestone]: https://github.com/wimg/PHPCompatibility/milestone/12
981
- [7.1.0 milestone]: https://github.com/wimg/PHPCompatibility/milestone/11
982
- [7.0.8 milestone]: https://github.com/wimg/PHPCompatibility/milestone/10
983
- [7.0.7 milestone]: https://github.com/wimg/PHPCompatibility/milestone/9
984
- [7.0.6 milestone]: https://github.com/wimg/PHPCompatibility/milestone/8
985
- [7.0.5 milestone]: https://github.com/wimg/PHPCompatibility/milestone/7
986
- [7.0.4 milestone]: https://github.com/wimg/PHPCompatibility/milestone/6
987
- [7.0.3 milestone]: https://github.com/wimg/PHPCompatibility/milestone/5
988
- [7.0.2 milestone]: https://github.com/wimg/PHPCompatibility/milestone/4
989
- [7.0.1 milestone]: https://github.com/wimg/PHPCompatibility/milestone/3
990
- [7.0 milestone]: https://github.com/wimg/PHPCompatibility/milestone/2
991
- [5.6 milestone]: https://github.com/wimg/PHPCompatibility/milestone/1
992
- [5.5 milestone]: https://github.com/wimg/PHPCompatibility/milestone/16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
 
994
  [Arthur Edamov]: https://github.com/edamov
995
  [Chris Abernethy]: https://github.com/cabernet-zerve
@@ -1001,6 +1465,7 @@ See all related issues and PRs in the [5.5 milestone].
1001
  [Gary Jones]: https://github.com/GaryJones
1002
  [Jaap van Otterdijk]: https://github.com/jaapio
1003
  [Jason Stallings]: https://github.com/octalmage
 
1004
  [Jonathan Van Belle]: https://github.com/Grummfy
1005
  [Juliette Reinders Folmer]: https://github.com/jrfnl
1006
  [Ken Guest]: https://github.com/kenguest
@@ -1009,11 +1474,15 @@ See all related issues and PRs in the [5.5 milestone].
1009
  [Mark Clements]: https://github.com/MarkMaldaba
1010
  [Michael Babker]: https://github.com/mbabker
1011
  [Nick Pack]: https://github.com/nickpack
 
1012
  [Oliver Klee]: https://github.com/oliverklee
1013
  [Remko van Bezooijen]: https://github.com/emkookmer
1014
  [Rowan Collins]: https://github.com/IMSoP
1015
  [Ryan Neufeld]: https://github.com/ryanneufeld
1016
  [Sam Van der Borght]: https://github.com/samvdb
 
1017
  [Tadas Juozapaitis]: https://github.com/kasp3r
 
 
 
1018
  [Yoshiaki Yoshida]: https://github.com/kakakakakku
1019
-
7
  Up to version 8.0.0, the `major.minor` version numbers were based on the PHP version for which compatibility check support was added, with `patch` version numbers being specific to this library.
8
  From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.
9
 
 
 
10
  <!-- Legend to the icons used: https://github.com/PHPCompatibility/PHPCompatibility/pull/506#discussion_r131650488 -->
11
 
12
 
14
 
15
  _Nothing yet._
16
 
17
+ ## [9.3.5] - 2019-12-27
18
+
19
+ See all related issues and PRs in the [9.3.5 milestone].
20
+
21
+ ### Added
22
+ - :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `FFI` extension related classes as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)
23
+ - :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new `FFI` extension related ini directives as introduced in PHP 7.4. [#949](https://github.com/PHPCompatibility/PHPCompatibility/pull/949)
24
+
25
+ ### Changed
26
+ - :pencil: `PHPCompatibility.Syntax.NewShortArray`: improved clarity of the error message and made it consistent with other error messages in this standard. [#934](https://github.com/PHPCompatibility/PHPCompatibility/pull/934)
27
+ - :pencil: `PHPCompatibility.Interfaces.NewInterfaces`: updated the URL which is mentioned in select error messages. [#942](https://github.com/PHPCompatibility/PHPCompatibility/pull/942)
28
+ - :recycle: Another slew of code documentation fixes. [#937](https://github.com/PHPCompatibility/PHPCompatibility/pull/937), [#939](https://github.com/PHPCompatibility/PHPCompatibility/pull/939), [#940](https://github.com/PHPCompatibility/PHPCompatibility/pull/940), [#941](https://github.com/PHPCompatibility/PHPCompatibility/pull/941), [#943](https://github.com/PHPCompatibility/PHPCompatibility/pull/943), [#944](https://github.com/PHPCompatibility/PHPCompatibility/pull/944), [#951](https://github.com/PHPCompatibility/PHPCompatibility/pull/951), [#950](https://github.com/PHPCompatibility/PHPCompatibility/pull/950). Fixes [#734](https://github.com/PHPCompatibility/PHPCompatibility/issues/734).
29
+ - :green_heart: Travis: various tweaks. The builds against PHP 7.4 are no longer allowed to fail. [#935](https://github.com/PHPCompatibility/PHPCompatibility/pull/935), [#938](https://github.com/PHPCompatibility/PHPCompatibility/pull/938)
30
+ For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+ as PHP_CodeSniffer itself is
31
+ not compatible with PHP 7.4 until version 3.5.0.
32
+
33
+ ### Fixed
34
+ - :bug: `PHPCompatibility.Classes.NewClasses`: two new PHP 7.4 classes were being checked as if they were Exceptions. [#945](https://github.com/PHPCompatibility/PHPCompatibility/pull/945)
35
+
36
+ ### Credits
37
+ Thanks go out to [William Entriken] for their contribution to this version. :clap:
38
+
39
+
40
+ ## [9.3.4] - 2019-11-15
41
+
42
+ See all related issues and PRs in the [9.3.4 milestone].
43
+
44
+ ### Fixed
45
+ - :bug: `PHPCompatibility.Keywords.ForbiddenNames`: false positive for list when used in a `foreach()` condition. [#930](https://github.com/PHPCompatibility/PHPCompatibility/pull/930). Fixes [#928](https://github.com/PHPCompatibility/PHPCompatibility/issues/928), [#929](https://github.com/PHPCompatibility/PHPCompatibility/pull/929)
46
+
47
+ ### Credits
48
+ Thanks go out to [Sergii Bondarenko] for their contribution to this version. :clap:
49
+
50
+
51
+ ## [9.3.3] - 2019-11-11
52
+
53
+ See all related issues and PRs in the [9.3.3 milestone].
54
+
55
+ ### Added
56
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of yet more (undocumented) PHP 7.2 Sodium constants. [#924](https://github.com/PHPCompatibility/PHPCompatibility/pull/924)
57
+ - :star: `PHPCompatibility.Keywords.ForbiddenNames` sniff: detect the use of more reserved keywords which are not allowed to be used to name certain constructs. [#923](https://github.com/PHPCompatibility/PHPCompatibility/pull/923). Fixes [#922](https://github.com/PHPCompatibility/PHPCompatibility/issues/922)
58
+
59
+ ### Fixed
60
+ - :bug: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: false positive detecting PHP4-style constructors when declared in interfaces. The class implementing the interface will not have the same name as the interface, so the actual method would not be regarded as a PHP4 style constructor. [#921](https://github.com/PHPCompatibility/PHPCompatibility/pull/921)
61
+
62
+ ### Credits
63
+ Thanks go out to [Nikhil] for their contribution to this version. :clap:
64
+
65
+
66
+ ## [9.3.2] - 2019-10-16
67
+
68
+ See all related issues and PRs in the [9.3.2 milestone].
69
+
70
+ ### Added
71
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the PHP 7.2 `SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13` constant. [#915](https://github.com/PHPCompatibility/PHPCompatibility/pull/915)
72
+ - :books: Readme: a list of projects which are build upon or extend PHPCompatibility. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904)
73
+
74
+ ### Changed
75
+ - :pushpin: `PHPCompatibility.FunctionNameRestrictions.RemovedPHP4StyleConstructors`: minor efficiency fix to make the sniff faster. [#912](https://github.com/PHPCompatibility/PHPCompatibility/pull/912)
76
+ - :pushpin: `PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames`: functions marked as `@deprecated` in the function docblock will now be ignored by this sniff. [#917](https://github.com/PHPCompatibility/PHPCompatibility/pull/917). Fixes [#911](https://github.com/PHPCompatibility/PHPCompatibility/issues/911)
77
+ - :pencil: `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`: the `$ooScopeTokens` property is now `protected`, it should never have been `public` in the first place. [#907](https://github.com/PHPCompatibility/PHPCompatibility/pull/907)
78
+ - :recycle: More code documentation fixes. [#903](https://github.com/PHPCompatibility/PHPCompatibility/pull/903), [#916](https://github.com/PHPCompatibility/PHPCompatibility/pull/916)
79
+ - :books: Readme/Contributing: various tweaks. [#904](https://github.com/PHPCompatibility/PHPCompatibility/pull/904), [#905](https://github.com/PHPCompatibility/PHPCompatibility/pull/905)
80
+
81
+ ### Fixed
82
+ - :bug: `PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914). Fixes [#913](https://github.com/PHPCompatibility/PHPCompatibility/issues/913)
83
+ - :bug: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters`: false positive when a class is instantiated which has the same name as one of the affected functions. [#914](https://github.com/PHPCompatibility/PHPCompatibility/pull/914)
84
+ - :bug: `PHPCompatibility.MethodUse.NewDirectCallsToClone`: false positive on calling `__clone()` from within the class being cloned [#910](https://github.com/PHPCompatibility/PHPCompatibility/pull/910). Fixes [#629 (comment)](https://github.com/PHPCompatibility/PHPCompatibility/issues/629#issuecomment-532607809)
85
+ - :bug: `PHPCompatibility.Miscellaneous.ValidIntegers`: binary numbers using an uppercase `B` were not always recognized correctly. [#909](https://github.com/PHPCompatibility/PHPCompatibility/pull/909)
86
+
87
+
88
+ ## [9.3.1] - 2019-09-06
89
+
90
+ See all related issues and PRs in the [9.3.1 milestone].
91
+
92
+ ### Changed
93
+ - :recycle: A whole slew of code documentation fixes. [#892](https://github.com/PHPCompatibility/PHPCompatibility/pull/892), [#895](https://github.com/PHPCompatibility/PHPCompatibility/pull/895), [#896](https://github.com/PHPCompatibility/PHPCompatibility/pull/896), [#897](https://github.com/PHPCompatibility/PHPCompatibility/pull/897), [#898](https://github.com/PHPCompatibility/PHPCompatibility/pull/898), [#899](https://github.com/PHPCompatibility/PHPCompatibility/pull/899), [#900](https://github.com/PHPCompatibility/PHPCompatibility/pull/900)
94
+ - :wrench: Travis: minor tweaks to the build script. [#893](https://github.com/PHPCompatibility/PHPCompatibility/pull/893)
95
+
96
+ ### Fixed
97
+ - :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: false positive when an array item in the second parameter contained a ternary. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891). Fixes [#890](https://github.com/PHPCompatibility/PHPCompatibility/issues/890)
98
+ - :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: will now take array casts into account when determining which parameter is `$pieces`. [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891).
99
+ - :bug: `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder`: hardening of the logic to not examine the second parameter when the first is just and only a text string (`$glue`). [#891](https://github.com/PHPCompatibility/PHPCompatibility/pull/891).
100
+
101
+
102
+ ## [9.3.0] - 2019-08-29
103
+
104
+ See all related issues and PRs in the [9.3.0 milestone].
105
+
106
+ To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808).
107
+
108
+ ### Changes expected in PHPCompatibility 10.0.0
109
+ The next version of PHPCompatibility is expected to include a new external dependency.
110
+
111
+ In this same release, support for PHP < 5.4 and PHP_CodeSniffer < 2.6.0 will be dropped.
112
+
113
+ The `10.0.0` release is expected around the same time as the release of PHP 7.4 - end of November/beginning of December 2019.
114
+
115
+ ### Added
116
+ - :star2: New `PHPCompatibility.Miscellaneous.NewPHPOpenTagEOF` sniff to detect a stand-alone PHP open tag at the end of a file, without trailing newline, as will be supported as of PHP 7.4. [#843](https://github.com/PHPCompatibility/PHPCompatibility/pull/846)
117
+ - :star2: New `PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML` sniff to detect calls to `strip_tags()` passing self-closing XHTML tags in the `$allowable_tags` parameter. This has not been supported since PHP 5.3.4. [#866](https://github.com/PHPCompatibility/PHPCompatibility/pull/866)
118
+ - :star2: New `PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault` sniff to detect calls to `html_entity_decode()`, `htmlentities()` and `htmlspecialchars()` which are impacted by the change to the default value of the `$encoding` parameter in PHP 5.4. [#862](https://github.com/PHPCompatibility/PHPCompatibility/pull/862)
119
+ - :star2: New `PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault` sniff to detect code impacted by the change in the `default_charset` value in PHP 5.6. [#864](https://github.com/PHPCompatibility/PHPCompatibility/pull/864) Fixes [#839](https://github.com/PHPCompatibility/PHPCompatibility/issues/839)
120
+ - :star2: New `PHPCompatibility.ParameterValues.NewIDNVariantDefault` sniff to detect calls to `idn_to_ascii()` and `idn_to_utf8()` impacted by the PHP 7.4 change in the default value for the `$variant` parameter. [#861](https://github.com/PHPCompatibility/PHPCompatibility/pull/861)
121
+ - :star2: New `PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues` sniff to detect calls to `password_hash()` and `password_needs_rehash()` impacted by the changed value of the `PASSWORD_DEFAULT`, `PASSWORD_BCRYPT`, `PASSWORD_ARGON2I` and `PASSWORD_ARGON2ID` constants in PHP 7.4. [#865](https://github.com/PHPCompatibility/PHPCompatibility/pull/865)
122
+ - :star2: New `PHPCompatibility.ParameterValues.NewProcOpenCmdArray` sniff to detect calls to `proc_open()` passing an array for the `$cmd` parameter as supported as of PHP 7.4. [#869](https://github.com/PHPCompatibility/PHPCompatibility/pull/869)
123
+ - :star2: New `PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray` sniff to detect calls to `strip_tags()` passing an array for the `$allowable_tags` parameter as will be supported as of PHP 7.4. [#867](https://github.com/PHPCompatibility/PHPCompatibility/pull/867)
124
+ - :star2: New `PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder` sniff to detect `implode()` being called with `$glue` and `$pieces` in reverse order from the documented argument order. This was previously allowed for historical reasons, but will be deprecated in PHP 7.4. [#846](https://github.com/PHPCompatibility/PHPCompatibility/pull/846)
125
+ - :star2: New `PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam` sniff to detect the `$encoding` being passed as the third, instead of the fourth parameter, to `mb_strrpos()` as has been soft deprecated since PHP 5.2 and will be hard deprecated as of PHP 7.4. [#860](https://github.com/PHPCompatibility/PHPCompatibility/pull/860)
126
+ - :star2: New `PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess` sniff to detect array and string offset access using curly braces as will be deprecated as of PHP 7.4. [#855](https://github.com/PHPCompatibility/PHPCompatibility/pull/855)
127
+ - In contrast to any other sniff in the PHPCompatibility standard, this sniff contains an auto-fixer.
128
+ - :star2: New `PHPCompatibility.TextStrings.NewUnicodeEscapeSequence` sniff to detect use of the PHP 7.0+ unicode codepoint escape sequences and issues with invalid sequences. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856)
129
+ - :star2: New `PHPCompatibility.Upgrade.LowPHP` sniff to give users of old PHP versions advance warning when support will be dropped in the near future. [#838](https://github.com/PHPCompatibility/PHPCompatibility/pull/838)
130
+ At this moment, the intention is to drop support for PHP 5.3 by the end of this year.
131
+ - :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `WeakReference` class as introduced in PHP 7.4. [#857](https://github.com/PHPCompatibility/PHPCompatibility/pull/857)
132
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of new Curl constants as introduced in PHP 7.3.5. [#878](https://github.com/PHPCompatibility/PHPCompatibility/pull/878)
133
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the revived `T_BAD_CHARACTER` constant as re-introduced in PHP 7.4. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882)
134
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new `IMG_FILTER_SCATTER` and `PASSWORD_ARGON2_PROVIDER` constants as introduced in PHP 7.4. [#887](https://github.com/PHPCompatibility/PHPCompatibility/pull/887)
135
+ - :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `CURLPIPE_HTTP1` constant which will be deprecated in PHP 7.4. [#879](https://github.com/PHPCompatibility/PHPCompatibility/pull/879)
136
+ - :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `FILTER_SANITIZE_MAGIC_QUOTES` constant which will be deprecated in PHP 7.4. [#845](https://github.com/PHPCompatibility/PHPCompatibility/pull/845)
137
+ - :star: `PHPCompatibility.Constants.RemovedConstants` sniff: detection of use of the `T_CHARACTER` and `T_BAD_CHARACTER` constants which were removed in PHP 7.0. [#882](https://github.com/PHPCompatibility/PHPCompatibility/pull/882)
138
+ - :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868)
139
+ - :star: `PHPCompatibility.FunctionDeclarations.NewMagicMethods` sniff: recognize the PHP 5.0 `__construct()` and `__destruct()` magic methods. [#884](https://github.com/PHPCompatibility/PHPCompatibility/pull/884)
140
+ - :star: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: recognize the new `__serialize()` and `__unserialize()` magic methods as introduced in PHP 7.4. [#868](https://github.com/PHPCompatibility/PHPCompatibility/pull/868)
141
+ - :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new PHP 7.4 function `imagecreatefromtga()`. [#873](https://github.com/PHPCompatibility/PHPCompatibility/pull/873)
142
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$age` parameter of the `curl_version()` function. [#874](https://github.com/PHPCompatibility/PHPCompatibility/pull/874)
143
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `convert_cyr_string()()`, `ezmlm_hash()`, `get_magic_quotes_gpc()`, `get_magic_quotes_runtime()`, `hebrevc()`, `is_real()`, `money_format()` and `restore_include_path()` functions. [#847](https://github.com/PHPCompatibility/PHPCompatibility/pull/847)
144
+ - :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: detect use of the new PHP 7.4 `zend.exception_ignore_args` ini directive. [#871](https://github.com/PHPCompatibility/PHPCompatibility/pull/871)
145
+ - :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detect use of the `allow_url_include` ini directive which is deprecated as of PHP 7.4. [#870](https://github.com/PHPCompatibility/PHPCompatibility/pull/870)
146
+ - :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: detection of use of the `opcache.load_comments` directive which was removed in PHP 7.0. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883)
147
+ - :star: `PHPCompatibility.ParameterValues.NewHashAlgorithms`: recognize use of the new PHP 7.4 `crc32c` hash algorithm. [#872](https://github.com/PHPCompatibility/PHPCompatibility/pull/872)
148
+ - :star: `PHPCompatibility.TypeCasts.RemovedTypeCasts` sniff: detect usage of the `(real)` type cast which will be deprecated in PHP 7.4. [#844](https://github.com/PHPCompatibility/PHPCompatibility/pull/844)
149
+ - :star: Recognize the `recode` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#841](https://github.com/PHPCompatibility/PHPCompatibility/pull/841)
150
+ - :star: Recognize the `OPcache` extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in the `NewFunctions` and `NewIniDirectives` sniffs. [#883](https://github.com/PHPCompatibility/PHPCompatibility/pull/883)
151
+ - :star: New `getCompleteTextString()` utility method to the `PHPCompatibility\Sniff` class. [#856](https://github.com/PHPCompatibility/PHPCompatibility/pull/856)
152
+ - :umbrella: Unit test for the `PHPCompatibility.Upgrade.LowPHPCS` sniff.
153
+ - :umbrella: Some extra unit tests for the `PHPCompatibility.ParameterValues.NewNegativeStringOffset`, `PHPCompatibility.ParameterValues.RemovedMbStringModifiers` and sniffs. [#876](https://github.com/PHPCompatibility/PHPCompatibility/pull/876), [#877](https://github.com/PHPCompatibility/PHPCompatibility/pull/877)
154
+ - :books: `CONTRIBUTING.md`: Added a list of typical sources for information about changes to PHP. [#875](https://github.com/PHPCompatibility/PHPCompatibility/pull/875)
155
+
156
+ ### Changed
157
+ - :pushpin: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the sniff will now also examine the function docblock, if available, and will throw an error when a `@throws` tag is found in the docblock. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863)
158
+ - :pushpin: `PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods` sniff: will now also check the visibility and `static` (or not) requirements of the magic `__construct()`, `__destruct()`, `__clone()`, `__debugInfo()`, `__invoke()` and `__set_state()` methods. [#885](https://github.com/PHPCompatibility/PHPCompatibility/pull/885)
159
+ - :pushpin: `PHPCompatibility.Syntax.NewArrayStringDereferencing` sniff: the sniff will now also recognize array string dereferencing using curly braces as was (silently) supported since PHP 7.0. [#851](https://github.com/PHPCompatibility/PHPCompatibility/pull/851)
160
+ - The sniff will now also throw errors for each dereference found on the array/string, not just the first one.
161
+ - :pushpin: `PHPCompatibility.Syntax.NewClassMemberAccess` sniff: the sniff will now also recognize class member access on instantiation and cloning using curly braces as was (silently) supported since PHP 7.0. [#852](https://github.com/PHPCompatibility/PHPCompatibility/pull/852)
162
+ - The sniff will now also throw errors for each access detected, not just the first one.
163
+ - The line number on which the error is thrown in now set more precisely.
164
+ - :pushpin: `PHPCompatibility.Syntax.NewFunctionArrayDereferencing` sniff: the sniff will now also recognize function array dereferencing using curly braces as was (silently) supported since PHP 7.0. [#853](https://github.com/PHPCompatibility/PHPCompatibility/pull/853)
165
+ - The sniff will now also throw errors for each access detected, not just the first one.
166
+ - The line number on which the error is thrown in now set more precisely.
167
+ - :recycle: Various code clean-up and improvements. [#849](https://github.com/PHPCompatibility/PHPCompatibility/pull/849), [#850](https://github.com/PHPCompatibility/PHPCompatibility/pull/850)
168
+ - :recycle: Various minor inline documentation fixes. [#854](https://github.com/PHPCompatibility/PHPCompatibility/pull/854), [#886](https://github.com/PHPCompatibility/PHPCompatibility/pull/886)
169
+ - :wrench: Travis: various tweaks to the build script. [#834](https://github.com/PHPCompatibility/PHPCompatibility/pull/834), [#842](https://github.com/PHPCompatibility/PHPCompatibility/pull/842)
170
+
171
+ ### Fixed
172
+ - :bug: `PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameName` sniff: variable names are case-sensitive, so recognition of same named parameters should be done in a case-sensitive manner. [#848](https://github.com/PHPCompatibility/PHPCompatibility/pull/848)
173
+ - :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: Exceptions thrown within a `try` should not trigger the sniff. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880). Fixes [#863](https://github.com/PHPCompatibility/PHPCompatibility/issues/863)
174
+ - :bug: `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff: the `$ooScopeTokens` property should never have been a public property. [#880](https://github.com/PHPCompatibility/PHPCompatibility/pull/880).
175
+ - :umbrella: Some of the unit tests for the `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff were not being run. [#836](https://github.com/PHPCompatibility/PHPCompatibility/pull/836)
176
+
177
+
178
+ ## [9.2.0] - 2019-06-28
179
+
180
+ See all related issues and PRs in the [9.2.0 milestone].
181
+
182
+ To keep informed of the progress of covering "_everything PHP 7.4_" in PHPCompatibility, please subscribe to issue [#808](https://github.com/PHPCompatibility/PHPCompatibility/issues/808).
183
+
184
+ ### Added
185
+ - :star2: New `PHPCompatibility.Classes.ForbiddenAbstractPrivateMethods` sniff to detect methods declared as both `private` as well as `abstract`. This was allowed between PHP 5.0.0 and 5.0.4, but disallowed in PHP 5.1 as the behaviour of `private` and `abstract` are mutually exclusive. [#822](https://github.com/PHPCompatibility/PHPCompatibility/pull/822)
186
+ - :star2: New `PHPCompatibility.Classes.NewTypedProperties` sniff to detect PHP 7.4 typed property declarations. [#801](https://github.com/PHPCompatibility/PHPCompatibility/pull/801), [#829](https://github.com/PHPCompatibility/PHPCompatibility/pull/829)
187
+ - :star2: New `PHPCompatibility.Classes.RemovedOrphanedParent` sniff to detect the use of the `parent` keyword in classes without a parent (non-extended classes). This code pattern is deprecated in PHP 7.4 and will become a compile-error in PHP 8.0. [#818](https://github.com/PHPCompatibility/PHPCompatibility/pull/818)
188
+ - :star2: New `PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString` sniff to detect throwing exceptions from `__toString()` methods. This would previously result in a fatal error, but will be allowed as of PHP 7.4. [#814](https://github.com/PHPCompatibility/PHPCompatibility/pull/814)
189
+ - :star2: New `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters` sniff to detect `__toString()` function declarations expecting parameters. This was disallowed in PHP 5.3. [#815](https://github.com/PHPCompatibility/PHPCompatibility/pull/815)
190
+ - :star2: New `PHPCompatibility.MethodUse.ForbiddenToStringParameters` sniff to detect direct calls to `__toString()` magic methods passing parameters. This was disallowed in PHP 5.3. [#830](https://github.com/PHPCompatibility/PHPCompatibility/pull/830)
191
+ - :star2: New `PHPCompatibility.Operators.ChangedConcatOperatorPrecedence` sniff to detect code affected by the upcoming change in operator precedence for the concatenation operator. The concatenation operator precedence will be lowered in PHP 8.0, with deprecation notices for code affected being thrown in PHP 7.4. [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805)
192
+ - :star2: New `PHPCompatibility.Operators.RemovedTernaryAssociativity` sniff to detect code relying on left-associativity of the ternary operator. This behaviour will be deprecated in PHP 7.4 and removed in PHP 8.0. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810)
193
+ - :star2: New `PHPCompatibility.Syntax.NewArrayUnpacking` sniff to detect the use of the spread operator to unpack arrays when declaring a new array, as introduced in PHP 7.4. [#804](https://github.com/PHPCompatibility/PHPCompatibility/pull/804)
194
+ - :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `ReflectionReference` class as introduced in PHP 7.4. [#820](https://github.com/PHPCompatibility/PHPCompatibility/pull/820)
195
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: detection of the new PHP 7.4 Core (Standard), MBString, Socket and Tidy constants. [#821](https://github.com/PHPCompatibility/PHPCompatibility/pull/821)
196
+ - :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: detect usage of the new PHP 7.4 `get_mangled_object_vars()`, `mb_str_split()`, `openssl_x509_verify()`, `password_algos()`, `pcntl_unshare()`, `sapi_windows_set_ctrl_handler()` and `sapi_windows_generate_ctrl_event()` functions. [#811](https://github.com/PHPCompatibility/PHPCompatibility/pull/811), [#819](https://github.com/PHPCompatibility/PHPCompatibility/pull/819), [#827](https://github.com/PHPCompatibility/PHPCompatibility/pull/827)
197
+ - :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the new OCI functions as introduced in PHP 7.2.14 and PHP 7.3.1. [#786](https://github.com/PHPCompatibility/PHPCompatibility/pull/786)
198
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.4 deprecated `ldap_control_paged_result_response()` and `ldap_control_paged_result()` functions. [#831](https://github.com/PHPCompatibility/PHPCompatibility/pull/831)
199
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the `Payflow Pro/pfpro` functions as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
200
+ - :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the parameters for `array_merge()` and `array_merge_recursive()` becoming optional in PHP 7.4. [#817](https://github.com/PHPCompatibility/PHPCompatibility/pull/817)
201
+ - :star: `PHPCompatibility.IniDirectives.RemovedIniDirectives` sniff: recognize the `Payflow Pro/pfpro` ini directives as removed in PHP 5.1. [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
202
+ - :star: Recognize the `interbase/Firebird` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedConstants`, `RemovedExtensions`, `RemovedFunctions` and `RemovedIniDirectives` sniffs. [#807](https://github.com/PHPCompatibility/PHPCompatibility/pull/807)
203
+ - :star: Recognize the `wddx` extension functionality which will be removed in PHP 7.4 (moved to PECL) in the `RemovedExtensions` and `RemovedFunctions` sniffs. [#826](https://github.com/PHPCompatibility/PHPCompatibility/pull/826)
204
+ - :star: New `isShortTernary()` and `isUnaryPlusMinus()` utility methods to the `PHPCompatibility\Sniff` class. [#810](https://github.com/PHPCompatibility/PHPCompatibility/pull/810), [#805](https://github.com/PHPCompatibility/PHPCompatibility/pull/805)
205
+
206
+ ### Changed
207
+ - :pencil2: The `PHPCompatibility.Extensions.RemovedExtensions` sniff will now only report on the removed `Payflow Pro` extension when a function uses `pfpro_` as a prefix. Previously, it used the `pfpro` prefix (without underscore) for detection. [#812](https://github.com/PHPCompatibility/PHPCompatibility/pull/812)
208
+ - :pencil2: The error message thrown when the `T_ELLIPSIS` token, i.e. the spread operator, is detected. [#803](https://github.com/PHPCompatibility/PHPCompatibility/pull/803)
209
+ PHP 7.4 adds a third use-case for the spread operator. The adjusted error message accounts for this.
210
+ - :umbrella: `PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations` is now also tested with parameters using the splat operator. [#802](https://github.com/PHPCompatibility/PHPCompatibility/pull/802)
211
+ - :books: The documentation now uses the GitHub repo of `PHP_CodeSniffer` as the canonical entry point for `PHP_CodeSniffer`. Previously, it would point to the PEAR package. [#788](https://github.com/PHPCompatibility/PHPCompatibility/pull/788)
212
+ - :books: The links in the changelog now all point to the `PHPCompatibility/PHPCompatibility` repo and no longer to the (deprecated) `wimg/PHPCompatibility` repo. [#828](https://github.com/PHPCompatibility/PHPCompatibility/pull/828)
213
+ - :recycle: Various minor inline documentation improvements. [#825](https://github.com/PHPCompatibility/PHPCompatibility/pull/825)
214
+ - :wrench: Various performance optimizations and code simplifications. [#783](https://github.com/PHPCompatibility/PHPCompatibility/pull/783), [#784](https://github.com/PHPCompatibility/PHPCompatibility/pull/784), [#795](https://github.com/PHPCompatibility/PHPCompatibility/pull/795), [#813](https://github.com/PHPCompatibility/PHPCompatibility/pull/813)
215
+ - :green_heart: Travis: build tests are now being run against PHP 7.4 (unstable) as well. [#790](https://github.com/PHPCompatibility/PHPCompatibility/pull/790)
216
+ Note: the builds are currently not (yet) tested against PHP 8.0 (unstable) as there is no compatible PHPUnit version available (yet).
217
+ - :wrench: Travis: The build script has been refactored to use [stages](https://docs.travis-ci.com/user/build-stages/) to get the most relevant results faster. Additionally some more tweaks have been made to improve and/or simplify the build script. [#798](https://github.com/PHPCompatibility/PHPCompatibility/pull/798)
218
+ - :wrench: Build/PHPCS: warnings are no longer allowed for the PHPCompatibility native code. [#800](https://github.com/PHPCompatibility/PHPCompatibility/pull/800)
219
+ - :wrench: Build/PHPCS: added variable assignment alignment check and file include check to the PHPCompatibility native CS configuration. [#824](https://github.com/PHPCompatibility/PHPCompatibility/pull/824)
220
+ - :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.5.0`. [#791](https://github.com/PHPCompatibility/PHPCompatibility/pull/791)
221
+
222
+ ### Fixed
223
+ - :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff contained a typo in the alternative recommended for the removed `mcve` extension. [#806](https://github.com/PHPCompatibility/PHPCompatibility/pull/806)
224
+ - :bug: The `PHPCompatibility.Extensions.RemovedExtensions` sniff listed the wrong removal version number for the `Payflow Pro/pfpro` extension (PHP 5.3 instead of the correct 5.1). [#823](https://github.com/PHPCompatibility/PHPCompatibility/pull/823)
225
+
226
+ ### Credits
227
+ Thanks go out to [Yılmaz] and [Tim Millwood] for their contribution to this version. :clap:
228
+
229
+
230
+ ## [9.1.1] - 2018-12-31
231
+
232
+ See all related issues and PRs in the [9.1.1 milestone].
233
+
234
+ ### Fixed
235
+ - :bug: `ForbiddenThisUseContexts`: false positive for unsetting `$this['key']` on objects implementing `ArrayAccess`. [#781](https://github.com/PHPCompatibility/PHPCompatibility/pull/781). Fixes [#780](https://github.com/PHPCompatibility/PHPCompatibility/issues/780)
236
+
237
+ ## [9.1.0] - 2018-12-16
238
+
239
+ See all related issues and PRs in the [9.1.0 milestone].
240
+
241
+ ### Added
242
+ - :star2: New `PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue` sniff to detect code which could be affected by the PHP 7.0 change in the values reported by `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750). Fixes [#585](https://github.com/PHPCompatibility/PHPCompatibility/pull/585).
243
+ - :star2: New `PHPCompatibility.MethodUse.NewDirectCallsToClone` sniff to detect direct call to a `__clone()` magic method which wasn't allowed prior to PHP 7.0. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743). Fixes [#629](https://github.com/PHPCompatibility/PHPCompatibility/issues/629).
244
+ - :star2: New `PHPCompatibility.Variables.ForbiddenThisUseContext` sniff to detect most of the inconsistencies surrounding the use of the `$this` variable, which were removed in PHP 7.1. [#762](https://github.com/PHPCompatibility/PHPCompatibility/pull/762), [#771](https://github.com/PHPCompatibility/PHPCompatibility/pull/771). Fixes [#262](https://github.com/PHPCompatibility/PHPCompatibility/issues/262) and [#740](https://github.com/PHPCompatibility/PHPCompatibility/issues/740).
245
+ - :star: `NewClasses`: detection of more native PHP Exceptions. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753)
246
+ - :star: `NewConstants` : detection of the new PHP 7.3 Curl, Stream Crypto and LDAP constants and some more PHP 7.0 Tokenizer constants. [#752](https://github.com/PHPCompatibility/PHPCompatibility/pull/752), [#767](https://github.com/PHPCompatibility/PHPCompatibility/pull/767), [#778](https://github.com/PHPCompatibility/PHPCompatibility/pull/778)
247
+ - :star: `NewFunctions` sniff: recognize (more) new LDAP functions as introduced in PHP 7.3. [#768](https://github.com/PHPCompatibility/PHPCompatibility/pull/768)
248
+ - :star: `NewFunctionParameters` sniff: recognize the new `$serverctrls` parameter which was added to a number of LDAP functions in PHP 7.3. [#769](https://github.com/PHPCompatibility/PHPCompatibility/pull/769)
249
+ - :star: `NewIniDirectives` sniff: recognize the new `imap.enable_insecure_rsh` ini directive as introduced in PHP 7.1.25, 7.2.13 and 7.3.0. [#770](https://github.com/PHPCompatibility/PHPCompatibility/pull/770)
250
+ - :star: `NewInterfaces` sniff: recognize two more Session related interfaces which were introduced in PHP 5.5.1 and 7.0 respectively. [#748](https://github.com/PHPCompatibility/PHPCompatibility/pull/748)
251
+ - :star: Duplicate of upstream `findStartOfStatement()` method to the `PHPCompatibility\PHPCSHelper` class to allow for PHPCS cross-version usage of that method. [#750](https://github.com/PHPCompatibility/PHPCompatibility/pull/750)
252
+
253
+ ### Changed
254
+ - :pushpin: `RemovedPHP4StyleConstructors`: will now also detect PHP4-style constructors when declared in interfaces. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
255
+ - :pushpin: `Sniff::validDirectScope()`: the return value of this method has changed. Previously it would always be a boolean. It will stil return `false` when no valid direct scope has been found, but it will now return the `stackPtr` to the scope token if a _valid_ direct scope was encountered. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758)
256
+ - :rewind: `NewOperators` : updated the version number for `T_COALESCE_EQUAL`. [#746](https://github.com/PHPCompatibility/PHPCompatibility/pull/746)
257
+ - :pencil: Minor improvement to an error message in the unit test suite. [#742](https://github.com/PHPCompatibility/PHPCompatibility/pull/742)
258
+ - :recycle: Various code clean-up and improvements. [#745](https://github.com/PHPCompatibility/PHPCompatibility/pull/745), [#756](https://github.com/PHPCompatibility/PHPCompatibility/pull/756), [#774](https://github.com/PHPCompatibility/PHPCompatibility/pull/774)
259
+ - :recycle: Various minor inline documentation fixes. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749), [#757](https://github.com/PHPCompatibility/PHPCompatibility/pull/757)
260
+ - :umbrella: Improved code coverage recording. [#744](https://github.com/PHPCompatibility/PHPCompatibility/pull/744), [#776](https://github.com/PHPCompatibility/PHPCompatibility/pull/776)
261
+ - :green_heart: Travis: build tests are now being run against PHP 7.3 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511)
262
+ Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
263
+
264
+ ### Fixed
265
+ - :white_check_mark: Compatibility with the upcoming release of PHPCS 3.4.0. Deal with changed behaviour of the PHPCS `Tokenizer` regarding binary type casts. [#760](https://github.com/PHPCompatibility/PHPCompatibility/pull/760)
266
+ - :bug: `InternalInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775)
267
+ - :bug: `NewClasses`: the introduction version of various native PHP Exceptions has been corrected. [#743](https://github.com/PHPCompatibility/PHPCompatibility/pull/743), [#753](https://github.com/PHPCompatibility/PHPCompatibility/pull/753)
268
+ - :bug: `NewInterfaces`: false negative for implemented/extended interfaces prefixed with a namespace separator. [#775](https://github.com/PHPCompatibility/PHPCompatibility/pull/775)
269
+ - :bug: `RemovedPHP4StyleConstructors`: the sniff would examine methods in nested anonymous classes as if they were methods of the higher level class. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
270
+ - :rewind: `RemovedPHP4StyleConstructors`: the sniff will no longer throw false positives for the first method in an anonymous class when used in combination with PHPCS 2.3.x. [#751](https://github.com/PHPCompatibility/PHPCompatibility/pull/751)
271
+ - :rewind: `ReservedFunctionNames`: fixed incorrect error message text for methods in anonymous classes when used in combination with PHPCS 2.3.x. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755)
272
+ - :bug: `ReservedFunctionNames`: prevent duplicate errors being thrown for methods in nested anonymous classes. [#755](https://github.com/PHPCompatibility/PHPCompatibility/pull/755)
273
+ - :bug: `PHPCSHelper::findEndOfStatement()`: minor bug fix. [#749](https://github.com/PHPCompatibility/PHPCompatibility/pull/749)
274
+ - :bug: `Sniff::isClassProperty()`: class properties for classes nested in conditions or function calls were not always recognized as class properties. [#758](https://github.com/PHPCompatibility/PHPCompatibility/pull/758)
275
+
276
+ ### Credits
277
+ Thanks go out to [Jonathan Champ] for his contribution to this version. :clap:
278
+
279
+
280
+ ## [9.0.0] - 2018-10-07
281
+
282
+ **IMPORTANT**: This release contains **breaking changes**. Please read the below information carefully before upgrading!
283
+
284
+ All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names.
285
+
286
+ Both the `PHPCompatibilityJoomla` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityJoomla) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)] as well as the `PHPCompatibilityWP` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)] rulesets have already been adjusted for this change and have released a new version which is compatible with this version of PHPCompatibility.
287
+
288
+ Aside from those CMS-based rulesets, this project now also offers a number of polyfill-library specific rulesets, such as `PHPCompatibilityPasswordCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat)] for @ircmaxell's [`password_compat`](https://github.com/ircmaxell/password_compat) libary, `PHPCompatibilityParagonieRandomCompat` and `PHPCompatibilityParagonieSodiumCompat` [[GH](https://github.com/PHPCompatibility/PHPCompatibilityParagonie)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)] for the [Paragonie polyfills](https://github.com/paragonie?utf8=?&q=polyfill) and a number of rulesets related to various [polyfills offered by the Symfony project](https://github.com/symfony?utf8=?&q=polyfill) [[GH](https://github.com/PHPCompatibility/PHPCompatibilitySymfony)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)].
289
+
290
+ If your project uses one of these polyfills, please consider using these special polyfill rulesets to prevent false positives.
291
+
292
+ Also as of this version, [Juliette Reinders Folmer] is now officially a co-maintainer of this package.
293
+
294
+ ### Upgrade instructions
295
+
296
+ * If you have `<exclude name="..."/>` directives in your own project's custom ruleset which relate to sniffs from the PHPCompatibility library, you will need to update your ruleset to use the new sniff names.
297
+ * If you use the new [PHPCS 3.2+ inline annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/3.2.0), i.e. `// phpcs:ignore Standard.Category.SniffName`, in combination with PHPCompatibility sniff names, you will need to update these annotations.
298
+ * If you use neither of the above, you should be fine and upgrading should be painless.
299
+
300
+ ### Overview of all the sniff renames:
301
+
302
+ Old Category.SniffName | New Category.SniffName
303
+ --- | ---
304
+ **PHP**.ArgumentFunctionsUsage | **FunctionUse**.ArgumentFunctionsUsage
305
+ **PHP**.CaseSensitiveKeywords | **Keywords**.CaseSensitiveKeywords
306
+ **PHP**.ConstantArraysUsingConst | **InitialValue**.**New**ConstantArraysUsingConst
307
+ **PHP**.ConstantArraysUsingDefine | **InitialValue**.**New**ConstantArraysUsingDefine
308
+ **PHP**.**Deprecated**Functions | **FunctionUse**.**Removed**Functions
309
+ **PHP**.**Deprecated**IniDirectives | **IniDirectives**.**Removed**IniDirectives
310
+ **PHP**.**Deprecated**MagicAutoload | **FunctionNameRestrictions**.**Removed**MagicAutoload
311
+ **PHP**.**Deprecated**NewReference | **Syntax**.**Removed**NewReference
312
+ **PHP**.**Deprecated**PHP4StyleConstructors | **FunctionNameRestrictions**.**Removed**PHP4StyleConstructors
313
+ **PHP**.**Deprecated**TypeCasts | **TypeCasts**.**Removed**TypeCasts
314
+ **PHP**.DiscouragedSwitchContinue | **ControlStructures**.DiscouragedSwitchContinue
315
+ **PHP**.DynamicAccessToStatic | **Syntax**.**New**DynamicAccessToStatic
316
+ **PHP**.EmptyNonVariable | **LanguageConstructs**.**New**EmptyNonVariable
317
+ **PHP**.ForbiddenBreakContinueOutsideLoop | **ControlStructures**.ForbiddenBreakContinueOutsideLoop
318
+ **PHP**.ForbiddenBreakContinueVariableArguments | **ControlStructures**.ForbiddenBreakContinueVariableArguments
319
+ **PHP**.ForbiddenCallTimePassByReference | **Syntax**.ForbiddenCallTimePassByReference
320
+ **PHP**.Forbidden**ClosureUseVariableNames** | **FunctionDeclarations**.Forbidden**VariableNamesInClosureUse**
321
+ **PHP**.ForbiddenEmptyListAssignment | **Lists**.ForbiddenEmptyListAssignment
322
+ **PHP**.Forbidden**Function**ParametersWithSameName | **FunctionDeclarations**.ForbiddenParametersWithSameName
323
+ **PHP**.ForbiddenGlobalVariableVariable | **Variables**.ForbiddenGlobalVariableVariable
324
+ **PHP**.ForbiddenNames | **Keywords**.ForbiddenNames
325
+ **PHP**.ForbiddenNamesAsDeclared | **Keywords**.ForbiddenNamesAsDeclared
326
+ **PHP**.ForbiddenNamesAsInvokedFunctions | **Keywords**.ForbiddenNamesAsInvokedFunctions
327
+ **PHP**.ForbiddenNegativeBitshift | **Operators**.ForbiddenNegativeBitshift
328
+ **PHP**.ForbiddenSwitchWithMultipleDefaultBlocks | **ControlStructures**.ForbiddenSwitchWithMultipleDefaultBlocks
329
+ **PHP**.InternalInterfaces | **Interfaces**.InternalInterfaces
330
+ **PHP**.LateStaticBinding | **Classes**.**New**LateStaticBinding
331
+ **PHP**.**MbstringReplaceE**Modifier | **ParameterValues**.**RemovedMbstring**Modifier**s**
332
+ **PHP**.NewAnonymousClasses | **Classes**.NewAnonymousClasses
333
+ **PHP**.NewArrayStringDereferencing | **Syntax**.NewArrayStringDereferencing
334
+ **PHP**.NewClasses | **Classes**.NewClasses
335
+ **PHP**.NewClassMemberAccess | **Syntax**.NewClassMemberAccess
336
+ **PHP**.NewClosure | **FunctionDeclarations**.NewClosure
337
+ **PHP**.NewConstants | **Constants**.NewConstants
338
+ **PHP**.NewConstantScalarExpressions | **InitialValue**.NewConstantScalarExpressions
339
+ **PHP**.NewConstVisibility | **Classes**.NewConstVisibility
340
+ **PHP**.NewExecutionDirectives | **ControlStructures**.NewExecutionDirectives
341
+ **PHP**.NewFunctionArrayDereferencing | **Syntax**.NewFunctionArrayDereferencing
342
+ **PHP**.NewFunctionParameters | **FunctionUse**.NewFunctionParameters
343
+ **PHP**.NewFunctions | **FunctionUse**.NewFunctions
344
+ **PHP**.NewGeneratorReturn | **Generators**.NewGeneratorReturn
345
+ **PHP**.NewGroupUseDeclarations | **UseDeclarations**.NewGroupUseDeclarations
346
+ **PHP**.NewHashAlgorithms | **ParameterValues**.NewHashAlgorithms
347
+ **PHP**.NewHeredoc**Initialize** | **InitialValue**.NewHeredoc
348
+ **PHP**.NewIniDirectives | **IniDirectives**.NewIniDirectives
349
+ **PHP**.NewInterfaces | **Interfaces**.NewInterfaces
350
+ **PHP**.NewKeywords | **Keywords**.NewKeywords
351
+ **PHP**.NewLanguageConstructs | **LanguageConstructs**.NewLanguageConstructs
352
+ **PHP**.NewMagicClassConstant | **Constants**.NewMagicClassConstant
353
+ **PHP**.NewMagicMethods | **FunctionNameRestrictions**.NewMagicMethods
354
+ **PHP**.NewMultiCatch | **ControlStructures**.NewMultiCatch
355
+ **PHP**.NewNullableTypes | **FunctionDeclarations**.NewNullableTypes
356
+ **PHP**.NewReturnTypeDeclarations | **FunctionDeclarations**.NewReturnTypeDeclarations
357
+ **PHP**.New**Scalar**TypeDeclarations | **FunctionDeclarations**.New**Param**TypeDeclarations
358
+ **PHP**.NewTrailingComma | **Syntax**.New**FunctionCall**TrailingComma
359
+ **PHP**.NewTypeCasts | **TypeCasts**.NewTypeCasts
360
+ **PHP**.NewUseConstFunction | **UseDeclarations**.NewUseConstFunction
361
+ **PHP**.NonStaticMagicMethods | **FunctionDeclarations**.NonStaticMagicMethods
362
+ **PHP**.OptionalRequiredFunctionParameters | **FunctionUse**.Optional**To**RequiredFunctionParameters
363
+ **PHP**.ParameterShadowSuperGlobals | **FunctionDeclarations**.**Forbidden**ParameterShadowSuperGlobals
364
+ **PHP**.**PCRENew**Modifiers | **ParameterValues**.**NewPCRE**Modifiers
365
+ **PHP**.**PregReplaceE**Modifier | **ParameterValues**.**RemovedPCRE**Modifier**s**
366
+ **PHP**.RemovedAlternativePHPTags | **Miscellaneous**.RemovedAlternativePHPTags
367
+ **PHP**.RemovedConstants | **Constants**.RemovedConstants
368
+ **PHP**.RemovedExtensions | **Extensions**.RemovedExtensions
369
+ **PHP**.RemovedFunctionParameters | **FunctionUse**.RemovedFunctionParameters
370
+ **PHP**.RemovedGlobalVariables | **Variables**.Removed**Predefined**GlobalVariables
371
+ **PHP**.RemovedHashAlgorithms | **ParameterValues**.RemovedHashAlgorithms
372
+ **PHP**.ReservedFunctionNames | **FunctionNameRestrictions**.ReservedFunctionNames
373
+ **PHP**.RequiredOptionalFunctionParameters | **FunctionUse**.Required**To**OptionalFunctionParameters
374
+ **PHP**.ShortArray | **Syntax**.**New**ShortArray
375
+ **PHP**.Ternary**Operators** | **Operators**.**NewShort**Ternary
376
+ **PHP**.ValidIntegers | **Miscellaneous**.ValidIntegers
377
+ **PHP**.**VariableVariables** | **Variables**.**NewUniformVariableSyntax**
378
+
379
+ ### Changelog for version 9.0.0
380
+
381
+ See all related issues and PRs in the [9.0.0 milestone].
382
+
383
+ ### Added
384
+ - :star2: New `PHPCompatibility.ControlStructures.NewForeachExpressionReferencing` sniff to detect referencing of `$value` within a `foreach()` when the iterated array is not a variable. This was not supported prior to PHP 5.5. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664)
385
+ - :star2: New `PHPCompatibility.ControlStructures.NewListInForeach` sniff to detect unpacking nested arrays into separate variables via the `list()` construct in a `foreach()` statement. This was not supported prior to PHP 5.5. [#657](https://github.com/PHPCompatibility/PHPCompatibility/pull/657)
386
+ - :star2: New `PHPCompatibility.FunctionNameRestrictions.RemovedNamespacedAssert` sniff to detect declaring a function called `assert()` within a namespace. This has been deprecated as of PHP 7.3. [#735](https://github.com/PHPCompatibility/PHPCompatibility/pull/735). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
387
+ - :star2: New `PHPCompatibility.Lists.AssignmentOrder` sniff to detect `list()` constructs affected by the change in assignment order in PHP 7.0. [#656](https://github.com/PHPCompatibility/PHPCompatibility/pull/656)
388
+ - :star2: New `PHPCompatibility.Lists.NewKeyedList` sniff to detect usage of keys in `list()`, support for which was added in PHP 7.1. [#655](https://github.com/PHPCompatibility/PHPCompatibility/pull/655). Fixes [#252](https://github.com/PHPCompatibility/PHPCompatibility/issues/252).
389
+ - :star2: New `PHPCompatibility.Lists.NewListReferenceAssignment` sniff to detect reference assignments being used in `list()` constructs, support for which has been added in PHP 7.3. [#731](https://github.com/PHPCompatibility/PHPCompatibility/pull/731)
390
+ - :star2: New `PHPCompatibility.Lists.NewShortList` sniff to detect the shorthand array syntax `[]` being used for symmetric array destructuring as introduced in PHP 7.1. [#654](https://github.com/PHPCompatibility/PHPCompatibility/pull/654). Fixes [#248](https://github.com/PHPCompatibility/PHPCompatibility/issues/248).
391
+ - :star2: New `PHPCompatibility.Operators.NewOperators` sniff which checks for usage of the pow, pow equals, spaceship and coalesce (equals) operators. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
392
+ These checks were previously contained within the `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff.
393
+ - :star2: New `PHPCompatibility.ParameterValues.ForbiddenGetClassNull` sniff to detect `null` being passed to `get_class()`, support for which has been removed in PHP 7.2 [#659](https://github.com/PHPCompatibility/PHPCompatibility/pull/659). Fixes [#557](https://github.com/PHPCompatibility/PHPCompatibility/issues/557).
394
+ - :star2: New `PHPCompatibility.ParameterValues.NewArrayReduceInitialType` sniff to detect non-integers being passed as the `$initial` parameter to the `array_reduce()` function, which was not supported before PHP 5.3. [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666). Fixes [#649](https://github.com/PHPCompatibility/PHPCompatibility/issues/649)
395
+ - :star2: New `PHPCompatibility.ParameterValues.NewFopenModes` sniff to examine the `$mode` parameter passed to `fopen()` for modes not available in older PHP versions. [#658](https://github.com/PHPCompatibility/PHPCompatibility/pull/658)
396
+ - :star2: New `PHPCompatibility.ParameterValues.NewNegativeStringOffset` sniff to detect negative string offsets being passed to string manipulation functions which was not supported before PHP 7.1. [#662](https://github.com/PHPCompatibility/PHPCompatibility/pull/662). Partially fixes [#253](https://github.com/PHPCompatibility/PHPCompatibility/issues/253).
397
+ - :star2: New `PHPCompatibility.ParameterValues.NewPackFormats` sniff to examine the `$format` parameter passed to `pack()` for formats not available in older PHP versions. [#665](https://github.com/PHPCompatibility/PHPCompatibility/pull/665)
398
+ - :star2: New `PHPCompatibility.ParameterValues.RemovedIconvEncoding` sniff to detect the PHP 5.6 deprecated encoding `$type`s being passed to `iconv_set_encoding()`. [#660](https://github.com/PHPCompatibility/PHPCompatibility/pull/660). Fixes [#475](https://github.com/PHPCompatibility/PHPCompatibility/issues/475).
399
+ - :star2: New `PHPCompatibility.ParameterValues.RemovedNonCryptoHashes` sniff to detect non-cryptographic hash algorithms being passed to various `hash_*()` functions. This is no longer accepted as of PHP 7.2. [#663](https://github.com/PHPCompatibility/PHPCompatibility/pull/663). Fixes [#559](https://github.com/PHPCompatibility/PHPCompatibility/issues/559)
400
+ - :star2: New `PHPCompatibility.ParameterValues.RemovedSetlocaleString` sniff to detect string literals being passed to the `$category` parameter of the `setlocale()` function. This behaviour was deprecated in PHP 4.2 and support has been removed in PHP 7.0. [#661](https://github.com/PHPCompatibility/PHPCompatibility/pull/661)
401
+ - :star2: New `PHPCompatibility.Syntax.NewFlexibleHeredocNowdoc` sniff to detect the new heredoc/nowdoc format as allowed as of PHP 7.3. [#736](https://github.com/PHPCompatibility/PHPCompatibility/pull/736). Fixes [#705](https://github.com/PHPCompatibility/PHPCompatibility/issues/705).
402
+ Note: This sniff is only supported in combination with PHP_CodeSniffer 2.6.0 and higher.
403
+ - :star: `PHPCompatibility.Classes.NewClasses` sniff: recognize the new `CompileError` and `JsonException` classes as introduced in PHP 7.3. [#676](https://github.com/PHPCompatibility/PHPCompatibility/pull/676)
404
+ - :star: `PHPCompatibility.Constants.NewConstants` sniff: recognize new constants which are being introduced in PHP 7.3. [#678](https://github.com/PHPCompatibility/PHPCompatibility/pull/678)
405
+ - :star: `PHPCompatibility.Constants.RemovedConstants` sniff: recognize constants which have been deprecated or removed in PHP 7.3. [#710](https://github.com/PHPCompatibility/PHPCompatibility/pull/710). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
406
+ - :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize various new functions being introduced in PHP 7.3. [#679](https://github.com/PHPCompatibility/PHPCompatibility/pull/679)
407
+ - :star: `PHPCompatibility.FunctionUse.NewFunctions` sniff: recognize the `sapi_windows_*()`, `hash_hkdf()` and `pcntl_signal_get_handler()` functions as introduced in PHP 7.1. [#728](https://github.com/PHPCompatibility/PHPCompatibility/pull/728)
408
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctionParameters` sniff: recognize the deprecation of the `$case_insensitive` parameter for the `define()` function in PHP 7.3. [#706](https://github.com/PHPCompatibility/PHPCompatibility/pull/706)
409
+ - :star: `PHPCompatibility.FunctionUse.RemovedFunctions` sniff: recognize the PHP 7.3 deprecation of the `image2wbmp()`, `fgetss()` and `gzgetss()` functions, as well as the deprecation of undocumented Mbstring function aliases. [#681](https://github.com/PHPCompatibility/PHPCompatibility/pull/681), [#714](https://github.com/PHPCompatibility/PHPCompatibility/pull/714), [#720](https://github.com/PHPCompatibility/PHPCompatibility/pull/720). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
410
+ - :star: `PHPCompatibility.FunctionUse.RequiredToOptionalFunctionParameters` sniff: account for the second parameter for `array_push()` and `array_unshift()` becoming optional in PHP 7.3, as well as for the `$mode` parameter for a range of `ftp_*()` functions becoming optional. [#680](https://github.com/PHPCompatibility/PHPCompatibility/pull/680)
411
+ - :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize new `syslog` and `session` ini directives as introduced in PHP 7.3. [#702](https://github.com/PHPCompatibility/PHPCompatibility/pull/702), [#719](https://github.com/PHPCompatibility/PHPCompatibility/pull/719), [#730](https://github.com/PHPCompatibility/PHPCompatibility/pull/730)
412
+ - :star: `PHPCompatibility.IniDirectives.NewIniDirectives` sniff: recognize some more ini directives which were introduced in PHP 7.1. [#727](https://github.com/PHPCompatibility/PHPCompatibility/pull/727)
413
+ - :star: `PHPCompatibility.IniDirectives.RemovedIniDirectived` sniff: recognize ini directives removed in PHP 7.3. [#677](https://github.com/PHPCompatibility/PHPCompatibility/pull/677), [#717](https://github.com/PHPCompatibility/PHPCompatibility/pull/717). Partially fixes [#718](https://github.com/PHPCompatibility/PHPCompatibility/issues/718).
414
+ - :star: New `isNumericCalculation()` and `isVariable()` utility methods to the `PHPCompatibility\Sniff` class. [#664](https://github.com/PHPCompatibility/PHPCompatibility/pull/664), [#666](https://github.com/PHPCompatibility/PHPCompatibility/pull/666)
415
+ - :books: A section about the new sniff naming conventions to the `Contributing` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
416
+
417
+ ### Changed
418
+ - :fire: All sniffs have been placed in meaningful categories and a number of sniffs have been renamed to have more consistent, meaningful and future-proof names. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#601](https://github.com/PHPCompatibility/PHPCompatibility/issues/601), [#692](https://github.com/PHPCompatibility/PHPCompatibility/issues/692)
419
+ See the table at the top of this changelog for details of all the file renames.
420
+ - :umbrella: The unit test files have been moved about as well. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
421
+ * The directory structure for these now mirrors the default directory structure used by PHPCS itself.
422
+ * The file names of the unit test files have been adjusted for the changes made in the sniffs.
423
+ * The unit test case files have been renamed and moved to the same directory as the actual test file they apply to.
424
+ * The `BaseSniffTest::sniffFile()` method has been adjusted to match. The signature of this method has changed. Where it previously expected a relative path to the unit test case file, it now expects an absolute path.
425
+ * The unit tests for the utility methods in the `PHPCompatibility\Sniff` class have been moved to a new `PHPCompatibility\Util\Tests\Core` subdirectory.
426
+ * The bootstrap file used for PHPUnit has been moved to the project root directory and renamed `phpunit-bootstrap.php`.
427
+ - :twisted_rightwards_arrows: The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff has been split into two sniffs. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
428
+ The `PHPCompatibility.LanguageConstructs.NewLanguageConstructs` sniff now contains just the checks for the namespace separator and the ellipsis.
429
+ The new `PHPCompatibility.Operators.NewOperators` sniff now contains the checks regarding the pow, pow equals, spaceship and coalesce (equals) operators.
430
+ - :pushpin: The `PHPCompatibility.ParameterValues.RemovedMbstringModifiers` sniff will now also recognize removed regex modifiers when used within a function call to one of the undocumented Mbstring function aliases for the Mbstring regex functions. [#715](https://github.com/PHPCompatibility/PHPCompatibility/pull/715)
431
+ - :pushpin: The `PHPCompatibility\Sniff::getFunctionCallParameter()` utility method now allows for closures called via a variable. [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723)
432
+ - :pencil2: `PHPCompatibility.Upgrade.LowPHPCS`: the minimum supported PHPCS version is now 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699)
433
+ - :pencil2: Minor inline documentation improvements. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738)
434
+ - :umbrella: Minor improvements to the unit tests for the `PHPCompatibility.FunctionNameRestrctions.RemovedMagicAutoload` sniff. [#716](https://github.com/PHPCompatibility/PHPCompatibility/pull/716)
435
+ - :recycle: Minor other optimizations. [#698](https://github.com/PHPCompatibility/PHPCompatibility/pull/698), [#697](https://github.com/PHPCompatibility/PHPCompatibility/pull/697)
436
+ - :wrench: Minor improvements to the build tools. [#701](https://github.com/PHPCompatibility/PHPCompatibility/pull/701)
437
+ - :wrench: Removed some unnecessary inline annotations. [#700](https://github.com/PHPCompatibility/PHPCompatibility/pull/700)
438
+ - :books: Replaced some of the badges in the Readme file. [#721](https://github.com/PHPCompatibility/PHPCompatibility/pull/721), [#722](https://github.com/PHPCompatibility/PHPCompatibility/pull/722)
439
+ - :books: Composer: updated the list of package authors. [#739](https://github.com/PHPCompatibility/PHPCompatibility/pull/739)
440
+
441
+ ### Removed
442
+ - :no_entry_sign: Support for PHP_CodeSniffer 1.x and low 2.x versions. The new minimum version of PHP_CodeSniffer to be able to use this library is 2.3.0. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699). Fixes [#691](https://github.com/PHPCompatibility/PHPCompatibility/issues/691).
443
+ The minimum _recommended_ version of PHP_CodeSniffer remains the same, i.e. 2.6.0.
444
+ - :no_entry_sign: The `\PHPCompatibility\Sniff::inUseScope()` method has been removed as it is no longer needed now support for PHPCS 1.x has been dropped. [#699](https://github.com/PHPCompatibility/PHPCompatibility/pull/699)
445
+ - :no_entry_sign: Composer: The `autoload` section has been removed from the `composer.json` file. [#738](https://github.com/PHPCompatibility/PHPCompatibility/pull/738). Fixes [#568](https://github.com/PHPCompatibility/PHPCompatibility/issues/568).
446
+ Autoloading for this library is done via the PHP_CodeSniffer default mechanism, enhanced with our own autoloader, so the Composer autoloader shouldn't be needed and was causing issues in a particular use-case.
447
+
448
+ ### Fixed
449
+ - :bug: `PHPCompatibility.FunctionUse.NewFunctionParameters` sniff: The new `$mode` parameter of the `php_uname()` function was added in PHP 4.3, not in PHP 7.0 as was previously being reported.
450
+ The previous implementation of this check was based on an error in the PHP documentation. The error in the PHP documentation has been rectified and the sniff has followed suit. [#711](https://github.com/PHPCompatibility/PHPCompatibility/pull/711)
451
+ - :bug: `PHPCompatibility.Generators.NewGeneratorReturn` sniff: The sniff would throw false positives for `return` statements in nested constructs and did not correctly detect the scope which should be examined. [#725](https://github.com/PHPCompatibility/PHPCompatibility/pull/725). Fixes [#724](https://github.com/PHPCompatibility/PHPCompatibility/pull/724).
452
+ - :bug: `PHPCompatibility.Keywords.NewKeywords` sniff: PHP magic constants are case _in_sensitive. This sniff now accounts for this. [#707](https://github.com/PHPCompatibility/PHPCompatibility/pull/707)
453
+ - :bug: Various bugs in the `PHPCompatibility.Syntax.ForbiddenCallTimePassByReference` sniff [#723](https://github.com/PHPCompatibility/PHPCompatibility/pull/723):
454
+ - Closures called via a variable will now also be examined. (false negative)
455
+ - References within arrays/closures passed as function call parameters would incorrectly trigger an error. (false positive)
456
+ - :green_heart: Compatibility with PHPUnit 7.2. [#712](https://github.com/PHPCompatibility/PHPCompatibility/pull/712)
457
+
458
+ ### Credits
459
+ Thanks go out to [Jonathan Champ] for his contribution to this version. :clap:
460
+
461
+
462
  ## [8.2.0] - 2018-07-17
463
 
464
  See all related issues and PRs in the [8.2.0 milestone].
580
  See all related issues and PRs in the [8.1.0 milestone].
581
 
582
  ### Added
583
+ - :star2: New `NewConstants` and `RemovedConstants` sniffs to detect usage of new/removed PHP constants for all PHP versions from PHP 5 up. [#526](https://github.com/PHPCompatibility/PHPCompatibility/pull/525), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566). Fixes [#263](https://github.com/PHPCompatibility/PHPCompatibility/issues/263).
584
+ - :star2: New `MagicAutoloadDeprecation` sniff to detect deprecated `__autoload()` functions as deprecated in PHP 7.2. [#540](https://github.com/PHPCompatibility/PHPCompatibility/pull/540)
585
+ - :star2: New `OptionalRequiredFunctionParameter` sniff to check for missing function call parameters which were required and only became optional in a later PHP version. [#524](https://github.com/PHPCompatibility/PHPCompatibility/pull/524)
586
+ - :star2: New `DynamicAccessToStatic` sniff to detect dynamic access to static methods and properties, as well as class constants, prior to PHP 5.3. [#535](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#534](https://github.com/PHPCompatibility/PHPCompatibility/issues/534).
587
+ - :star: `DeprecatedFunctions` sniff: recognize yet more PHP 7.2 deprecated functions. [#561](https://github.com/PHPCompatibility/PHPCompatibility/pull/561), [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566)
588
+ - :star: `DeprecatedIniDirectives` sniff: recognize the last of the PHP 7.2 deprecated ini directives. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566), [#567](https://github.com/PHPCompatibility/PHPCompatibility/pull/567)
589
+ - :star: `NewFunctions` : detection of all new PHP 7.2 functions added. [#522](https://github.com/PHPCompatibility/PHPCompatibility/pull/522), [#545](https://github.com/PHPCompatibility/PHPCompatibility/pull/545), [#551](https://github.com/PHPCompatibility/PHPCompatibility/pull/551), [#565](https://github.com/PHPCompatibility/PHPCompatibility/pull/565)
590
+ - :star: `RemovedExtensions` : report on usage of the `mcrypt` extension which has been removed in PHP 7.2. [#566](https://github.com/PHPCompatibility/PHPCompatibility/pull/566)
591
+ - :star: `RemovedGlobalVariables` : detection of the use of `$php_errormsg` with `track_errors` which has been deprecated in PHP 7.2. [#528](https://github.com/PHPCompatibility/PHPCompatibility/pull/528)
592
+ - :books: Documentation : added reporting usage instructions. [#533](https://github.com/PHPCompatibility/PHPCompatibility/pull/533), [#552](https://github.com/PHPCompatibility/PHPCompatibility/pull/552)
593
 
594
  ### Changed
595
+ - :pushpin: `NewClosures` : downgraded "$this found in closure outside class" to warning. [#536](https://github.com/PHPCompatibility/PHPCompatibility/pull/535). Fixes [#527](https://github.com/PHPCompatibility/PHPCompatibility/issues/527).
596
+ - :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw an error for each variable in a `global` statement which is no longer supported and show the variable found to make it easier to fix this. Previously only one error would be thrown per `global` statement. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
597
+ - :pushpin: `ForbiddenGlobalVariableVariable` : the sniff will now throw `warning`s for non-bare variables used in a `global` statement as those are discouraged since PHP 7.0. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
598
+ - :rewind: `NewLanguageConstructs` : updated the version number for `T_COALESCE_EQUAL`. [#523](https://github.com/PHPCompatibility/PHPCompatibility/pull/523)
599
+ - :pencil2: `Sniff::getTestVersion()` : simplified regex logic. [#520](https://github.com/PHPCompatibility/PHPCompatibility/pull/520)
600
+ - :green_heart: Travis : build tests are now being run against PHP 7.2 as well. [#511](https://github.com/PHPCompatibility/PHPCompatibility/pull/511)
601
+ - :wrench: Improved check for superfluous whitespaces in files. [#542](https://github.com/PHPCompatibility/PHPCompatibility/pull/542)
602
+ - :wrench: Build/PHPCS : stabilized the exclude patterns. [#529](https://github.com/PHPCompatibility/PHPCompatibility/pull/529)
603
+ - :wrench: Build/PHPCS : added array indentation check. [#538](https://github.com/PHPCompatibility/PHPCompatibility/pull/538)
604
+ - :white_check_mark: PHPCS cross-version compatibility : sync `FindExtendedClassname()` method with upstream. [#507](https://github.com/PHPCompatibility/PHPCompatibility/pull/507)
605
+ - :wrench: The minimum version for the recommended `DealerDirect/phpcodesniffer-composer-installer` Composer plugin has been upped to `0.4.3`. [#548](https://github.com/PHPCompatibility/PHPCompatibility/pull/548)
606
 
607
  ### Fixed
608
+ - :bug: `ForbiddenCallTimePassByReference` : a false positive was being thrown when a global constant was followed by a _bitwise and_. [#562](https://github.com/PHPCompatibility/PHPCompatibility/pull/562). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39).
609
+ - :bug: `ForbiddenGlobalVariableVariable` : the sniff was overzealous and would also report on `global` in combination with variable variables which are still supported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564). Fixes [#537](https://github.com/PHPCompatibility/PHPCompatibility/issues/537).
610
+ - :bug: `ForbiddenGlobalVariableVariable` : variables interspersed with whitespace and/or comments were not being reported. [#564](https://github.com/PHPCompatibility/PHPCompatibility/pull/564)
611
+ - :rewind: `ForbiddenNamesAsInvokedFunctions` : improved recognition of function invocations using forbidden words and prevent warnings for keywords which are no longer forbidden as method names in PHP 7.0+. [#516](https://github.com/PHPCompatibility/PHPCompatibility/pull/516). Fixes [#515](https://github.com/PHPCompatibility/PHPCompatibility/issues/515)
612
+ - :bug: `VariableVariables` : variables interspersed with whitespace and/or comments were not being reported. [#563](https://github.com/PHPCompatibility/PHPCompatibility/pull/563)
613
+ - :umbrella: Fixed some unintentional syntax errors in test files. [#539](https://github.com/PHPCompatibility/PHPCompatibility/pull/539)
614
+ - :umbrella: Tests : fixed case numbering error. [#525](https://github.com/PHPCompatibility/PHPCompatibility/pull/525)
615
+ - :books: Tests : added missing test skip explanation. [#521](https://github.com/PHPCompatibility/PHPCompatibility/pull/521)
616
+ - :wrench: Fixed PHPCS whitespaces. [#543](https://github.com/PHPCompatibility/PHPCompatibility/pull/543)
617
+ - :wrench: Fixed code test coverage verification. [#550](https://github.com/PHPCompatibility/PHPCompatibility/pull/550). Fixes [#549](https://github.com/PHPCompatibility/PHPCompatibility/issues/549).
618
 
619
  ### Credits
620
  Thanks go out to [Juliette Reinders Folmer] and [Jonathan Van Belle] for their contributions to this version. :clap:
625
  See all related issues and PRs in the [8.0.1 milestone].
626
 
627
  ### Added
628
+ - :star2: New `DeprecatedTypeCasts` sniff to detect deprecated and removed type casts, such as the `(unset)` type cast as deprecated in PHP 7.2. [#498](https://github.com/PHPCompatibility/PHPCompatibility/pull/498)
629
+ - :star2: New `NewTypeCasts` sniff to detect type casts not present in older PHP versions such as the `(binary)` type cast as added in PHP 5.2.1. [#497](https://github.com/PHPCompatibility/PHPCompatibility/pull/497)
630
+ - :star: `NewGroupUseDeclaration`: Detection of PHP 7.2 trailing comma's in group use statements. [#504](https://github.com/PHPCompatibility/PHPCompatibility/pull/504)
631
+ - :star: `DeprecatedFunctions` sniff: recognize some more PHP 7.2 deprecated functions. [#501](https://github.com/PHPCompatibility/PHPCompatibility/pull/501)
632
+ - :star: `DeprecatedIniDirectives` sniff: recognize more PHP 7.2 deprecated ini directives. [#500](https://github.com/PHPCompatibility/PHPCompatibility/pull/500)
633
+ - :star: `ForbiddenNames` sniff: recognize `object` as a forbidden keyword since PHP 7.2. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
634
+ - :star: `NewReturnTypeDeclarations` sniff: recognize generic `parent`, PHP 7.1 `iterable` and PHP 7.2 `object` return type declarations. [#505](https://github.com/PHPCompatibility/PHPCompatibility/pull/505), [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
635
+ - :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.2 `object` type declarion. [#499](https://github.com/PHPCompatibility/PHPCompatibility/pull/499)
636
 
637
  ### Changed
638
+ - :pencil2: Improved clarity of the deprecated functions alternative in the error message. [#502](https://github.com/PHPCompatibility/PHPCompatibility/pull/502)
639
 
640
  ### Fixed
641
+ - :fire_engine: Temporary hotfix for installed_paths (pending [upstream fix](https://github.com/squizlabs/PHP_CodeSniffer/issues/1591).) [#503](https://github.com/PHPCompatibility/PHPCompatibility/pull/503)
642
 
643
  ### Credits
644
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
755
  See all related issues and PRs in the [8.0.0 milestone].
756
 
757
  ### Added
758
+ - :two_hearts: Support for PHP CodeSniffer 3.x. [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#481](https://github.com/PHPCompatibility/PHPCompatibility/pull/481), [#480](https://github.com/PHPCompatibility/PHPCompatibility/pull/480), [#488](https://github.com/PHPCompatibility/PHPCompatibility/pull/488), [#489](https://github.com/PHPCompatibility/PHPCompatibility/pull/489), [#495](https://github.com/PHPCompatibility/PHPCompatibility/pull/495)
759
 
760
  ### Changed
761
  - :gift: As of this version PHPCompatibility will use semantic versioning.
762
+ - :fire: The directory structure of the repository has changed for better compatibility with installation via Composer. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446). Fixes [#102](https://github.com/PHPCompatibility/PHPCompatibility/issues/102), [#107](https://github.com/PHPCompatibility/PHPCompatibility/issues/107)
763
+ - :pencil2: The custom `functionWhitelist` property for the `PHPCompatibility.PHP.RemovedExtensions` sniff is now only supported in combination with PHP CodeSniffer 2.6.0 or higher (due to an upstream bug which was fixed in PHPCS 2.6.0). [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482)
764
+ - :wrench: Improved the information provided to Composer from the `composer.json` file. [#446](https://github.com/PHPCompatibility/PHPCompatibility/pull/446), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486)
765
+ - :wrench: Release archives will no longer contain the unit tests and other typical development files. You can still get these by using Composer with `--prefer-source` or by checking out a git clone of the repository. [#494](https://github.com/PHPCompatibility/PHPCompatibility/pull/494)
766
+ - :wrench: A variety of minor improvements to the build process. [#485](https://github.com/PHPCompatibility/PHPCompatibility/pull/485), [#486](https://github.com/PHPCompatibility/PHPCompatibility/pull/486), [#487](https://github.com/PHPCompatibility/PHPCompatibility/pull/487)
767
+ - :wrench: Some files for use by contributors have been renamed to use `.dist` extensions or moved for easier access. [#478](https://github.com/PHPCompatibility/PHPCompatibility/pull/478), [#479](https://github.com/PHPCompatibility/PHPCompatibility/pull/479), [#483](https://github.com/PHPCompatibility/PHPCompatibility/pull/483), [#493](https://github.com/PHPCompatibility/PHPCompatibility/pull/493)
768
+ - :books: The installation instructions in the Readme. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496)
769
+ - :books: The unit test instructions in the Contributing file. [#496](https://github.com/PHPCompatibility/PHPCompatibility/pull/496)
770
+ - :books: Improved the example code in the Readme. [#490](https://github.com/PHPCompatibility/PHPCompatibility/pull/490)
771
 
772
  ### Removed
773
  - :no_entry_sign: Support for PHP 5.1 and 5.2.
774
 
775
+ The sniffs can now only be run on PHP 5.3 or higher in combination with PHPCS 1.5.6 or 2.x and on PHP 5.4 or higher in combination with PHPCS 3.x. [#484](https://github.com/PHPCompatibility/PHPCompatibility/pull/484), [#482](https://github.com/PHPCompatibility/PHPCompatibility/pull/482)
776
 
777
  ### Credits
778
  Thanks go out to [Gary Jones] and [Juliette Reinders Folmer] for their contributions to this version. :clap:
783
  See all related issues and PRs in the [7.1.5 milestone].
784
 
785
  ### Added
786
+ - :star: The `NewKeywords` sniff will now also sniff for `yield from` which was introduced in PHP 7.0. [#477](https://github.com/PHPCompatibility/PHPCompatibility/pull/477). Fixes [#476](https://github.com/PHPCompatibility/PHPCompatibility/issues/476)
787
+ - :books: The LGPL-3.0 license. [#447](https://github.com/PHPCompatibility/PHPCompatibility/pull/447)
788
 
789
  ### Changed
790
+ - :rewind: The `NewExecutionDirectives` sniff will now also report on execution directives when used in combination with PHPCS 2.0.0-2.3.3. [#451](https://github.com/PHPCompatibility/PHPCompatibility/pull/451)
791
+ - :rewind: The `getMethodParameters()` utility method will no longer break when used with PHPCS 1.5.x < 1.5.6. This affected a number of sniffs. [#452](https://github.com/PHPCompatibility/PHPCompatibility/pull/452)
792
+ - :rewind: The `inUseScope()` utility method will no longer break when used with PHPCS 2.0.0 - 2.2.0. This affected a number of sniffs. [#454](https://github.com/PHPCompatibility/PHPCompatibility/pull/454)
793
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#443](https://github.com/PHPCompatibility/PHPCompatibility/pull/443), [#474](https://github.com/PHPCompatibility/PHPCompatibility/pull/474)
794
+ - :pencil2: Renamed a test file for consistency. [#453](https://github.com/PHPCompatibility/PHPCompatibility/pull/453)
795
+ - :wrench: Code style clean up. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429)
796
+ - :wrench: Prevent Composer installing PHPCS 3.x. **_PHPCS 3.x is not (yet) supported by the PHPCompatibility standard, but will be in the near future._** [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444)
797
+ - :green_heart: The code base will now be checked for consistent code style during build testing. [#429](https://github.com/PHPCompatibility/PHPCompatibility/pull/429)
798
+ - :green_heart: The sniffs are now also tested against HHVM for consistent results. _Note: the sniffs do not contain any HHVM specific checks nor is there any intention to add them at this time._ [#450](https://github.com/PHPCompatibility/PHPCompatibility/pull/450)
799
+ - :books: Made it explicit that - at this moment - PHPCS 3.x is not (yet) supported. [#444](https://github.com/PHPCompatibility/PHPCompatibility/pull/444)
800
+ - :books: Minor improvements to the Readme. [#448](https://github.com/PHPCompatibility/PHPCompatibility/pull/448), [#449](https://github.com/PHPCompatibility/PHPCompatibility/pull/449), [#468](https://github.com/PHPCompatibility/PHPCompatibility/pull/468)
801
+ - :books: Minor improvements to the Contributing guidelines. [#467](https://github.com/PHPCompatibility/PHPCompatibility/pull/467)
802
 
803
  ### Removed
804
+ - :no_entry_sign: The `DefaultTimeZoneRequired` sniff. This sniff was checking server settings rather than code. [#458](https://github.com/PHPCompatibility/PHPCompatibility/pull/458). Fixes [#457](https://github.com/PHPCompatibility/PHPCompatibility/issues/457)
805
+ - :no_entry_sign: The `NewMagicClassConstant` sniff as introduced in v 7.1.4 contained two additional checks for not strictly compatibility related issues. One of these was plainly wrong, the other opinionated. Both have been removed. [#442](https://github.com/PHPCompatibility/PHPCompatibility/pull/442). Fixes [#436](https://github.com/PHPCompatibility/PHPCompatibility/issues/436)
806
 
807
  ### Fixed
808
+ - :bug: `NewClass` sniff: was reporting an incorrect introduction version number for a few of the Exception classes. [#441](https://github.com/PHPCompatibility/PHPCompatibility/pull/441). Fixes [#440](https://github.com/PHPCompatibility/PHPCompatibility/issues/440).
809
+ - :bug: `ForbiddenBreakContinueVariableArguments` sniff: was incorrectly reporting an error if the `break` or `continue` was followed by a PHP closing tag (breaking out of PHP). [#462](https://github.com/PHPCompatibility/PHPCompatibility/pull/462). Fixes [#460](https://github.com/PHPCompatibility/PHPCompatibility/issues/460)
810
+ - :bug: `ForbiddenGlobalVariableVariable` sniff: was incorrectly reporting an error if the `global` statement was followed by a PHP closing tag (breaking out of PHP). [#463](https://github.com/PHPCompatibility/PHPCompatibility/pull/463).
811
+ - :bug: `DeprecatedFunctions` sniff: was reporting false positives for classes using the same name as a deprecated function. [#465](https://github.com/PHPCompatibility/PHPCompatibility/pull/465). Fixes [#464](https://github.com/PHPCompatibility/PHPCompatibility/issues/464)
812
 
813
  ### Credits
814
  Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
819
  See all related issues and PRs in the [7.1.4 milestone].
820
 
821
  ### Added
822
+ - :star2: New `CaseSensitiveKeywords` sniff to detect use of non-lowercase `self`, `static` and `parent` keywords which could cause compatibility issues pre-PHP 5.5. [#382](https://github.com/PHPCompatibility/PHPCompatibility/pull/382)
823
+ - :star2: New `ConstantArraysUsingConst` sniff to detect constants defined using the `const` keyword being assigned an array value which was not supported prior to PHP 5.6. [#397](https://github.com/PHPCompatibility/PHPCompatibility/pull/397)
824
+ - :star2: New `ForbiddenClosureUseVariableNames` sniff to detect PHP 7.1 forbidden variable names in closure use statements. [#386](https://github.com/PHPCompatibility/PHPCompatibility/pull/386). Fixes [#374](https://github.com/PHPCompatibility/PHPCompatibility/issues/374)
825
+ - :star2: New `NewArrayStringDereferencing` sniff to detect array and string literal dereferencing as introduced in PHP 5.5. [#388](https://github.com/PHPCompatibility/PHPCompatibility/pull/388)
826
+ - :star2: New `NewHeredocInitialize` sniff to detect initialization of static variables and class properties/constants using the heredoc syntax which is supported since PHP 5.3. [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391). Fixes [#51](https://github.com/PHPCompatibility/PHPCompatibility/issues/51)
827
+ - :star2: New `NewMagicClassConstant` sniff to detect use of the magic `::class` constant as introduced in PHP 5.5. [#403](https://github.com/PHPCompatibility/PHPCompatibility/pull/403). Fixes [#364](https://github.com/PHPCompatibility/PHPCompatibility/issues/364).
828
+ - :star2: New `NewUseConstFunction` sniff to detect use statements importing constants and functions as introduced in PHP 5.6. [#401](https://github.com/PHPCompatibility/PHPCompatibility/pull/401)
829
+ - :star: `DeprecatedFunctions` sniff: recognize PHP 7.2 deprecated GD functions. [#392](https://github.com/PHPCompatibility/PHPCompatibility/pull/392)
830
+ - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.2 deprecated `mbstring.func_overload` directive. [#377](https://github.com/PHPCompatibility/PHPCompatibility/pull/377)
831
+ - :star: `NewClasses` sniff: check for the PHP 5.1 `libXMLError` class. [#412](https://github.com/PHPCompatibility/PHPCompatibility/pull/412)
832
+ - :star: `NewClasses` sniff: recognize all native PHP Exception classes. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418)
833
+ - :star: `NewClosure` sniff: check for closures being declared as static and closures using `$this`. Both of which was not supported pre-PHP 5.4. [#389](https://github.com/PHPCompatibility/PHPCompatibility/pull/389). Fixes [#24](https://github.com/PHPCompatibility/PHPCompatibility/issues/24).
834
+ - :star: `NewFunctionParameters` sniff: recognize new `exclude_disabled` parameter for the `get_defined_functions()` function as introduced in PHP 7.0.15. [#375](https://github.com/PHPCompatibility/PHPCompatibility/pull/375)
835
+ - :star: `NewFunctions` sniff: recognize new PHP 7.2 socket related functions. [#376](https://github.com/PHPCompatibility/PHPCompatibility/pull/376)
836
+ - :star: `NewInterfaces` sniff: check for some more PHP native interfaces. [#411](https://github.com/PHPCompatibility/PHPCompatibility/pull/411)
837
+ - :star: New `isClassProperty()`, `isClassConstant()` and `validDirectScope()` utility methods to the `PHPCompatibility_Sniff` class. [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#391](https://github.com/PHPCompatibility/PHPCompatibility/pull/391).
838
+ - :star: New `getTypeHintsFromFunctionDeclaration()` utility method to the `PHPCompatibility_Sniff` class. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414).
839
+ - :umbrella: Unit tests against false positives for the `NewMagicMethods` sniff. [#381](https://github.com/PHPCompatibility/PHPCompatibility/pull/381)
840
+ - :umbrella: More unit tests for the `getTestVersion()` utility method. [#405](https://github.com/PHPCompatibility/PHPCompatibility/pull/405), [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430)
841
+ - :green_heart: The XML of the ruleset will now be validated and checked for consistent code style during the build testing by Travis. [#433](https://github.com/PHPCompatibility/PHPCompatibility/pull/433)
842
+ - :books: Readme: information about setting `installed_paths` via a custom ruleset. [#407](https://github.com/PHPCompatibility/PHPCompatibility/pull/407)
843
+ - :books: `Changelog.md` file containing a record of notable changes since the first tagged release. [#421](https://github.com/PHPCompatibility/PHPCompatibility/pull/421)
844
 
845
  ### Changed
846
+ - :pushpin: The `ForbiddenNamesAsDeclared` sniff will now emit `warning`s for soft reserved keywords. [#406](https://github.com/PHPCompatibility/PHPCompatibility/pull/406), [#370](https://github.com/PHPCompatibility/PHPCompatibility/pull/370).
847
+ - :pushpin: The `ForbiddenNames` sniff will now allow for the more liberal rules for usage of reserved keywords as of PHP 7.0. [#417](https://github.com/PHPCompatibility/PHPCompatibility/pull/417)
848
+ - :pushpin: The `InternalInterfaces`, `NewClasses`, `NewConstVisibility`, `NewInterfaces`, `NewMagicMethods`, `NonStaticMagicMethods` and `RemovedGlobalVariables` sniffs will now also sniff for and correctly report violations in combination with anonymous classes. [#378](https://github.com/PHPCompatibility/PHPCompatibility/pull/378), [#383](https://github.com/PHPCompatibility/PHPCompatibility/pull/383), [#393](https://github.com/PHPCompatibility/PHPCompatibility/pull/393), [#394](https://github.com/PHPCompatibility/PHPCompatibility/pull/394), [#395](https://github.com/PHPCompatibility/PHPCompatibility/pull/395), [#396](https://github.com/PHPCompatibility/PHPCompatibility/pull/396). Fixes [#351](https://github.com/PHPCompatibility/PHPCompatibility/issues/351) and [#333](https://github.com/PHPCompatibility/PHPCompatibility/issues/333).
849
+ - :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as type hints. [#414](https://github.com/PHPCompatibility/PHPCompatibility/pull/414), [#416](https://github.com/PHPCompatibility/PHPCompatibility/pull/416). Fixes [#352](https://github.com/PHPCompatibility/PHPCompatibility/issues/352)
850
+ - :pushpin: The `NewClasses` sniff will now also report on Exception classes when used in (multi-)`catch` statements. [#418](https://github.com/PHPCompatibility/PHPCompatibility/pull/418). Fixes [#373](https://github.com/PHPCompatibility/PHPCompatibility/issues/373).
851
+ - :pushpin: The `NewScalarTypeDeclarations` sniff will now report on new type hints even when the type hint is nullable. [#379](https://github.com/PHPCompatibility/PHPCompatibility/pull/379)
852
+ - :twisted_rightwards_arrows: The `NewNowdoc` sniff has been renamed to `NewNowdocQuotedHeredoc` and will now also check for double quoted heredoc identifiers as introduced in PHP 5.3. [#390](https://github.com/PHPCompatibility/PHPCompatibility/pull/390)
853
+ - :rewind: The `NewClasses` sniff will now also report anonymous classes which `extend` a new sniff when used in combination with PHPCS 2.4.0-2.8.0. [#432](https://github.com/PHPCompatibility/PHPCompatibility/pull/432). Fixes [#334](https://github.com/PHPCompatibility/PHPCompatibility/issues/334).
854
+ - :pencil2: `NewFunctionParameter` sniff: version number precision for two parameters. [#384](https://github.com/PHPCompatibility/PHPCompatibility/pull/384), [#428](https://github.com/PHPCompatibility/PHPCompatibility/pull/428)
855
+ - :umbrella: Skipping two unit tests for the `ForbiddenClosureUseVariable` sniff when run on PHPCS 2.5.1 as these cause an infinite loop due to an upstream bug. [#408](https://github.com/PHPCompatibility/PHPCompatibility/pull/408)
856
+ - :umbrella: Skipping unit tests involving `trait`s in combination with PHP < 5.4 and PHPCS < 2.4.0 as `trait`s are not recognized in those circumstances. [#431](https://github.com/PHPCompatibility/PHPCompatibility/pull/431)
857
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#385](https://github.com/PHPCompatibility/PHPCompatibility/pull/385), [#387](https://github.com/PHPCompatibility/PHPCompatibility/pull/387), [#415](https://github.com/PHPCompatibility/PHPCompatibility/pull/415), [#423](https://github.com/PHPCompatibility/PHPCompatibility/pull/423), [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424)
858
+ - :recycle: Minor simplification of the PHPUnit 6 compatibility layer and other test code. [#426](https://github.com/PHPCompatibility/PHPCompatibility/pull/426), [#425](https://github.com/PHPCompatibility/PHPCompatibility/pull/425)
859
+ - General housekeeping. [#398](https://github.com/PHPCompatibility/PHPCompatibility/pull/398), [#400](https://github.com/PHPCompatibility/PHPCompatibility/pull/400)
860
+ - :wrench: Minor tweaks to the Travis build script. [#409](https://github.com/PHPCompatibility/PHPCompatibility/pull/409)
861
+ - :green_heart: The sniffs are now also tested against PHP nightly for consistent results. [#380](https://github.com/PHPCompatibility/PHPCompatibility/pull/380)
862
 
863
  ### Fixed
864
+ - :fire: Using unbounded ranges in `testVersion` resulted in unreported errors when used with sniffs using the `supportsBelow()` method. This affected the results of approximately half the sniffs. [#430](https://github.com/PHPCompatibility/PHPCompatibility/pull/430)
865
+ - :bug: The `ForbiddenNames` sniff would throw false positives for `use` statements with the `final` modifier in traits. [#402](https://github.com/PHPCompatibility/PHPCompatibility/pull/402).
866
+ - :bug: The `ForbiddenNames` sniff would fail to report on functions declared to return by reference using a reserved keyword as the function name. [#413](https://github.com/PHPCompatibility/PHPCompatibility/pull/413)
867
+ - :bug: The `ForbiddenNames` sniff would only examine the first part of a namespace and not report on reserved keywords used in subsequent parts of a nested namespace. [#419](https://github.com/PHPCompatibility/PHPCompatibility/pull/419)
868
+ - :bug: The `ForbiddenNames` sniff would not always correctly report on use statements importing constants or functions using reserved keywords. [#420](https://github.com/PHPCompatibility/PHPCompatibility/pull/420)
869
+ - :bug: The `NewKeywords` sniff would sometimes fail to report on the `const` keyword when used in a class, but not for a class constant. [#424](https://github.com/PHPCompatibility/PHPCompatibility/pull/424)
870
+ - :green_heart: PHPCS has released version 3.0 and updated the `master` branch to reflect this. This was causing the builds to fail. [#422](https://github.com/PHPCompatibility/PHPCompatibility/pull/422)
871
 
872
  ### Credits
873
  Thanks go out to [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
881
  - :zap: The `testVersion` config parameter now allows for specifying unbounded ranges.
882
  For example: specifying `-5.6` means: check for compatibility with all PHP versions up to and including PHP 5.6;
883
  Specifying `7.0-` means: check for compatibility with all PHP versions from PHP 7.0 upwards.
884
+ For more information about setting the `testVersion`, see [Using the compatibility sniffs](https://github.com/PHPCompatibility/PHPCompatibility#using-the-compatibility-sniffs) in the readme.
885
+ - :umbrella: Unit test for multi-line short arrays for the `ShortArray` sniff. [#347](https://github.com/PHPCompatibility/PHPCompatibility/pull/347)
886
+ - :umbrella: Various additional unit tests against false positives. [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369)
887
+ - :umbrella: Unit tests for the `supportsBelow()`, `supportsAbove()` and `getTestVersion()` utility methods. [#363](https://github.com/PHPCompatibility/PHPCompatibility/pull/363)
888
+ - :books: Readme: information about installation of the standard using git check-out. [#349](https://github.com/PHPCompatibility/PHPCompatibility/pull/349)
889
+ - :books: `Contributing.md` file with information about reporting bugs, requesting features, making pull requests and running the unit tests. [#350](https://github.com/PHPCompatibility/PHPCompatibility/pull/350)
890
 
891
  ### Changed
892
+ - :pushpin: The `ForbiddenFunctionParametersWithSameName`, `NewScalarTypeDeclarations`, `ParameterShadowSuperGlobals` sniff will now also sniff for and report violations in closures. [#331](https://github.com/PHPCompatibility/PHPCompatibility/pull/331)
893
+ - :twisted_rightwards_arrows: :rewind: The check for the PHP 5.3 `nowdoc` structure has been moved from the `NewKeywords` sniff to a new stand-alone `NewNowdoc` sniff which will now also recognize this structure when the sniffs are run on PHP 5.2. [#335](https://github.com/PHPCompatibility/PHPCompatibility/pull/335)
894
+ - :rewind: The `ForbiddenNames` sniff will now also correctly recognize reserved keywords used in a declared namespace when run on PHP 5.2. [#362](https://github.com/PHPCompatibility/PHPCompatibility/pull/362)
895
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#360](https://github.com/PHPCompatibility/PHPCompatibility/pull/360)
896
  - :recycle: The unit tests would previously run each test case file against all PHPCompatibility sniffs. Now, they will only be tested against the sniff which the test case file is intended to test. This allows for more test cases to be tested, more precise testing in combination with `testVersion` settings and makes the unit tests run ~6 x faster.
897
+ Relevant additional unit tests have been added and others adjusted. [#369](https://github.com/PHPCompatibility/PHPCompatibility/pull/369)
898
+ - :recycle: Refactoring/tidying up of some unit test code. [#343](https://github.com/PHPCompatibility/PHPCompatibility/pull/343), [#345](https://github.com/PHPCompatibility/PHPCompatibility/pull/345), [#356](https://github.com/PHPCompatibility/PHPCompatibility/pull/356), [#355](https://github.com/PHPCompatibility/PHPCompatibility/pull/355), [#359](https://github.com/PHPCompatibility/PHPCompatibility/pull/359)
899
+ - General housekeeping. [#346](https://github.com/PHPCompatibility/PHPCompatibility/pull/346)
900
+ - :books: Readme: Clarify minimum requirements and influence on the results. [#348](https://github.com/PHPCompatibility/PHPCompatibility/pull/348)
901
 
902
  ### Removed
903
+ - :twisted_rightwards_arrows: Removed the `LongArrays` sniff. The checks it contained have been moved into the `RemovedGlobalVariables` sniff. Both sniffs essentially did the same thing, just for different PHP native superglobals. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354)
904
 
905
  ### Fixed
906
+ - :bug: The `PregReplaceEModifier` sniff would throw a false positive if a quote character was used as the regex delimiter. [#357](https://github.com/PHPCompatibility/PHPCompatibility/pull/357)
907
+ - :bug: `RemovedGlobalVariables` sniff would report false positives for class properties shadowing the removed `$HTTP_RAW_POST_DATA` variables. [#354](https://github.com/PHPCompatibility/PHPCompatibility/pull/354).
908
+ - :bug: The `getFQClassNameFromNewToken()` utility function could go into an infinite loop causing PHP to run out of memory when examining unfinished code (examination during live coding). [#338](https://github.com/PHPCompatibility/PHPCompatibility/pull/338), [#342](https://github.com/PHPCompatibility/PHPCompatibility/pull/342)
909
+ - :bug: The `determineNamespace()` utility method would in certain cases not break out a loop. [#358](https://github.com/PHPCompatibility/PHPCompatibility/pull/358)
910
+ - :wrench: Travis script: Minor tweak for PHP 5.2 compatibility. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/341)
911
+ - :wrench: The unit test suite is now also compatible with PHPUnit 6. [#365](https://github.com/PHPCompatibility/PHPCompatibility/pull/365)
912
+ - :books: Readme: Typo in the composer instructions. [#344](https://github.com/PHPCompatibility/PHPCompatibility/pull/344)
913
 
914
  ### Credits
915
  Thanks go out to [Arthur Edamov], [Juliette Reinders Folmer], [Mark Clements] and [Tadas Juozapaitis] for their contributions to this version. :clap:
920
  See all related issues and PRs in the [7.1.2 milestone].
921
 
922
  ### Added
923
+ - :star2: New `VariableVariables` sniff to detect variables variables for which the behaviour has changed in PHP 7.0. [#310](https://github.com/PHPCompatibility/PHPCompatibility/pull/310) Fixes [#309](https://github.com/PHPCompatibility/PHPCompatibility/issues/309).
924
+ - :star: The `NewReturnTypeDeclarations` sniff will now also sniff for non-scalar return type declarations, i.e. `array`, `callable`, `self` or a class name. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
925
+ - :star: The `NewLanguageConstructs` sniff will now also sniff for the null coalesce equal operator `??=`. This operator is slated to be introduced in PHP 7.2 and PHPCS already accounts for it. [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340)
926
+ - :star: New `getReturnTypeHintToken()` utility method to the `PHPCompatibility_Sniff` class to retrieve return type hints from function declarations in a cross-PHPCS-version compatible way. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323).
927
+ - :star: New `stripVariables()` utility method to the `PHPCompatibility_Sniff` class to strip variables from interpolated text strings. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314).
928
+ - :umbrella: Additional unit tests covering previously uncovered code. [#308](https://github.com/PHPCompatibility/PHPCompatibility/pull/308)
929
 
930
  ### Changed
931
+ - :pushpin: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and `NewExecutionDirectives` sniffs will now also correctly interpret double quoted text strings with interpolated variables. [#341](https://github.com/PHPCompatibility/PHPCompatibility/pull/314), [#324](https://github.com/PHPCompatibility/PHPCompatibility/pull/324).
932
+ - :pushpin: The `NewNullableTypes` sniff will now also report on nullable (return) type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
933
+ - :pushpin: The `NewReturnTypeDeclarations` sniff will now also report on return type hints when used with closures. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
934
+ - :pushpin: Allow for anonymous classes in the `inClassScope()` utility method. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315)
935
+ - :pushpin: The function call parameter related utility functions can now also be used to get the individual items from an array declaration. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
936
+ - :twisted_rightwards_arrows: The `NewScalarReturnTypeDeclarations` sniff has been renamed to `NewReturnTypeDeclarations`. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
937
+ - :rewind: The `ForbiddenNames` sniff will now also correctly ignore anonymous classes when used in combination with PHPCS < 2.3.4. [#319](https://github.com/PHPCompatibility/PHPCompatibility/pull/319)
938
+ - :rewind: The `NewAnonymousClasses` sniff will now correctly recognize and report on anonymous classes when used in combination with PHPCS < 2.5.2. [#325](https://github.com/PHPCompatibility/PHPCompatibility/pull/325)
939
+ - :rewind: The `NewGroupUseDeclarations` sniff will now correctly recognize and report on group use statements when used in combination with PHPCS < 2.6.0. [#320](https://github.com/PHPCompatibility/PHPCompatibility/pull/320)
940
+ - :rewind: The `NewNullableTypes` sniff will now correctly recognize and report on nullable return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
941
+ - :rewind: The `NewReturnTypeDeclarations` sniff will now correctly recognize and report on new return types when used in combination with PHPCS < 2.6.0. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
942
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#317](https://github.com/PHPCompatibility/PHPCompatibility/pull/317)
943
+ - :recycle: Defer to upstream `hasCondition()` utility method where appropriate. [#315](https://github.com/PHPCompatibility/PHPCompatibility/pull/315)
944
+ - :recycle: Minor refactoring of some unit test code. [#304](https://github.com/PHPCompatibility/PHPCompatibility/pull/304), [#303](https://github.com/PHPCompatibility/PHPCompatibility/pull/303), [#318](https://github.com/PHPCompatibility/PHPCompatibility/pull/318)
945
+ - :wrench: All unit tests now have appropriate `@group` annotations allowing for quicker/easier testing of a select group of tests/sniffs. [#305](https://github.com/PHPCompatibility/PHPCompatibility/pull/305)
946
+ - :wrench: All unit tests now have appropriate `@covers` annotations to improve code coverage reporting and remove bleed through of accidental coverage. [#307](https://github.com/PHPCompatibility/PHPCompatibility/pull/307)
947
+ - :wrench: Minor tweaks to the travis script. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322)
948
+ - :green_heart: The PHPCompatibility code base itself will now be checked for cross-version compatibility during build testing. [#322](https://github.com/PHPCompatibility/PHPCompatibility/pull/322)
949
 
950
  ### Fixed
951
+ - :bug: The `ConstantArraysUsingDefine` sniff would throw false positives if the value of the `define()` was retrieved via a function call and an array parameter was passed. [#327](https://github.com/PHPCompatibility/PHPCompatibility/pull/327)
952
+ - :bug: The `ForbiddenCallTimePassByReference` sniff would throw false positives on assign by reference within function calls or conditions. [#302](https://github.com/PHPCompatibility/PHPCompatibility/pull/302) Fixes the last two cases reported in [#68](https://github.com/PHPCompatibility/PHPCompatibility/issues/68#issuecomment-231366445)
953
+ - :bug: The `ForbiddenGlobalVariableVariableSniff` sniff would only examine the first variable in a `global ...` statement causing unreported issues if subsequent variables were variable variables. [#316](https://github.com/PHPCompatibility/PHPCompatibility/pull/316)
954
+ - :bug: The `NewKeywords` sniff would throw a false positive for the `const` keyword when encountered in an interface. [#312](https://github.com/PHPCompatibility/PHPCompatibility/pull/312)
955
+ - :bug: The `NewNullableTypes` sniff would not report on nullable return types for namespaced classnames used as a type hint. [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323)
956
+ - :bug: The `PregReplaceEModifier` sniff would always consider the first parameter passed as a single regex, while it could also be an array of regexes. This led to false positives and potentially unreported use of the `e` modifier when an array of regexes was passed. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
957
+ - :bug: The `PregReplaceEModifier` sniff could misidentify the regex delimiter when the regex to be examined was concatenated together from various text strings taken from a compound parameter leading to false positives. [#300](https://github.com/PHPCompatibility/PHPCompatibility/pull/300)
958
+ - :white_check_mark: Compatibility with PHPCS 2.7.x. Deal with changed behaviour of the upstream PHP tokenizer and utility function(s). [#313](https://github.com/PHPCompatibility/PHPCompatibility/pull/313), [#323](https://github.com/PHPCompatibility/PHPCompatibility/pull/323), [#326](https://github.com/PHPCompatibility/PHPCompatibility/pull/326), [#340](https://github.com/PHPCompatibility/PHPCompatibility/pull/340)
959
 
960
  ### Credits
961
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
966
  See all related issues and PRs in the [7.1.1 milestone].
967
 
968
  ### Added
969
+ - :star: `ForbiddenNamesAsDeclared` sniff: detection of the PHP 7.1 `iterable` and `void` reserved keywords when used to name classes, interfaces or traits. [#298](https://github.com/PHPCompatibility/PHPCompatibility/pull/298)
970
 
971
  ### Fixed
972
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `clone` keyword was used with parenthesis. [#299](https://github.com/PHPCompatibility/PHPCompatibility/pull/299). Fixes [#284](https://github.com/PHPCompatibility/PHPCompatibility/issues/284)
973
 
974
  ### Credits
975
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
980
  See all related issues and PRs in the [7.1.0 milestone].
981
 
982
  ### Added
983
+ - :star: New `stringToErrorCode()`, `arrayKeysToLowercase()` and `addMessage()` utility methods to the `PHPCompatibility_Sniff` class. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291).
984
 
985
  ### Changed
986
+ - :pushpin: All sniff error messages now have modular error codes allowing for selectively disabling individual checks - and even selectively disabling individual sniff for specific files - without disabling the complete sniff. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
987
+ - :pencil2: Minor changes to some of the error message texts for consistency across sniffs. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
988
+ - :recycle: Refactored the complex version sniffs to reduce code duplication. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
989
+ - :recycle: Miscellaneous other refactoring for improved performance and sniff accuracy. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
990
+ - :umbrella: The unit tests for the `RemovedExtensions` sniff now verify that the correct alternative extension is being suggested. [#291](https://github.com/PHPCompatibility/PHPCompatibility/pull/291)
991
 
992
  ### Credits
993
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
998
  See all related issues and PRs in the [7.0.8 milestone].
999
 
1000
  ### Added
1001
+ - :star2: New `ForbiddenNamesAsDeclared` sniff: detection of the [other reserved keywords](http://php.net/manual/en/reserved.other-reserved-words.php) which are reserved as of PHP 7.0 (or higher). [#287](https://github.com/PHPCompatibility/PHPCompatibility/pull/287). Fixes [#115](https://github.com/PHPCompatibility/PHPCompatibility/issues/115).
1002
  These were previously sniffed for by the `ForbiddenNames` and `ForbiddenNamesAsInvokedFunctions` sniffs causing false positives as the rules for their reservation are different from the rules for "normal" [reserved keywords](http://php.net/manual/en/reserved.keywords.php).
1003
+ - :star: New `inUseScope()` utility method to the `PHPCompatibility_Sniff` class which handles PHPCS cross-version compatibility when determining the scope of a `use` statement. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
1004
+ - :umbrella: More unit tests for the `ForbiddenNames` sniff. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
1005
 
1006
  ### Changed
1007
+ - :pushpin: _Deprecated_ functionality should throw a `warning`. _Removed_ or otherwise unavailable functionality should throw an `error`. This distinction was previously not consistently applied everywhere. [#286](https://github.com/PHPCompatibility/PHPCompatibility/pull/286)
1008
  This change affects the following sniffs:
1009
  * `DeprecatedPHP4StyleConstructors` will now throw a `warning` instead of an `error` for deprecated PHP4 style class constructors.
1010
  * `ForbiddenCallTimePassByReference` will now throw a `warning` if the `testVersion` is `5.3` and an `error` if the `testVersion` if `5.4` or higher.
1011
  * `MbstringReplaceEModifier` will now throw a `warning` instead of an `error` for usage of the deprecated `e` modifier.
1012
+ * `PregReplaceEModifier` will now throw a `warning` if the `testVersion` is `5.5` or `5.6` and an `error` if the `testVersion` if `7.0` or higher. Fixes [#290](https://github.com/PHPCompatibility/PHPCompatibility/issues/290).
1013
  * `TernaryOperators` will now throw an `error` when the `testVersion` < `5.3` and the middle part has been omitted.
1014
  * `ValidIntegers` will now throw a `warning` when an invalid binary integer is detected.
1015
+ - :pencil2: `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs: minor change in the sniff error message text. Use _"removed"_ rather than the ominous _"forbidden"_. [#285](https://github.com/PHPCompatibility/PHPCompatibility/pull/285)
1016
  Also updated relevant internal variable names and documentation to match.
1017
 
1018
  ### Fixed
1019
+ - :bug: `ForbiddenNames` sniff would throw false positives for `use` statements which changed the visibility of methods in traits. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
1020
+ - :bug: `ForbiddenNames` sniff would not report reserved keywords when used in combination with `use function` or `use const`. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
1021
+ - :bug: `ForbiddenNames` sniff would potentially - unintentionally - skip over tokens, thereby - potentially - not reporting all errors. [#271](https://github.com/PHPCompatibility/PHPCompatibility/pull/271).
1022
+ - :wrench: Composer config: `prefer-stable` should be a root element of the json file. Fixes [#277](https://github.com/PHPCompatibility/PHPCompatibility/issues/277).
1023
 
1024
  ### Credits
1025
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
1030
  See all related issues and PRs in the [7.0.7 milestone].
1031
 
1032
  ### Added
1033
+ - :star2: New `ForbiddenBreakContinueOutsideLoop` sniff: verify that `break`/`continue` is not used outside of a loop structure. This will cause fatal errors since PHP 7.0. [#278](https://github.com/PHPCompatibility/PHPCompatibility/pull/278). Fixes [#275](https://github.com/PHPCompatibility/PHPCompatibility/issues/275)
1034
+ - :star2: New `NewConstVisibility` sniff: detect visibility indicators for `class` and `interface` constants as introduced in PHP 7.1. [#280](https://github.com/PHPCompatibility/PHPCompatibility/pull/280). Fixes [#249](https://github.com/PHPCompatibility/PHPCompatibility/issues/249)
1035
+ - :star2: New `NewHashAlgorithms` sniff to check used hash algorithms against the PHP version in which they were introduced. [#242](https://github.com/PHPCompatibility/PHPCompatibility/pull/242)
1036
+ - :star2: New `NewMultiCatch` sniff: detect catch statements catching multiple Exceptions as introduced in PHP 7.1. [#281](https://github.com/PHPCompatibility/PHPCompatibility/pull/281). Fixes [#251](https://github.com/PHPCompatibility/PHPCompatibility/issues/251)
1037
+ - :star2: New `NewNullableTypes` sniff: detect nullable parameter and return type hints (only supported in PHPCS >= 2.3.4) as introduced in PHP 7.1. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282). Fixes [#247](https://github.com/PHPCompatibility/PHPCompatibility/issues/247)
1038
+ - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.1 removed `session` ini directives. [#256](https://github.com/PHPCompatibility/PHPCompatibility/pull/256)
1039
+ - :star: `NewFunctions` sniff: recognize new `socket_export_stream()` function as introduced in PHP 7.0.7. [#264](https://github.com/PHPCompatibility/PHPCompatibility/pull/264)
1040
+ - :star: `NewFunctions` sniff: recognize new `curl_...()`, `is_iterable()`, `pcntl_async_signals()`, `session_create_id()`, `session_gc()` functions as introduced in PHP 7.1. [#273](https://github.com/PHPCompatibility/PHPCompatibility/pull/273)
1041
+ - :star: `NewFunctionParameters` sniff: recognize new OpenSSL function parameters as introduced in PHP 7.1. [#258](https://github.com/PHPCompatibility/PHPCompatibility/pull/258)
1042
+ - :star: `NewIniDirectives` sniff: recognize new `session` ini directives as introduced in PHP 7.1. [#259](https://github.com/PHPCompatibility/PHPCompatibility/pull/259)
1043
+ - :star: `NewScalarReturnTypeDeclarations` sniff: recognize PHP 7.1 `void` return type hint. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250)
1044
+ - :star: `NewScalarTypeDeclarations` sniff: recognize PHP 7.1 `iterable` type hint. [#255](https://github.com/PHPCompatibility/PHPCompatibility/pull/255)
1045
+ - :star: Recognize the PHP 7.1 deprecated `mcrypt` functionality in the `RemovedExtensions`, `DeprecatedFunctions` and `DeprecatedIniDirectives` sniffs. [#257](https://github.com/PHPCompatibility/PHPCompatibility/pull/257)
1046
 
1047
  ### Changed
1048
+ - :pushpin: `LongArrays` sniff used to only throw `warning`s. It will now throw `error`s for PHP versions in which the long superglobals have been removed. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270)
1049
+ - :pushpin: The `NewIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a new ini directive is used in combination with `ini_set()`. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246).
1050
+ - :pushpin: `RemovedHashAlgorithms` sniff: also recognize removed algorithms when used with the PHP 5.5+ `hash_pbkdf2()` function. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240)
1051
+ - :pushpin: Properly recognize nullable type hints in the `getMethodParameters()` utility method. [#282](https://github.com/PHPCompatibility/PHPCompatibility/pull/282)
1052
+ - :pencil2: `DeprecatedPHP4StyleConstructors` sniff: minor error message text fix. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236)
1053
+ - :pencil2: `NewIniDirectives` sniff: improved precision for the introduction version numbers being reported. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246)
1054
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238), [#244](https://github.com/PHPCompatibility/PHPCompatibility/pull/244), [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240), [#276](https://github.com/PHPCompatibility/PHPCompatibility/pull/276)
1055
+ - :umbrella: Re-activate the unit tests for the `NewScalarReturnTypeDeclarations` sniff. [#250](https://github.com/PHPCompatibility/PHPCompatibility/pull/250)
1056
 
1057
  ### Fixed
1058
+ - :bug: The `DeprecatedPHP4StyleConstructors` sniff would not report errors when the case of the class name and the PHP4 constructor function name did not match. [#236](https://github.com/PHPCompatibility/PHPCompatibility/pull/236)
1059
+ - :bug: `LongArrays` sniff would report false positives for class properties shadowing removed PHP superglobals. [#270](https://github.com/PHPCompatibility/PHPCompatibility/pull/270). Fixes [#268](https://github.com/PHPCompatibility/PHPCompatibility/issues/268).
1060
+ - :bug: The `NewClasses` sniff would not report errors when the case of the class name used and "official" class name did not match. [#237](https://github.com/PHPCompatibility/PHPCompatibility/pull/237)
1061
+ - :bug: The `NewIniDirectives` sniff would report violations against the PHP version in which the ini directive was introduced. This should be the version below it. [#246](https://github.com/PHPCompatibility/PHPCompatibility/pull/246)
1062
+ - :bug: `PregReplaceEModifier` sniff would report false positives for compound regex parameters with different quote types. [#266](https://github.com/PHPCompatibility/PHPCompatibility/pull/266). Fixes [#265](https://github.com/PHPCompatibility/PHPCompatibility/issues/265).
1063
+ - :bug: `RemovedGlobalVariables` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#245](https://github.com/PHPCompatibility/PHPCompatibility/pull/245).
1064
+ - :bug: The `RemovedHashAlgorithms` sniff would not report errors when the case of the hash function name used and "official" class name did not match. [#240](https://github.com/PHPCompatibility/PHPCompatibility/pull/240)
1065
+ - :bug: The `ShortArray` sniff would report all violations on the line of the PHP open tag, not on the lines of the short array open/close tags. [#238](https://github.com/PHPCompatibility/PHPCompatibility/pull/238)
1066
 
1067
  ### Credits
1068
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
1073
  See all related issues and PRs in the [7.0.6 milestone].
1074
 
1075
  ### Added
1076
+ - :star: New `stripQuotes()` utility method in the `PHPCompatibility_Sniff` base class to strip quotes which surround text strings in a consistent manner. [#224](https://github.com/PHPCompatibility/PHPCompatibility/pull/224)
1077
+ - :books: Readme: Add _PHP Version Support_ section. [#225](https://github.com/PHPCompatibility/PHPCompatibility/pull/225)
1078
 
1079
  ### Changed
1080
+ - :pushpin: The `ForbiddenCallTimePassByReference` sniff will now also report the deprecation as of PHP 5.3, not just its removal as of PHP 5.4. [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203)
1081
+ - :pushpin: The `NewFunctionArrayDereferencing` sniff will now also check _method_ calls for array dereferencing, not just function calls. [#229](https://github.com/PHPCompatibility/PHPCompatibility/pull/229). Fixes [#227](https://github.com/PHPCompatibility/PHPCompatibility/issues/227).
1082
+ - :pencil2: The `NewExecutionDirectives` sniff will now throw `warning`s instead of `error`s for invalid values encountered in execution directives. [#223](https://github.com/PHPCompatibility/PHPCompatibility/pull/223)
1083
+ - :pencil2: Minor miscellaneous fixes. [#231](https://github.com/PHPCompatibility/PHPCompatibility/pull/231)
1084
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#219](https://github.com/PHPCompatibility/PHPCompatibility/pull/219), [#203](https://github.com/PHPCompatibility/PHPCompatibility/pull/203)
1085
+ - :recycle: Defer to upstream `findImplementedInterfaceNames()` utility method when it exists. [#222](https://github.com/PHPCompatibility/PHPCompatibility/pull/222)
1086
+ - :wrench: Exclude the test files from analysis by Scrutinizer CI. [#230](https://github.com/PHPCompatibility/PHPCompatibility/pull/230)
1087
 
1088
  ### Removed
1089
+ - :no_entry_sign: Some redundant code. [#232](https://github.com/PHPCompatibility/PHPCompatibility/pull/232)
1090
 
1091
  ### Fixed
1092
+ - :bug: The `EmptyNonVariable` sniff would throw false positives for variable variables and for array access with a (partially) variable array index. [#212](https://github.com/PHPCompatibility/PHPCompatibility/pull/212). Fixes [#210](https://github.com/PHPCompatibility/PHPCompatibility/issues/210).
1093
+ - :bug: The `NewFunctionArrayDereferencing` sniff would throw false positives for lines of code containing both a function call as well as square brackets, even when they were unrelated. [#228](https://github.com/PHPCompatibility/PHPCompatibility/pull/228). Fixes [#226](https://github.com/PHPCompatibility/PHPCompatibility/issues/226).
1094
+ - :bug: `ParameterShadowSuperGlobals` sniff would report false positives for lowercase/mixed cased variables shadowing superglobals. [#218](https://github.com/PHPCompatibility/PHPCompatibility/pull/218). Fixes [#214](https://github.com/PHPCompatibility/PHPCompatibility/issues/214).
1095
+ - :bug: The `determineNamespace()` utility method now accounts properly for namespaces within scoped `declare()` statements. [#221](https://github.com/PHPCompatibility/PHPCompatibility/pull/221)
1096
+ - :books: Readme: Logo alignment in the Credits section. [#233](https://github.com/PHPCompatibility/PHPCompatibility/pull/233)
1097
 
1098
  ### Credits
1099
  Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Mark Clements] for their contributions to this version. :clap:
1104
  See all related issues and PRs in the [7.0.5 milestone].
1105
 
1106
  ### Added
1107
+ - :star2: New `MbstringReplaceEModifier` sniff to detect the use of the PHP 7.1 deprecated `e` modifier in Mbstring regex functions. [#202](https://github.com/PHPCompatibility/PHPCompatibility/pull/202)
1108
+ - :star: The `ForbiddenBreakContinueVariableArguments` sniff will now also report on `break 0`/`continue 0` which is not allowed since PHP 5.4. [#209](https://github.com/PHPCompatibility/PHPCompatibility/pull/209)
1109
+ - :star: New `getFunctionCallParameters()`, `getFunctionCallParameter()` utility methods in the `PHPCompatibility_Sniff` base class. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170)
1110
+ - :star: New `tokenHasScope()` utility method in the `PHPCompatibility_Sniff` base class. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
1111
+ - :umbrella: Unit test for `goto` and `callable` detection and some other miscellanous extra unit tests for the `NewKeywords` sniff. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
1112
+ - :books: Readme: Information for sniff developers about running unit tests for _other_ sniff libraries using the PHPCS native test framework without running into conflicts with the PHPCompatibility specific unit test framework. [#217](https://github.com/PHPCompatibility/PHPCompatibility/pull/217)
1113
 
1114
  ### Changed
1115
+ - :pushpin: The `ForbiddenNames` sniff will now also check interface declarations for usage of reserved keywords. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200)
1116
+ - :pushpin: `PregReplaceEModifier` sniff: improved handling of regexes build up of a combination of variables, function calls and/or text strings. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
1117
+ - :rewind: The `NewKeywords` sniff will now also correctly recognize new keywords when used in combination with older PHPCS versions and/or run on older PHP versions. [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189)
1118
+ - :pencil2: `PregReplaceEModifier` sniff: minor improvement to the error message text. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
1119
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170), [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188), [#189](https://github.com/PHPCompatibility/PHPCompatibility/pull/189), [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199), [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200), [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201), [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208)
1120
+ - :wrench: The unit tests for the utility methods have been moved to their own subdirectory within `Tests`. [#215](https://github.com/PHPCompatibility/PHPCompatibility/pull/215)
1121
+ - :green_heart: The sniffs are now also tested against PHP 7.1 for consistent results. [#216](https://github.com/PHPCompatibility/PHPCompatibility/pull/216)
1122
 
1123
  ### Removed
1124
+ - :no_entry_sign: Some redundant code. [26d0b6](https://github.com/PHPCompatibility/PHPCompatibility/commit/26d0b6cf0921f75d93a4faaf09c390f386dde9ff) and [841616](https://github.com/PHPCompatibility/PHPCompatibility/commit/8416162ea81f4067226324f5948f4a50f7958a9b)
1125
 
1126
  ### Fixed
1127
+ - :bug: `ConstantArraysUsingDefine` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#199](https://github.com/PHPCompatibility/PHPCompatibility/pull/199)
1128
+ - :bug: The `DeprecatedIniDirectives` and `NewIniDirectives` sniffs could potentially trigger on the ini value instead of the ini directive name. [#170](https://github.com/PHPCompatibility/PHPCompatibility/pull/170)
1129
+ - :bug: `ForbiddenNames` sniff: Reserved keywords when used as the name of a constant declared using `define()` would always be reported independently of the `testVersion` set. [#200](https://github.com/PHPCompatibility/PHPCompatibility/pull/200)
1130
+ - :bug: `PregReplaceEModifier` sniff would not report errors when the function name used was not in lowercase. [#201](https://github.com/PHPCompatibility/PHPCompatibility/pull/201)
1131
+ - :bug: `TernaryOperators` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#188](https://github.com/PHPCompatibility/PHPCompatibility/pull/188)
1132
+ - :bug: The `getFQClassNameFromNewToken()` and `getFQClassNameFromDoubleColonToken()` utility methods would get confused when the class name was a variable instead of being hard-coded, resulting in a PHP warning being thown. [#206](https://github.com/PHPCompatibility/PHPCompatibility/pull/206). Fixes [#205](https://github.com/PHPCompatibility/PHPCompatibility/issues/205).
1133
+ - :bug: The `getFunctionCallParameters()` utility method would incorrectly identify an extra parameter if the last parameter passed to a function would have an - unnecessary - comma after it. The `getFunctionCallParameters()` utility method also did not handle parameters passed as short arrays correctly. [#213](https://github.com/PHPCompatibility/PHPCompatibility/pull/213). Fixes [#211](https://github.com/PHPCompatibility/PHPCompatibility/issues/211).
1134
+ - :umbrella: Unit tests for the `NewFunctionArrayDereferencing` sniff were not being run due to a naming error. [#208](https://github.com/PHPCompatibility/PHPCompatibility/pull/208)
1135
+ - :books: Readme: Information about setting the `testVersion` from a custom ruleset was incorrect. [#204](https://github.com/PHPCompatibility/PHPCompatibility/pull/204)
1136
+ - :wrench: Path to PHPCS in the unit tests breaking for non-Composer installs. [#198](https://github.com/PHPCompatibility/PHPCompatibility/pull/198)
1137
 
1138
  ### Credits
1139
  Thanks go out to [Juliette Reinders Folmer] and [Yoshiaki Yoshida] for their contributions to this version. :clap:
1144
  See all related issues and PRs in the [7.0.4 milestone].
1145
 
1146
  ### Added
1147
+ - :star2: New `EmptyNonVariable` sniff: detection of empty being used on non-variables for PHP < 5.5. [#187](https://github.com/PHPCompatibility/PHPCompatibility/pull/187)
1148
+ - :star2: New `NewMagicMethods` sniff: detection of declaration of magic methods before the method became "magic". Includes a check for the changed behaviour for the `__toString()` magic method in PHP 5.2. [#176](https://github.com/PHPCompatibility/PHPCompatibility/pull/176). Fixes [#64](https://github.com/PHPCompatibility/PHPCompatibility/issues/64).
1149
+ - :star2: New `RemovedAlternativePHPTags` sniff: detection of ASP and script open tags for which support was removed in PHP 7.0. [#184](https://github.com/PHPCompatibility/PHPCompatibility/pull/184), [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193). Fixes [#127](https://github.com/PHPCompatibility/PHPCompatibility/issues/127).
1150
  - :star: `NonStaticMagicMethods` sniff: detection of the `__callStatic()`, `__sleep()`, `__toString()` and `__set_state()` magic methods.
1151
+ - :green_heart: Lint all non-test case files for syntax errors during the build testing by Travis. [#192](https://github.com/PHPCompatibility/PHPCompatibility/pull/192)
1152
 
1153
  ### Changed
1154
+ - :pushpin: `NonStaticMagicMethods` sniff: will now also sniff `trait`s for magic methods. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
1155
+ - :pushpin: `NonStaticMagicMethods` sniff: will now also check for magic methods which should be declared as `static`. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
1156
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#178](https://github.com/PHPCompatibility/PHPCompatibility/pull/178), [#179](https://github.com/PHPCompatibility/PHPCompatibility/pull/179), [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174), [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171)
1157
+ - :recycle: The unit test suite now internally caches PHPCS run results in combination with a set `testVersion` to speed up the running of the unit tests. These are now ~3 x faster. [#148](https://github.com/PHPCompatibility/PHPCompatibility/pull/148)
1158
  - :books: Readme: Minor clarification of the minimum requirements.
1159
  - :books: Readme: Advise to use the latest stable version of this repository.
1160
+ - :wrench: The unit tests can now be run with PHPCS installed in an arbitrary location by passing the location through an environment option. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191).
1161
+ - :wrench: Improved coveralls configuration and compatibility. [#194](https://github.com/PHPCompatibility/PHPCompatibility/pull/194)
1162
+ - :green_heart: The sniffs are now also tested against PHP 5.2 for consistent results. Except for namespace, trait and group use related errors, most sniffs work as intended on PHP 5.2. [#196](https://github.com/PHPCompatibility/PHPCompatibility/pull/196)
1163
 
1164
  ### Fixed
1165
+ - :bug: The `ForbiddenBreakContinueVariableArguments` sniff would not report on `break`/`continue` with a closure as an argument. [#171](https://github.com/PHPCompatibility/PHPCompatibility/pull/171)
1166
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on reserved keywords which were not lowercase. [#186](https://github.com/PHPCompatibility/PHPCompatibility/pull/186)
1167
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would not report on the `goto` and `namespace` keywords when run on PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193)
1168
+ - :bug: `NewAnonymousClasses` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#195](https://github.com/PHPCompatibility/PHPCompatibility/pull/195).
1169
+ - :bug: `NewGroupUseDeclarations` sniff: the version check logic was reversed causing the error not to be reported in certain circumstances. [#190](https://github.com/PHPCompatibility/PHPCompatibility/pull/190).
1170
+ - :bug: The `NonStaticMagicMethods` sniff would not report on magic methods when the function name as declared was not in the same case as used in the PHP manual. [#174](https://github.com/PHPCompatibility/PHPCompatibility/pull/174)
1171
+ - :wrench: The unit tests would exit with `0` if PHPCS could not be found. [#191](https://github.com/PHPCompatibility/PHPCompatibility/pull/191)
1172
+ - :green_heart: The PHPCompatibility library itself was not fully compatible with PHP 5.2. [#193](https://github.com/PHPCompatibility/PHPCompatibility/pull/193)
1173
 
1174
  ### Credits
1175
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
1180
  See all related issues and PRs in the [7.0.3 milestone].
1181
 
1182
  ### Added
1183
+ - :star2: New `InternalInterfaces` sniff: detection of internal PHP interfaces being which should not be implemented by user land classes. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144)
1184
+ - :star2: New `LateStaticBinding` sniff: detection of PHP 5.3 late static binding. [#177](https://github.com/PHPCompatibility/PHPCompatibility/pull/177)
1185
+ - :star2: New `NewExecutionDirectives` sniff: verify execution directives set with `declare()`. [#169](https://github.com/PHPCompatibility/PHPCompatibility/pull/169)
1186
+ - :star2: New `NewInterfaces` sniff: detection of the use of newly introduced PHP native interfaces. This sniff will also detect unsupported methods when a class implements the `Serializable` interface. [#144](https://github.com/PHPCompatibility/PHPCompatibility/pull/144)
1187
+ - :star2: New `RequiredOptionalFunctionParameters` sniff: detection of missing function parameters which were required in earlier PHP versions only to become optional in later versions. [#165](https://github.com/PHPCompatibility/PHPCompatibility/pull/165)
1188
+ - :star2: New `ValidIntegers` sniff: detection of binary integers for PHP < 5.4, detection of hexademical numeric strings for which recognition as hex integers was removed in PHP 7.0, detection of invalid binary and octal integers. [#160](https://github.com/PHPCompatibility/PHPCompatibility/pull/160). Fixes [#55](https://github.com/PHPCompatibility/PHPCompatibility/issues/55).
1189
+ - :star: `DeprecatedExtensions` sniff: detect removal of the `ereg` extension in PHP 7. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
1190
+ - :star: `DeprecatedFunctions` sniff: detection of the PHP 5.0.5 deprecated `php_check_syntax()` and PHP 5.4 deprecated `mysqli_get_cache_stats()` functions. [#155](https://github.com/PHPCompatibility/PHPCompatibility/pull/155).
1191
+ - :star: `DeprecatedFunctions` sniff: detect deprecation of a number of the `mysqli` functions in PHP 5.3. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
1192
+ - :star: `DeprecatedFunctions` sniff: detect removal of the `call_user_method()`, `ldap_sort()`, `ereg_*()` and `mysql_*()` functions in PHP 7.0. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
1193
+ - :star: `DeprecatedIniDirectives` sniff: detection of a _lot_ more deprecated/removed ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
1194
+ - :star: `NewFunctionParameters` sniff: detection of a _lot_ more new function parameters. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164)
1195
+ - :star: `NewFunctions` sniff: detection of numerous extra new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
1196
+ - :star: `NewIniDirectives` sniff: detection of a _lot_ more new ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
1197
+ - :star: `NewLanguageConstructs` sniff: detection of the PHP 5.6 ellipsis `...` construct. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175)
1198
+ - :star: `NewScalarTypeDeclarations` sniff: detection of PHP 5.1 `array` and PHP 5.4 `callable` type hints. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
1199
+ - :star: `RemovedFunctionParameters` sniff: detection of a few extra removed function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
1200
+ - :star: Detection of functions and methods with a double underscore prefix as these are reserved by PHP for future use. The existing upstream `Generic.NamingConventions.CamelCapsFunctionName` sniff is re-used for this with some customization. [#173](https://github.com/PHPCompatibility/PHPCompatibility/pull/173)
1201
+ - :star: New `getFQClassNameFromNewToken()`, `getFQExtendedClassName()`, `getFQClassNameFromDoubleColonToken()`, `getFQName()`, `isNamespaced()`, `determineNamespace()` and `getDeclaredNamespaceName()` utility methods in the `PHPCompatibility_Sniff` base class for namespace determination. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
1202
+ - :recycle: New `inClassScope()` utility method in the `PHPCompatibility_Sniff` base class. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
1203
+ - :recycle: New `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods in the `PHPCompatibility_Sniff` base class. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153)
1204
  - :umbrella: Unit test for `__halt_compiler()` detection by the `NewKeywords` sniff.
1205
+ - :umbrella: Unit tests for the `NewFunctions` sniff. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
1206
+ - :umbrella: Unit tests for the `ParameterShadowSuperGlobals` sniff. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
1207
+ - :wrench: Minimal config for Scrutinizer CI. [#145](https://github.com/PHPCompatibility/PHPCompatibility/pull/145).
1208
 
1209
  ### Changed
1210
+ - :pushpin: The `DeprecatedIniDirectives` and the `NewIniDirectives` sniffs will now indicate an alternative ini directive in case the directive has been renamed. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
1211
+ - :pushpin: The `NewClasses` sniff will now also report on new classes being extended by child classes. [#140](https://github.com/PHPCompatibility/PHPCompatibility/pull/140).
1212
+ - :pushpin: The `NewClasses` sniff will now also report on static use of new classes. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162).
1213
+ - :pushpin: The `NewScalarTypeDeclarations` sniff will now throw an error on use of type hints pre-PHP 5.0. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
1214
+ - :pushpin: The `NewScalarTypeDeclarations` sniff will now verify type hints used against typical mistakes. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
1215
+ - :pushpin: The `ParameterShadowSuperGlobals` sniff will now do a case-insensitive variable name compare. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
1216
+ - :pushpin: The `RemovedFunctionParameters` sniff will now also report `warning`s on deprecation of function parameters. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
1217
+ - :twisted_rightwards_arrows: The check for `JsonSerializable` has been moved from the `NewClasses` sniff to the `NewInterfaces` sniff. [#162](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
1218
+ - :rewind: The `NewLanguageConstructs` sniff will now also recognize new language constructs when used in combination with PHPCS 1.5.x. [#175](https://github.com/PHPCompatibility/PHPCompatibility/pull/175)
1219
+ - :pencil2: `NewFunctionParameters` sniff: use correct name for the new parameter for the `dirname()` function. [#164](https://github.com/PHPCompatibility/PHPCompatibility/pull/164)
1220
+ - :pencil2: `NewScalarTypeDeclarations` sniff: minor change in the sniff error message text. [#168](https://github.com/PHPCompatibility/PHPCompatibility/pull/168)
1221
+ - :pencil2: `RemovedFunctionParameters` sniff: minor change in the sniff error message text. [#163](https://github.com/PHPCompatibility/PHPCompatibility/pull/163)
1222
+ - :pencil2: The `ParameterShadowSuperGlobals` sniff now extends the `PHPCompatibility_Sniff` class. [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180)
1223
+ - :recycle: Various (minor) refactoring for improved performance and sniff accuracy. [#181](https://github.com/PHPCompatibility/PHPCompatibility/pull/181), [#182](https://github.com/PHPCompatibility/PHPCompatibility/pull/182), [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166), [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167), [#172](https://github.com/PHPCompatibility/PHPCompatibility/pull/172), [#180](https://github.com/PHPCompatibility/PHPCompatibility/pull/180), [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146), [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138)
1224
+ - :recycle: Various refactoring to remove code duplication in the unit tests and add proper test skip notifications where relevant. [#139](https://github.com/PHPCompatibility/PHPCompatibility/pull/139), [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
1225
 
1226
  ### Fixed
1227
+ - :bug: The `DeprecatedFunctions` sniff was reporting an incorrect deprecation/removal version number for a few functions. [#149](https://github.com/PHPCompatibility/PHPCompatibility/pull/149)
1228
+ - :bug: The `DeprecatedIniDirectives` sniff was in select cases reporting deprecation of an ini directive prior to removal, while the ini directive was never deprecated prior to its removal. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
1229
+ - :bug: The `DeprecatedPHP4StyleConstructors` sniff would cause false positives for methods with the same name as the class in namespaced classes. [#167](https://github.com/PHPCompatibility/PHPCompatibility/pull/167)
1230
+ - :bug: The `ForbiddenEmptyListAssignment` sniff did not report errors when there were only comments or parentheses between the list parentheses. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166)
1231
+ - :bug: The `ForbiddenEmptyListAssignment` sniff will no longer cause false positives during live coding. [#166](https://github.com/PHPCompatibility/PHPCompatibility/pull/166)
1232
+ - :bug: The `NewClasses` sniff would potentially misidentify namespaced classes as PHP native classes. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/162)
1233
+ - :bug: The `NewFunctions` sniff would fail to identify called functions when the function call was not lowercase. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
1234
+ - :bug: The `NewFunctions` sniff would potentially misidentify namespaced userland functions as new functions. [#161](https://github.com/PHPCompatibility/PHPCompatibility/pull/161)
1235
+ - :bug: The `NewIniDirectives` sniff was reporting an incorrect introduction version number for a few ini directives. [#146](https://github.com/PHPCompatibility/PHPCompatibility/pull/146)
1236
+ - :bug: `NewKeywords` sniff: the use of the `const` keyword should only be reported when used outside of a class for PHP < 5.3. [#147](https://github.com/PHPCompatibility/PHPCompatibility/pull/147). Fixes [#129](https://github.com/PHPCompatibility/PHPCompatibility/issues/129).
1237
+ - :bug: The `RemovedExtensions` sniff was incorrectly reporting a number of extensions as being removed in PHP 5.3 while they were actually removed in PHP 5.1. [#156](https://github.com/PHPCompatibility/PHPCompatibility/pull/156)
1238
+ - :bug: :recycle: The `NewFunctionParameters` and `RemovedFunctionParameters` now use the new `doesFunctionCallHaveParameters()` and `getFunctionCallParameterCount()` utility methods for improved accuracy in identifying function parameters. This fixes several false positives. [#153](https://github.com/PHPCompatibility/PHPCompatibility/pull/153) Fixes [#120](https://github.com/PHPCompatibility/PHPCompatibility/issues/120), [#151](https://github.com/PHPCompatibility/PHPCompatibility/issues/151), [#152](https://github.com/PHPCompatibility/PHPCompatibility/issues/152).
1239
+ - :bug: A number of sniffs would return `false` if the examined construct was not found. This could potentially cause race conditions/infinite sniff loops. [#138](https://github.com/PHPCompatibility/PHPCompatibility/pull/138)
1240
+ - :wrench: The unit tests would fail to run when used in combination with a PEAR install of PHPCS. [#157](https://github.com/PHPCompatibility/PHPCompatibility/pull/157).
1241
+ - :green_heart: Unit tests failing against PHPCS 2.6.1. [#158](https://github.com/PHPCompatibility/PHPCompatibility/pull/158)
1242
  The unit tests *will* still fail against PHPCS 2.6.2 due to a bug in PHPCS itself. This bug does not affect the running of the sniffs outside of a unit test context.
1243
 
1244
  ### Credits
1250
  See all related issues and PRs in the [7.0.2 milestone].
1251
 
1252
  ### Added
1253
+ - :star: `RemovedExtensions` sniff: ability to whitelist userland functions for which the function prefix overlaps with a prefix of a deprecated/removed extension. [#130](https://github.com/PHPCompatibility/PHPCompatibility/pull/130). Fixes [#123](https://github.com/PHPCompatibility/PHPCompatibility/issues/123).
1254
+ To use this feature, add the `functionWhitelist` property in your custom ruleset. For more information, see the [README](https://github.com/PHPCompatibility/PHPCompatibility#phpcompatibility-specific-options).
1255
 
1256
  ### Changed
1257
+ - :pencil2: A number of sniffs contained `public` class properties. Within PHPCS, `public` properties can be overruled via a custom ruleset. This was not the intention, so the visibility of these properties has been changed to `protected`. [#135](https://github.com/PHPCompatibility/PHPCompatibility/pull/135)
1258
  - :wrench: Composer config: Stable packages are preferred over unstable/dev.
1259
+ - :pencil2: Ruleset name. [#134](https://github.com/PHPCompatibility/PHPCompatibility/pull/134)
1260
 
1261
  ### Credits
1262
  Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
1267
  See all related issues and PRs in the [7.0.1 milestone].
1268
 
1269
  ### Changed
1270
+ - :pushpin: The `DeprecatedIniDirectives` sniff used to throw an `error` when a deprecated ini directive was used in combination with `ini_get()`. It will now throw a `warning` instead. [#122](https://github.com/PHPCompatibility/PHPCompatibility/pull/122) Fixes [#119](https://github.com/PHPCompatibility/PHPCompatibility/issues/119).
1271
  Usage of deprecated ini directives in combination with `ini_set()` will still throw an `error`.
1272
+ - :pushpin: The `PregReplaceEModifier` sniff now also detects the `e` modifier when used with the `preg_filter()` function. While this is undocumented, the `e` modifier was supported by the `preg_filter()` function as well. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128)
1273
+ - :pencil2: The `RemovedExtensions` sniff contained superfluous deprecation information in the error message. [#131](https://github.com/PHPCompatibility/PHPCompatibility/pull/131)
1274
 
1275
  ### Removed
1276
+ - :wrench: Duplicate builds from the Travis CI build matrix. [#132](https://github.com/PHPCompatibility/PHPCompatibility/pull/132)
1277
 
1278
  ### Fixed
1279
+ - :bug: The `ForbiddenNames` sniff did not allow for the PHP 5.6 `use function ...` and `use const ...` syntax. [#126](https://github.com/PHPCompatibility/PHPCompatibility/pull/126) Fixes [#124](https://github.com/PHPCompatibility/PHPCompatibility/issues/124).
1280
+ - :bug: The `NewClasses` sniff failed to detect new classes when the class was instantiated without parenthesis, i.e. `new NewClass;`. [#121](https://github.com/PHPCompatibility/PHPCompatibility/pull/121)
1281
+ - :bug: The `PregReplaceEModifier` sniff failed to detect the `e` modifier when using bracket delimiters for the regex other than the `{}` brackets. [#128](https://github.com/PHPCompatibility/PHPCompatibility/pull/128)
1282
  - :green_heart: Unit tests failing against PHPCS 2.6.1.
1283
 
1284
  ### Credits
1290
  See all related issues and PRs in the [7.0 milestone].
1291
 
1292
  ### Added
1293
+ - :zap: Ability to specify a range of PHP versions against which to test your code base for compatibility, i.e. `--runtime-set testVersion 5.0-5.4` will now test your code for compatibility with PHP 5.0 up to PHP 5.4. [#99](https://github.com/PHPCompatibility/PHPCompatibility/pull/99)
1294
+ - :star2: New `NewFunctionArrayDereferencing` sniff to detect function array dereferencing as introduced in PHP 5.4. Fixes [#52](https://github.com/PHPCompatibility/PHPCompatibility/issues/52).
1295
+ - :star2: New `ShortArray` sniff to detect short array syntax as introduced in PHP 5.4. [#97](https://github.com/PHPCompatibility/PHPCompatibility/pull/97). Fixes [#47](https://github.com/PHPCompatibility/PHPCompatibility/issues/47).
1296
+ - :star2: New `TernaryOperators` sniff to detect ternaries without the middle part (`elvis` operator) as introduced in PHP 5.3. [#101](https://github.com/PHPCompatibility/PHPCompatibility/pull/101), [#103](https://github.com/PHPCompatibility/PHPCompatibility/pull/103). Fixes [#49](https://github.com/PHPCompatibility/PHPCompatibility/issues/49).
1297
+ - :star2: New `ConstantArraysUsingDefine` sniff to detect constants declared using `define()` being assigned an `array` value which was not allowed prior to PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1298
+ - :star2: New `DeprecatedPHP4StyleConstructors` sniff to detect PHP 4 style class constructor methods which are deprecated as of PHP 7. [#109](https://github.com/PHPCompatibility/PHPCompatibility/pull/109).
1299
+ - :star2: New `ForbiddenEmptyListAssignment` sniff to detect empty list() assignments which have been removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1300
+ - :star2: New `ForbiddenFunctionParametersWithSameName` sniff to detect functions declared with multiple same-named parameters which is no longer accepted since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1301
+ - :star2: New `ForbiddenGlobalVariableVariable` sniff to detect variable variables being made `global` which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1302
+ - :star2: New `ForbiddenNegativeBitshift` sniff to detect bitwise shifts by negative number which will throw an ArithmeticError in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1303
+ - :star2: New `ForbiddenSwitchWithMultipleDefaultBlocks` sniff to detect switch statements with multiple default blocks which is not allowed since PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1304
+ - :star2: New `NewAnonymousClasses` sniff to detect anonymous classes as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1305
+ - :star2: New `NewClosure` sniff to detect anonymous functions as introduced in PHP 5.3. Fixes [#35](https://github.com/PHPCompatibility/PHPCompatibility/issues/35)
1306
+ - :star2: New `NewFunctionParameters` sniff to detect use of new parameters in build-in PHP functions. Initially only sniffing for the new PHP 7.0 function parameters and the new PHP 5.3+ `before_needle` parameter for the `strstr()` function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110), [#112](https://github.com/PHPCompatibility/PHPCompatibility/pull/112). Fixes [#27](https://github.com/PHPCompatibility/PHPCompatibility/issues/27).
1307
+ - :star2: New `NewGroupUseDeclarations` sniff to detect group use declarations as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1308
+ - :star2: New `NewScalarReturnTypeDeclarations` sniff to detect scalar return type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1309
+ - :star2: New `NewScalarTypeDeclarations` sniff to detect scalar function parameter type hints as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1310
+ - :star2: New `RemovedFunctionParameters` sniff to detect use of removed parameters in build-in PHP functions. Initially only sniffing for the function parameters removed in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1311
+ - :star2: New `RemovedGlobalVariables` sniff to detect the PHP 7.0 removed `$HTTP_RAW_POST_DATA` superglobal. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1312
+ - :star: `DeprecatedFunctions` sniff: detection of the PHP 5.4 deprecated OCI8 functions. [#93](https://github.com/PHPCompatibility/PHPCompatibility/pull/93)
1313
+ - :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize PHP 5.5 `finally` as a reserved keywords when invoked as a function. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1314
+ - :star: `NewKeywords` sniff: detection of the use of the PHP 5.1+ `__halt_compiler` keyword. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50).
1315
+ - :star: `NewKeywords` sniff: detection of the PHP 5.3+ `nowdoc` syntax. Fixes [#48](https://github.com/PHPCompatibility/PHPCompatibility/issues/48).
1316
+ - :star: `NewKeywords` sniff: detection of the use of the `const` keyword outside of a class for PHP < 5.3. Fixes [#50](https://github.com/PHPCompatibility/PHPCompatibility/issues/50).
1317
+ - :star: `DeprecatedFunctions` sniff: recognize PHP 7.0 deprecated and removed functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1318
+ - :star: `DeprecatedIniDirectives` sniff: recognize PHP 7.0 removed ini directives. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1319
+ - :star: `ForbiddenNamesAsInvokedFunctions` sniff: recognize new PHP 7.0 reserved keywords when invoked as functions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1320
+ - :star: `ForbiddenNames` sniff: recognize new PHP 7.0 reserved keywords. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1321
+ - :star: `NewFunctions` sniff: recognize new functions as introduced in PHP 7.0. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1322
+ - :star: `NewLanguageConstructs` sniff: recognize new PHP 7.0 `<=>` "spaceship" and `??` null coalescing operators. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1323
+ - :star: `RemovedExtensions` sniff: recognize PHP 7.0 removed `ereg`, `mssql`, `mysql` and `sybase_ct` extensions. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1324
+ - :umbrella: Additional unit tests for the `NewLanguageConstructs` sniff. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1325
  - :books: Readme: New section containing information about the use of the `testVersion` config variable.
1326
  - :books: Readme: Sponsor credits.
1327
 
1328
  ### Changed
1329
+ - :pushpin: The `DeprecatedIniDirectives` sniff used to always throw an `warning`. Now it will throw an `error` when a removed ini directive is used. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110).
1330
+ - :pushpin: The `DeprecatedNewReference` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1331
+ - :pushpin: The `ForbiddenNames` sniff now supports detection of reserved keywords when used in combination with PHP 7 anonymous classes. [#108](https://github.com/PHPCompatibility/PHPCompatibility/pull/108), [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110).
1332
+ - :pushpin: The `PregReplaceEModifier` sniff will now throw an error when the `testVersion` includes PHP 7.0 or higher. [#110](https://github.com/PHPCompatibility/PHPCompatibility/pull/110)
1333
+ - :pencil2: `NewKeywords` sniff: clarified the error message text for the `use` keyword. Fixes [#46](https://github.com/PHPCompatibility/PHPCompatibility/issues/46).
1334
+ - :recycle: Minor refactor of the `testVersion` related utility functions. [#98](https://github.com/PHPCompatibility/PHPCompatibility/pull/98)
1335
+ - :wrench: Add autoload to the `composer.json` file. [#96](https://github.com/PHPCompatibility/PHPCompatibility/pull/96) Fixes [#67](https://github.com/PHPCompatibility/PHPCompatibility/issues/67).
1336
+ - :wrench: Minor other updates to the `composer.json` file. [#75](https://github.com/PHPCompatibility/PHPCompatibility/pull/75)
1337
  - :wrench: Improved creation of the code coverage reports needed by coveralls via Travis.
1338
  - :green_heart: The sniffs are now also tested against PHP 7.0 for consistent results.
1339
 
1340
  ### Fixed
1341
+ - :bug: The `ForbiddenCallTimePassByReference` sniff was throwing `Undefined index` notices when used in combination with PHPCS 2.2.0. [#100](https://github.com/PHPCompatibility/PHPCompatibility/pull/100). Fixes [#42](https://github.com/PHPCompatibility/PHPCompatibility/issues/42).
1342
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff would incorrectly throw an error if the `throw` keyword was used with parenthesis. Fixes [#118](https://github.com/PHPCompatibility/PHPCompatibility/issues/118).
1343
+ - :bug: The `PregReplaceEModifier` sniff incorrectly identified `e`'s in the pattern as the `e` modifier when using `{}` bracket delimiters for the regex. [#94](https://github.com/PHPCompatibility/PHPCompatibility/pull/94)
1344
+ - :bug: The `RemovedExtensions` sniff was throwing an `error` instead of a `warning` for deprecated, but not (yet) removed extensions. Fixes [#62](https://github.com/PHPCompatibility/PHPCompatibility/issues/62).
1345
 
1346
  ### Credits
1347
  Thanks go out to AlexMiroshnikov, [Chris Abernethy], [dgudgeon], [djaenecke], [Eugene Maslovich], [Ken Guest], Koen Eelen, [Komarov Alexey], [Mark Clements] and [Remko van Bezooijen] for their contributions to this version. :clap:
1352
  See all related issues and PRs in the [5.6 milestone].
1353
 
1354
  ### Added
1355
+ - :star2: New: `NewLanguageConstructs` sniff. The initial version of this sniff checks for the PHP 5.6 `**` power operator and the `**=` power assignment operator. [#87](https://github.com/PHPCompatibility/PHPCompatibility/pull/87). Fixes [#60](https://github.com/PHPCompatibility/PHPCompatibility/issues/60).
1356
+ - :star2: New: `ParameterShadowSuperGlobals` sniff which covers the PHP 5.4 change _Parameter names that shadow super globals now cause a fatal error.`_. [#74](https://github.com/PHPCompatibility/PHPCompatibility/pull/74)
1357
+ - :star2: New: `PregReplaceEModifier` sniff which detects usage of the `e` modifier in literal regular expressions used with `preg_replace()`. The `e` modifier will not (yet) be detected when the regex passed is a variable or constant. [#81](https://github.com/PHPCompatibility/PHPCompatibility/pull/81), [#84](https://github.com/PHPCompatibility/PHPCompatibility/pull/84). Fixes [#71](https://github.com/PHPCompatibility/PHPCompatibility/issues/71), [#83](https://github.com/PHPCompatibility/PHPCompatibility/issues/83).
1358
  - :star: `DeprecatedIniDirectives` sniff: PHP 5.6 deprecated ini directives.
1359
+ - :star: `NewKeywords` sniff: detection of the `goto` keyword introduced in PHP 5.3 and the `callable` keyword introduced in PHP 5.4. [#57](https://github.com/PHPCompatibility/PHPCompatibility/pull/57)
1360
+ - :recycle: `PHPCompatibility_Sniff` base class initially containing the `supportsAbove()` and `supportsBelow()` utility methods. (Nearly) All sniffs now extend this base class and use these methods to determine whether or not violations should be reported for a set `testVersion`. [#77](https://github.com/PHPCompatibility/PHPCompatibility/pull/77)
1361
+ - :books: Readme: Composer installation instructions. [#32](https://github.com/PHPCompatibility/PHPCompatibility/pull/32), [#61](https://github.com/PHPCompatibility/PHPCompatibility/pull/61)
1362
+ - :wrench: `.gitignore` to ignore vendor and IDE related directories. [#78](https://github.com/PHPCompatibility/PHPCompatibility/pull/78)
1363
  - :green_heart: Code coverage checking via coveralls.
1364
 
1365
  ### Changed
1366
+ - :twisted_rightwards_arrows: The check for the `\` namespace separator has been moved from the `NewKeywords` sniff to the `NewLanguageConstructs` sniff. [#88](https://github.com/PHPCompatibility/PHPCompatibility/pull/88)
1367
  - :pencil2: `DeprecatedIniDirectives` sniff: minor change in the sniff error message text.
1368
  - :pencil2: `DeprecatedFunctions` sniff: minor change in the sniff error message text.
1369
+ - :wrench: Minor updates to the `composer.json` file. [#31](https://github.com/PHPCompatibility/PHPCompatibility/pull/31), [34](https://github.com/PHPCompatibility/PHPCompatibility/pull/34), [#70](https://github.com/PHPCompatibility/PHPCompatibility/pull/70)
1370
  - :wrench: Tests: The unit tests can now be run without configuration.
1371
+ - :wrench: Tests: Skipped unit tests will now be annotated as such. [#85](https://github.com/PHPCompatibility/PHPCompatibility/pull/85)
1372
  - :green_heart: The sniffs are now also tested against PHP 5.6 for consistent results.
1373
  - :green_heart: The sniffs are now also tested against PHPCS 2.0+.
1374
+ - :green_heart: The sniffs are now tested using the new container-based infrastructure in Travis CI. [#37](https://github.com/PHPCompatibility/PHPCompatibility/pull/37)
1375
 
1376
  ### Fixed
1377
+ - :bug: The `ForbiddenCallTimePassByReference` sniff was throwing false positives when a bitwise and `&` was used in combination with class constants and class properties within function calls. [#44](https://github.com/PHPCompatibility/PHPCompatibility/pull/44). Fixes [#39](https://github.com/PHPCompatibility/PHPCompatibility/issues/39).
1378
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was throwing false positives in certain cases when a comment separated a `try` from the `catch` block. [#29](https://github.com/PHPCompatibility/PHPCompatibility/pull/29)
1379
+ - :bug: The `ForbiddenNamesAsInvokedFunctions` sniff was incorrectly reporting `instanceof` as being introduced in PHP 5.4 while it has been around since PHP 5.0. [#80](https://github.com/PHPCompatibility/PHPCompatibility/pull/80)
1380
+ - :white_check_mark: Compatibility with PHPCS 2.0 - 2.3. [#63](https://github.com/PHPCompatibility/PHPCompatibility/pull/63), [#65](https://github.com/PHPCompatibility/PHPCompatibility/pull/65)
1381
 
1382
  ### Credits
1383
  Thanks go out to Daniel Jänecke, [Declan Kelly], [Dominic], [Jaap van Otterdijk], [Marin Crnkovic], [Mark Clements], [Nick Pack], [Oliver Klee], [Rowan Collins] and [Sam Van der Borght] for their contributions to this version. :clap:
1391
 
1392
 
1393
 
1394
+ [Unreleased]: https://github.com/PHPCompatibility/PHPCompatibility/compare/master...HEAD
1395
+ [9.3.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.4...9.3.5
1396
+ [9.3.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.3...9.3.4
1397
+ [9.3.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.2...9.3.3
1398
+ [9.3.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.1...9.3.2
1399
+ [9.3.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.0...9.3.1
1400
+ [9.3.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.2.0...9.3.0
1401
+ [9.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.1...9.2.0
1402
+ [9.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.1.0...9.1.1
1403
+ [9.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.0.0...9.1.0
1404
+ [9.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.2.0...9.0.0
1405
+ [8.2.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.1.0...8.2.0
1406
+ [8.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.1...8.1.0
1407
+ [8.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/8.0.0...8.0.1
1408
+ [8.0.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.5...8.0.0
1409
+ [7.1.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.4...7.1.5
1410
+ [7.1.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.3...7.1.4
1411
+ [7.1.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.2...7.1.3
1412
+ [7.1.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.1...7.1.2
1413
+ [7.1.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.1.0...7.1.1
1414
+ [7.1.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.8...7.1.0
1415
+ [7.0.8]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.7...7.0.8
1416
+ [7.0.7]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.6...7.0.7
1417
+ [7.0.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.5...7.0.6
1418
+ [7.0.5]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.4...7.0.5
1419
+ [7.0.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.3...7.0.4
1420
+ [7.0.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.2...7.0.3
1421
+ [7.0.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0.1...7.0.2
1422
+ [7.0.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/7.0...7.0.1
1423
+ [7.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.6...7.0
1424
+ [5.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.5...5.6
1425
+
1426
+ [9.3.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/34
1427
+ [9.3.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/33
1428
+ [9.3.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/32
1429
+ [9.3.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/31
1430
+ [9.3.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/30
1431
+ [9.3.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/29
1432
+ [9.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/28
1433
+ [9.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/27
1434
+ [9.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/25
1435
+ [9.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/24
1436
+ [8.2.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/22
1437
+ [8.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/21
1438
+ [8.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/20
1439
+ [8.0.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/19
1440
+ [7.1.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/17
1441
+ [7.1.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/15
1442
+ [7.1.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/14
1443
+ [7.1.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/13
1444
+ [7.1.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/12
1445
+ [7.1.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/11
1446
+ [7.0.8 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/10
1447
+ [7.0.7 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/9
1448
+ [7.0.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/8
1449
+ [7.0.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/7
1450
+ [7.0.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/6
1451
+ [7.0.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/5
1452
+ [7.0.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/4
1453
+ [7.0.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/3
1454
+ [7.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/2
1455
+ [5.6 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/1
1456
+ [5.5 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/16
1457
 
1458
  [Arthur Edamov]: https://github.com/edamov
1459
  [Chris Abernethy]: https://github.com/cabernet-zerve
1465
  [Gary Jones]: https://github.com/GaryJones
1466
  [Jaap van Otterdijk]: https://github.com/jaapio
1467
  [Jason Stallings]: https://github.com/octalmage
1468
+ [Jonathan Champ]: https://github.com/jrchamp
1469
  [Jonathan Van Belle]: https://github.com/Grummfy
1470
  [Juliette Reinders Folmer]: https://github.com/jrfnl
1471
  [Ken Guest]: https://github.com/kenguest
1474
  [Mark Clements]: https://github.com/MarkMaldaba
1475
  [Michael Babker]: https://github.com/mbabker
1476
  [Nick Pack]: https://github.com/nickpack
1477
+ [Nikhil]: https://github.com/Nikschavan
1478
  [Oliver Klee]: https://github.com/oliverklee
1479
  [Remko van Bezooijen]: https://github.com/emkookmer
1480
  [Rowan Collins]: https://github.com/IMSoP
1481
  [Ryan Neufeld]: https://github.com/ryanneufeld
1482
  [Sam Van der Borght]: https://github.com/samvdb
1483
+ [Sergii Bondarenko]: https://github.com/BR0kEN-
1484
  [Tadas Juozapaitis]: https://github.com/kasp3r
1485
+ [Tim Millwood]: https://github.com/timmillwood
1486
+ [William Entriken]: https://github.com/fulldecent
1487
+ [Yılmaz]: https://github.com/edigu
1488
  [Yoshiaki Yoshida]: https://github.com/kakakakakku
 
vendor/phpcompatibility/php-compatibility/PHPCSAliases.php CHANGED
@@ -1,13 +1,17 @@
1
  <?php
2
  /**
 
 
3
  * PHPCS cross-version compatibility helper.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
8
  */
9
 
10
-
11
  /*
12
  * Alias a number of PHPCS 3.x classes to their PHPCS 2.x equivalents.
13
  *
@@ -17,11 +21,11 @@
17
  * {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
18
  * a few "old" classes have been split and spread out over several "new"
19
  * classes. In other words, this will only work for a limited number
20
- * of classes.}}
21
  *
22
  * {@internal The `class_exists` wrappers are needed to play nice with other
23
  * external PHPCS standards creating cross-version compatibility in the same
24
- * manner.}}
25
  */
26
  if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
27
  if (interface_exists('\PHP_CodeSniffer_Sniff') === false) {
@@ -48,15 +52,11 @@ if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
48
  /*
49
  * Register an autoloader.
50
  *
51
- * {@internal This autoloader is not needed for running the sniffs, however, it *is*
52
- * needed for running the unit tests as the PHPCS native autoloader runs into trouble there.
53
- * This issue will be fixed in PHPCS 3.1, so the below code can be removed once the
54
- * minimum PHPCS 3.x requirement for PHPCompatibility has gone up to 3.1.
55
- * Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1564} }}
56
  *
57
- * {@internal Update: when `installed_paths` is set via the ruleset, this autoloader
58
- * **is** needed to run the sniffs.
59
- * Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }}
60
  */
61
  spl_autoload_register(function ($class) {
62
  // Only try & load our own classes.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
  * PHPCS cross-version compatibility helper.
6
  *
7
+ * @package PHPCompatibility
8
+ * @copyright 2012-2019 PHPCompatibility Contributors
9
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
10
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
11
+ *
12
+ * @since 8.0.0
13
  */
14
 
 
15
  /*
16
  * Alias a number of PHPCS 3.x classes to their PHPCS 2.x equivalents.
17
  *
21
  * {@internal The PHPCS file have been reorganized in PHPCS 3.x, quite
22
  * a few "old" classes have been split and spread out over several "new"
23
  * classes. In other words, this will only work for a limited number
24
+ * of classes.}
25
  *
26
  * {@internal The `class_exists` wrappers are needed to play nice with other
27
  * external PHPCS standards creating cross-version compatibility in the same
28
+ * manner.}
29
  */
30
  if (defined('PHPCOMPATIBILITY_PHPCS_ALIASES_SET') === false) {
31
  if (interface_exists('\PHP_CodeSniffer_Sniff') === false) {
52
  /*
53
  * Register an autoloader.
54
  *
55
+ * {@internal When `installed_paths` is set via the ruleset, this autoloader
56
+ * is needed to run the sniffs.
57
+ * Upstream issue: {@link https://github.com/squizlabs/PHP_CodeSniffer/issues/1591} }
 
 
58
  *
59
+ * @since 8.0.0
 
 
60
  */
61
  spl_autoload_register(function ($class) {
62
  // Only try & load our own classes.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php CHANGED
@@ -1,20 +1,21 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\AbstractComplexVersionSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
 
 
12
  /**
13
- * \PHPCompatibility\AbstractComplexVersionSniff.
14
  *
15
- * @category PHP
16
- * @package PHPCompatibility
17
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
18
  */
19
  abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface
20
  {
@@ -24,6 +25,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
24
  * Handle the retrieval of relevant information and - if necessary - throwing of an
25
  * error/warning for an item.
26
  *
 
 
27
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
28
  * @param int $stackPtr The position of the relevant token in
29
  * the stack.
@@ -31,7 +34,7 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
31
  *
32
  * @return void
33
  */
34
- public function handleFeature(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo)
35
  {
36
  $itemArray = $this->getItemArray($itemInfo);
37
  $errorInfo = $this->getErrorInfo($itemArray, $itemInfo);
@@ -45,6 +48,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
45
  /**
46
  * Determine whether an error/warning should be thrown for an item based on collected information.
47
  *
 
 
48
  * @param array $errorInfo Detail information about an item.
49
  *
50
  * @return bool
@@ -55,6 +60,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
55
  /**
56
  * Get an array of the non-PHP-version array keys used in a sub-array.
57
  *
 
 
58
  * @return array
59
  */
60
  protected function getNonVersionArrayKeys()
@@ -67,6 +74,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
67
  * Retrieve a subset of an item array containing only the array keys which
68
  * contain PHP version information.
69
  *
 
 
70
  * @param array $itemArray Version and other information about an item.
71
  *
72
  * @return array Array with only the version information.
@@ -80,6 +89,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
80
  /**
81
  * Get the item name to be used for the creation of the error code and in the error message.
82
  *
 
 
83
  * @param array $itemInfo Base information about the item.
84
  * @param array $errorInfo Detail information about an item.
85
  *
@@ -94,6 +105,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
94
  /**
95
  * Get the error message template for a specific sniff.
96
  *
 
 
97
  * @return string
98
  */
99
  abstract protected function getErrorMsgTemplate();
@@ -102,6 +115,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
102
  /**
103
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
104
  *
 
 
105
  * @param string $error The error message which was created.
106
  * @param array $itemInfo Base information about the item this error message applies to.
107
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -117,6 +132,8 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
117
  /**
118
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
119
  *
 
 
120
  * @param array $data The error data array which was created.
121
  * @param array $itemInfo Base information about the item this error message applies to.
122
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -127,6 +144,4 @@ abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersi
127
  {
128
  return $data;
129
  }
130
-
131
-
132
- }//end class
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
+ use PHP_CodeSniffer_File as File;
14
+
15
  /**
16
+ * Abstract base class for sniffs based on complex arrays with PHP version information.
17
  *
18
+ * @since 7.1.0
 
 
19
  */
20
  abstract class AbstractComplexVersionSniff extends Sniff implements ComplexVersionInterface
21
  {
25
  * Handle the retrieval of relevant information and - if necessary - throwing of an
26
  * error/warning for an item.
27
  *
28
+ * @since 7.1.0
29
+ *
30
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
31
  * @param int $stackPtr The position of the relevant token in
32
  * the stack.
34
  *
35
  * @return void
36
  */
37
+ public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo)
38
  {
39
  $itemArray = $this->getItemArray($itemInfo);
40
  $errorInfo = $this->getErrorInfo($itemArray, $itemInfo);
48
  /**
49
  * Determine whether an error/warning should be thrown for an item based on collected information.
50
  *
51
+ * @since 7.1.0
52
+ *
53
  * @param array $errorInfo Detail information about an item.
54
  *
55
  * @return bool
60
  /**
61
  * Get an array of the non-PHP-version array keys used in a sub-array.
62
  *
63
+ * @since 7.1.0
64
+ *
65
  * @return array
66
  */
67
  protected function getNonVersionArrayKeys()
74
  * Retrieve a subset of an item array containing only the array keys which
75
  * contain PHP version information.
76
  *
77
+ * @since 7.1.0
78
+ *
79
  * @param array $itemArray Version and other information about an item.
80
  *
81
  * @return array Array with only the version information.
89
  /**
90
  * Get the item name to be used for the creation of the error code and in the error message.
91
  *
92
+ * @since 7.1.0
93
+ *
94
  * @param array $itemInfo Base information about the item.
95
  * @param array $errorInfo Detail information about an item.
96
  *
105
  /**
106
  * Get the error message template for a specific sniff.
107
  *
108
+ * @since 7.1.0
109
+ *
110
  * @return string
111
  */
112
  abstract protected function getErrorMsgTemplate();
115
  /**
116
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
117
  *
118
+ * @since 7.1.0
119
+ *
120
  * @param string $error The error message which was created.
121
  * @param array $itemInfo Base information about the item this error message applies to.
122
  * @param array $errorInfo Detail information about an item this error message applies to.
132
  /**
133
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
134
  *
135
+ * @since 7.1.0
136
+ *
137
  * @param array $data The error data array which was created.
138
  * @param array $itemInfo Base information about the item this error message applies to.
139
  * @param array $errorInfo Detail information about an item this error message applies to.
144
  {
145
  return $data;
146
  }
147
+ }
 
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php CHANGED
@@ -1,24 +1,23 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\AbstractFunctionCallParameterSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
12
  use PHPCompatibility\Sniff;
 
 
13
 
14
  /**
15
- * \PHPCompatibility\AbstractFunctionCallParameterSniff.
16
- *
17
  * Abstract class to use as a base for examining the parameter values passed to function calls.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
22
  */
23
  abstract class AbstractFunctionCallParameterSniff extends Sniff
24
  {
@@ -29,6 +28,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
29
  * the method called is of the right class/object.
30
  * Checking that is outside of the scope of this abstract sniff.
31
  *
 
 
32
  * @var bool False (default) if the sniff is looking for function calls.
33
  * True if the sniff is looking for method calls.
34
  */
@@ -37,6 +38,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
37
  /**
38
  * Functions the sniff is looking for. Should be defined in the child class.
39
  *
 
 
40
  * @var array The only requirement for this array is that the top level
41
  * array keys are the names of the functions you're looking for.
42
  * Other than that, the array can have arbitrary content
@@ -48,21 +51,25 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
48
  * List of tokens which when they preceed the $stackPtr indicate that this
49
  * is not a function call.
50
  *
 
 
51
  * @var array
52
  */
53
  private $ignoreTokens = array(
54
- T_DOUBLE_COLON => true,
55
- T_OBJECT_OPERATOR => true,
56
- T_FUNCTION => true,
57
- T_NEW => true,
58
- T_CONST => true,
59
- T_USE => true,
60
  );
61
 
62
 
63
  /**
64
  * Returns an array of tokens this test wants to listen for.
65
  *
 
 
66
  * @return array
67
  */
68
  public function register()
@@ -70,20 +77,23 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
70
  // Handle case-insensitivity of function names.
71
  $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
72
 
73
- return array(T_STRING);
74
  }
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
82
  * the stack passed in $tokens.
83
  *
84
- * @return void
 
85
  */
86
- public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
87
  {
88
  if ($this->bowOutEarly() === true) {
89
  return;
@@ -97,11 +107,11 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
97
  return;
98
  }
99
 
100
- $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
101
 
102
  if ($this->isMethod === true) {
103
- if ($tokens[$prevNonEmpty]['code'] !== T_DOUBLE_COLON
104
- && $tokens[$prevNonEmpty]['code'] !== T_OBJECT_OPERATOR
105
  ) {
106
  // Not a call to a PHP method.
107
  return;
@@ -112,8 +122,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
112
  return;
113
  }
114
 
115
- if ($tokens[$prevNonEmpty]['code'] === T_NS_SEPARATOR
116
- && $tokens[$prevNonEmpty - 1]['code'] === T_STRING
117
  ) {
118
  // Namespaced function.
119
  return;
@@ -133,6 +143,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
133
  /**
134
  * Do a version check to determine if this sniff needs to run at all.
135
  *
 
 
136
  * If the check done in a child class is not specific to one PHP version,
137
  * this function should return `false`.
138
  *
@@ -146,6 +158,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
146
  *
147
  * This method has to be made concrete in child classes.
148
  *
 
 
149
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
150
  * @param int $stackPtr The position of the current token in the stack.
151
  * @param string $functionName The token content (function name) which was matched.
@@ -154,7 +168,7 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
154
  * @return int|void Integer stack pointer to skip forward or void to continue
155
  * normal file processing.
156
  */
157
- abstract public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $parameters);
158
 
159
 
160
  /**
@@ -163,6 +177,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
163
  * Defaults to doing nothing. Can be overloaded in child classes to handle functions
164
  * were parameters are expected, but none found.
165
  *
 
 
166
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
167
  * @param int $stackPtr The position of the current token in the stack.
168
  * @param string $functionName The token content (function name) which was matched.
@@ -170,8 +186,8 @@ abstract class AbstractFunctionCallParameterSniff extends Sniff
170
  * @return int|void Integer stack pointer to skip forward or void to continue
171
  * normal file processing.
172
  */
173
- public function processNoParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName)
174
  {
175
  return;
176
  }
177
- }//end class
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
  use PHPCompatibility\Sniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
 
 
18
  * Abstract class to use as a base for examining the parameter values passed to function calls.
19
  *
20
+ * @since 8.2.0
 
 
21
  */
22
  abstract class AbstractFunctionCallParameterSniff extends Sniff
23
  {
28
  * the method called is of the right class/object.
29
  * Checking that is outside of the scope of this abstract sniff.
30
  *
31
+ * @since 8.2.0
32
+ *
33
  * @var bool False (default) if the sniff is looking for function calls.
34
  * True if the sniff is looking for method calls.
35
  */
38
  /**
39
  * Functions the sniff is looking for. Should be defined in the child class.
40
  *
41
+ * @since 8.2.0
42
+ *
43
  * @var array The only requirement for this array is that the top level
44
  * array keys are the names of the functions you're looking for.
45
  * Other than that, the array can have arbitrary content
51
  * List of tokens which when they preceed the $stackPtr indicate that this
52
  * is not a function call.
53
  *
54
+ * @since 8.2.0
55
+ *
56
  * @var array
57
  */
58
  private $ignoreTokens = array(
59
+ \T_DOUBLE_COLON => true,
60
+ \T_OBJECT_OPERATOR => true,
61
+ \T_FUNCTION => true,
62
+ \T_NEW => true,
63
+ \T_CONST => true,
64
+ \T_USE => true,
65
  );
66
 
67
 
68
  /**
69
  * Returns an array of tokens this test wants to listen for.
70
  *
71
+ * @since 8.2.0
72
+ *
73
  * @return array
74
  */
75
  public function register()
77
  // Handle case-insensitivity of function names.
78
  $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
79
 
80
+ return array(\T_STRING);
81
  }
82
 
83
 
84
  /**
85
  * Processes this test, when one of its tokens is encountered.
86
  *
87
+ * @since 8.2.0
88
+ *
89
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
90
  * @param int $stackPtr The position of the current token in
91
  * the stack passed in $tokens.
92
  *
93
+ * @return int|void Integer stack pointer to skip forward or void to continue
94
+ * normal file processing.
95
  */
96
+ public function process(File $phpcsFile, $stackPtr)
97
  {
98
  if ($this->bowOutEarly() === true) {
99
  return;
107
  return;
108
  }
109
 
110
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
111
 
112
  if ($this->isMethod === true) {
113
+ if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
114
+ && $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
115
  ) {
116
  // Not a call to a PHP method.
117
  return;
122
  return;
123
  }
124
 
125
+ if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
126
+ && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
127
  ) {
128
  // Namespaced function.
129
  return;
143
  /**
144
  * Do a version check to determine if this sniff needs to run at all.
145
  *
146
+ * @since 8.2.0
147
+ *
148
  * If the check done in a child class is not specific to one PHP version,
149
  * this function should return `false`.
150
  *
158
  *
159
  * This method has to be made concrete in child classes.
160
  *
161
+ * @since 8.2.0
162
+ *
163
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
164
  * @param int $stackPtr The position of the current token in the stack.
165
  * @param string $functionName The token content (function name) which was matched.
168
  * @return int|void Integer stack pointer to skip forward or void to continue
169
  * normal file processing.
170
  */
171
+ abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);
172
 
173
 
174
  /**
177
  * Defaults to doing nothing. Can be overloaded in child classes to handle functions
178
  * were parameters are expected, but none found.
179
  *
180
+ * @since 8.2.0
181
+ *
182
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
183
  * @param int $stackPtr The position of the current token in the stack.
184
  * @param string $functionName The token content (function name) which was matched.
186
  * @return int|void Integer stack pointer to skip forward or void to continue
187
  * normal file processing.
188
  */
189
+ public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
190
  {
191
  return;
192
  }
193
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php CHANGED
@@ -1,20 +1,21 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\AbstractNewFeatureSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
 
 
12
  /**
13
- * \PHPCompatibility\AbstractNewFeatureSniff.
14
  *
15
- * @category PHP
16
- * @package PHPCompatibility
17
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
18
  */
19
  abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
20
  {
@@ -23,6 +24,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
23
  /**
24
  * Determine whether an error/warning should be thrown for an item based on collected information.
25
  *
 
 
26
  * @param array $errorInfo Detail information about an item.
27
  *
28
  * @return bool
@@ -36,6 +39,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
36
  /**
37
  * Retrieve the relevant detail (version) information for use in an error message.
38
  *
 
 
39
  * @param array $itemArray Version and other information about the item.
40
  * @param array $itemInfo Base information about the item.
41
  *
@@ -67,6 +72,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
67
  /**
68
  * Get the error message template for this sniff.
69
  *
 
 
70
  * @return string
71
  */
72
  protected function getErrorMsgTemplate()
@@ -78,6 +85,8 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
78
  /**
79
  * Generates the error or warning for this item.
80
  *
 
 
81
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
82
  * @param int $stackPtr The position of the relevant token in
83
  * the stack.
@@ -87,7 +96,7 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
87
  *
88
  * @return void
89
  */
90
- public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
91
  {
92
  $itemName = $this->getItemName($itemInfo, $errorInfo);
93
  $error = $this->getErrorMsgTemplate();
@@ -103,6 +112,4 @@ abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
103
 
104
  $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
105
  }
106
-
107
-
108
- }//end class
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
+ use PHP_CodeSniffer_File as File;
14
+
15
  /**
16
+ * Base class for new feature sniffs.
17
  *
18
+ * @since 7.1.0
 
 
19
  */
20
  abstract class AbstractNewFeatureSniff extends AbstractComplexVersionSniff
21
  {
24
  /**
25
  * Determine whether an error/warning should be thrown for an item based on collected information.
26
  *
27
+ * @since 7.1.0
28
+ *
29
  * @param array $errorInfo Detail information about an item.
30
  *
31
  * @return bool
39
  /**
40
  * Retrieve the relevant detail (version) information for use in an error message.
41
  *
42
+ * @since 7.1.0
43
+ *
44
  * @param array $itemArray Version and other information about the item.
45
  * @param array $itemInfo Base information about the item.
46
  *
72
  /**
73
  * Get the error message template for this sniff.
74
  *
75
+ * @since 7.1.0
76
+ *
77
  * @return string
78
  */
79
  protected function getErrorMsgTemplate()
85
  /**
86
  * Generates the error or warning for this item.
87
  *
88
+ * @since 7.1.0
89
+ *
90
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
91
  * @param int $stackPtr The position of the relevant token in
92
  * the stack.
96
  *
97
  * @return void
98
  */
99
+ public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
100
  {
101
  $itemName = $this->getItemName($itemInfo, $errorInfo);
102
  $error = $this->getErrorMsgTemplate();
112
 
113
  $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
114
  }
115
+ }
 
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php CHANGED
@@ -1,20 +1,21 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\AbstractRemovedFeatureSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
 
 
12
  /**
13
- * \PHPCompatibility\AbstractRemovedFeatureSniff.
14
  *
15
- * @category PHP
16
- * @package PHPCompatibility
17
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
18
  */
19
  abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
20
  {
@@ -23,6 +24,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
23
  /**
24
  * Determine whether an error/warning should be thrown for an item based on collected information.
25
  *
 
 
26
  * @param array $errorInfo Detail information about an item.
27
  *
28
  * @return bool
@@ -38,6 +41,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
38
  *
39
  * By default, removed feature version arrays, contain an additional 'alternative' array key.
40
  *
 
 
41
  * @return array
42
  */
43
  protected function getNonVersionArrayKeys()
@@ -49,6 +54,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
49
  /**
50
  * Retrieve the relevant detail (version) information for use in an error message.
51
  *
 
 
52
  * @param array $itemArray Version and other information about the item.
53
  * @param array $itemInfo Base information about the item.
54
  *
@@ -89,6 +96,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
89
  /**
90
  * Get the error message template for suggesting an alternative for a specific sniff.
91
  *
 
 
92
  * @return string
93
  */
94
  protected function getAlternativeOptionTemplate()
@@ -100,6 +109,8 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
100
  /**
101
  * Generates the error or warning for this item.
102
  *
 
 
103
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
104
  * @param int $stackPtr The position of the relevant token in
105
  * the stack.
@@ -109,7 +120,7 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
109
  *
110
  * @return void
111
  */
112
- public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
113
  {
114
  $itemName = $this->getItemName($itemInfo, $errorInfo);
115
  $error = $this->getErrorMsgTemplate();
@@ -130,7 +141,7 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
130
  }
131
 
132
  // Remove the last 'and' from the message.
133
- $error = substr($error, 0, (strlen($error) - 5));
134
 
135
  if ($errorInfo['alternative'] !== '') {
136
  $error .= $this->getAlternativeOptionTemplate();
@@ -141,8 +152,5 @@ abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
141
  $data = $this->filterErrorData($data, $itemInfo, $errorInfo);
142
 
143
  $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
144
-
145
- }//end addError()
146
-
147
-
148
- }//end class
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
+ use PHP_CodeSniffer_File as File;
14
+
15
  /**
16
+ * Base class for removed feature sniffs.
17
  *
18
+ * @since 7.1.0
 
 
19
  */
20
  abstract class AbstractRemovedFeatureSniff extends AbstractComplexVersionSniff
21
  {
24
  /**
25
  * Determine whether an error/warning should be thrown for an item based on collected information.
26
  *
27
+ * @since 7.1.0
28
+ *
29
  * @param array $errorInfo Detail information about an item.
30
  *
31
  * @return bool
41
  *
42
  * By default, removed feature version arrays, contain an additional 'alternative' array key.
43
  *
44
+ * @since 7.1.0
45
+ *
46
  * @return array
47
  */
48
  protected function getNonVersionArrayKeys()
54
  /**
55
  * Retrieve the relevant detail (version) information for use in an error message.
56
  *
57
+ * @since 7.1.0
58
+ *
59
  * @param array $itemArray Version and other information about the item.
60
  * @param array $itemInfo Base information about the item.
61
  *
96
  /**
97
  * Get the error message template for suggesting an alternative for a specific sniff.
98
  *
99
+ * @since 7.1.0
100
+ *
101
  * @return string
102
  */
103
  protected function getAlternativeOptionTemplate()
109
  /**
110
  * Generates the error or warning for this item.
111
  *
112
+ * @since 7.1.0
113
+ *
114
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
115
  * @param int $stackPtr The position of the relevant token in
116
  * the stack.
120
  *
121
  * @return void
122
  */
123
+ public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
124
  {
125
  $itemName = $this->getItemName($itemInfo, $errorInfo);
126
  $error = $this->getErrorMsgTemplate();
141
  }
142
 
143
  // Remove the last 'and' from the message.
144
+ $error = substr($error, 0, (\strlen($error) - 5));
145
 
146
  if ($errorInfo['alternative'] !== '') {
147
  $error .= $this->getAlternativeOptionTemplate();
152
  $data = $this->filterErrorData($data, $itemInfo, $errorInfo);
153
 
154
  $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
155
+ }
156
+ }
 
 
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php CHANGED
@@ -1,24 +1,25 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\ComplexVersionInterface.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
 
 
12
  /**
13
- * \PHPCompatibility\ComplexVersionInterface.
14
  *
15
  * Interface to be implemented by sniffs using a multi-dimensional array of
16
  * PHP features (functions, classes etc) being sniffed for with version
17
  * information in sub-arrays.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
22
  */
23
  interface ComplexVersionInterface
24
  {
@@ -28,6 +29,8 @@ interface ComplexVersionInterface
28
  * Handle the retrieval of relevant information and - if necessary - throwing of an
29
  * error/warning for an item.
30
  *
 
 
31
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
32
  * @param int $stackPtr The position of the relevant token in
33
  * the stack.
@@ -35,12 +38,14 @@ interface ComplexVersionInterface
35
  *
36
  * @return void
37
  */
38
- public function handleFeature(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo);
39
 
40
 
41
  /**
42
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
43
  *
 
 
44
  * @param array $itemInfo Base information about the item.
45
  *
46
  * @return array Version and other information about the item.
@@ -51,6 +56,8 @@ interface ComplexVersionInterface
51
  /**
52
  * Retrieve the relevant detail (version) information for use in an error message.
53
  *
 
 
54
  * @param array $itemArray Version and other information about the item.
55
  * @param array $itemInfo Base information about the item.
56
  *
@@ -62,6 +69,8 @@ interface ComplexVersionInterface
62
  /**
63
  * Generates the error or warning for this item.
64
  *
 
 
65
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
66
  * @param int $stackPtr The position of the relevant token in
67
  * the stack.
@@ -71,7 +80,5 @@ interface ComplexVersionInterface
71
  *
72
  * @return void
73
  */
74
- public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
75
-
76
-
77
- }//end interface
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
+ use PHP_CodeSniffer_File as File;
14
+
15
  /**
16
+ * Complex Version Interface.
17
  *
18
  * Interface to be implemented by sniffs using a multi-dimensional array of
19
  * PHP features (functions, classes etc) being sniffed for with version
20
  * information in sub-arrays.
21
  *
22
+ * @since 7.1.0
 
 
23
  */
24
  interface ComplexVersionInterface
25
  {
29
  * Handle the retrieval of relevant information and - if necessary - throwing of an
30
  * error/warning for an item.
31
  *
32
+ * @since 7.1.0
33
+ *
34
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
35
  * @param int $stackPtr The position of the relevant token in
36
  * the stack.
38
  *
39
  * @return void
40
  */
41
+ public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo);
42
 
43
 
44
  /**
45
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
46
  *
47
+ * @since 7.1.0
48
+ *
49
  * @param array $itemInfo Base information about the item.
50
  *
51
  * @return array Version and other information about the item.
56
  /**
57
  * Retrieve the relevant detail (version) information for use in an error message.
58
  *
59
+ * @since 7.1.0
60
+ *
61
  * @param array $itemArray Version and other information about the item.
62
  * @param array $itemInfo Base information about the item.
63
  *
69
  /**
70
  * Generates the error or warning for this item.
71
  *
72
+ * @since 7.1.0
73
+ *
74
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
75
  * @param int $stackPtr The position of the relevant token in
76
  * the stack.
80
  *
81
  * @return void
82
  */
83
+ public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
84
+ }
 
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php CHANGED
@@ -1,17 +1,20 @@
1
  <?php
2
  /**
3
- * PHPCS cross-version compatibility helper class.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility;
11
 
 
 
 
 
12
  /**
13
- * \PHPCompatibility\PHPCSHelper
14
- *
15
  * PHPCS cross-version compatibility helper class.
16
  *
17
  * A number of PHPCS classes were split up into several classes in PHPCS 3.x
@@ -19,9 +22,15 @@ namespace PHPCompatibility;
19
  * This class provides helper methods for functions which were contained in
20
  * one of these classes and which are used within the PHPCompatibility library.
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
 
25
  */
26
  class PHPCSHelper
27
  {
@@ -29,15 +38,17 @@ class PHPCSHelper
29
  /**
30
  * Get the PHPCS version number.
31
  *
 
 
32
  * @return string
33
  */
34
  public static function getVersion()
35
  {
36
- if (defined('\PHP_CodeSniffer\Config::VERSION')) {
37
  // PHPCS 3.x.
38
  return \PHP_CodeSniffer\Config::VERSION;
39
  } else {
40
- // PHPCS 1.x & 2.x.
41
  return \PHP_CodeSniffer::VERSION;
42
  }
43
  }
@@ -48,6 +59,8 @@ class PHPCSHelper
48
  *
49
  * PHPCS cross-version compatibility helper.
50
  *
 
 
51
  * @param string $key The name of the config value.
52
  * @param string|null $value The value to set. If null, the config entry
53
  * is deleted, reverting it to the default value.
@@ -62,7 +75,7 @@ class PHPCSHelper
62
  // PHPCS 3.x.
63
  \PHP_CodeSniffer\Config::setConfigData($key, $value, $temp);
64
  } else {
65
- // PHPCS 1.x & 2.x.
66
  \PHP_CodeSniffer::setConfigData($key, $value, $temp);
67
  }
68
  }
@@ -71,6 +84,8 @@ class PHPCSHelper
71
  /**
72
  * Get the value of a single PHPCS config key.
73
  *
 
 
74
  * @param string $key The name of the config value.
75
  *
76
  * @return string|null
@@ -81,7 +96,7 @@ class PHPCSHelper
81
  // PHPCS 3.x.
82
  return \PHP_CodeSniffer\Config::getConfigData($key);
83
  } else {
84
- // PHPCS 1.x & 2.x.
85
  return \PHP_CodeSniffer::getConfigData($key);
86
  }
87
  }
@@ -93,21 +108,23 @@ class PHPCSHelper
93
  * This config key can be set in the `CodeSniffer.conf` file, on the
94
  * command-line or in a ruleset.
95
  *
 
 
96
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
97
  * @param string $key The name of the config value.
98
  *
99
  * @return string|null
100
  */
101
- public static function getCommandLineData($phpcsFile, $key)
102
  {
103
- if (method_exists('\PHP_CodeSniffer\Config', 'getAllConfigData')) {
104
  // PHPCS 3.x.
105
  $config = $phpcsFile->config;
106
  if (isset($config->{$key})) {
107
  return $config->{$key};
108
  }
109
  } else {
110
- // PHPCS 1.x & 2.x.
111
  $config = $phpcsFile->phpcs->cli->getCommandLineValues();
112
  if (isset($config[$key])) {
113
  return $config[$key];
@@ -118,17 +135,100 @@ class PHPCSHelper
118
  }
119
 
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  /**
122
  * Returns the position of the last non-whitespace token in a statement.
123
  *
124
  * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
125
- * class and introduced in PHPCS 2.1.0.
126
  *
127
  * Once the minimum supported PHPCS version for this standard goes beyond
128
  * that, this method can be removed and calls to it replaced with
129
  * `$phpcsFile->findEndOfStatement($start, $ignore)` calls.
130
  *
131
- * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit f5d899dcb5c534a1c3cca34668624517856ba823}}
 
 
132
  *
133
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
134
  * @param int $start The position to start searching from in the token stack.
@@ -136,7 +236,7 @@ class PHPCSHelper
136
  *
137
  * @return int
138
  */
139
- public static function findEndOfStatement(\PHP_CodeSniffer_File $phpcsFile, $start, $ignore = null)
140
  {
141
  if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
142
  return $phpcsFile->findEndOfStatement($start, $ignore);
@@ -144,16 +244,16 @@ class PHPCSHelper
144
 
145
  $tokens = $phpcsFile->getTokens();
146
  $endTokens = array(
147
- T_COLON => true,
148
- T_COMMA => true,
149
- T_DOUBLE_ARROW => true,
150
- T_SEMICOLON => true,
151
- T_CLOSE_PARENTHESIS => true,
152
- T_CLOSE_SQUARE_BRACKET => true,
153
- T_CLOSE_CURLY_BRACKET => true,
154
- T_CLOSE_SHORT_ARRAY => true,
155
- T_OPEN_TAG => true,
156
- T_CLOSE_TAG => true,
157
  );
158
 
159
  if ($ignore !== null) {
@@ -170,12 +270,12 @@ class PHPCSHelper
170
  for ($i = $start; $i < $phpcsFile->numTokens; $i++) {
171
  if ($i !== $start && isset($endTokens[$tokens[$i]['code']]) === true) {
172
  // Found the end of the statement.
173
- if ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS
174
- || $tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
175
- || $tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
176
- || $tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
177
- || $tokens[$i]['code'] === T_OPEN_TAG
178
- || $tokens[$i]['code'] === T_CLOSE_TAG
179
  ) {
180
  return $lastNotEmpty;
181
  }
@@ -188,7 +288,7 @@ class PHPCSHelper
188
  && ($i === $tokens[$i]['scope_opener']
189
  || $i === $tokens[$i]['scope_condition'])
190
  ) {
191
- if ($i === $start && isset(Util\Tokens::$scopeOpeners[$tokens[$i]['code']]) === true) {
192
  return $tokens[$i]['scope_closer'];
193
  }
194
 
@@ -203,14 +303,13 @@ class PHPCSHelper
203
  $i = $tokens[$i]['parenthesis_closer'];
204
  }
205
 
206
- if (isset(\PHP_CodeSniffer_Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
207
  $lastNotEmpty = $i;
208
  }
209
  }//end for
210
 
211
  return ($phpcsFile->numTokens - 1);
212
-
213
- }//end findEndOfStatement()
214
 
215
 
216
  /**
@@ -228,14 +327,17 @@ class PHPCSHelper
228
  * that, this method can be removed and calls to it replaced with
229
  * `$phpcsFile->findExtendedClassName($stackPtr)` calls.
230
  *
231
- * Last synced with PHPCS version: PHPCS 3.1.0-alpha at commit a9efcc9b0703f3f9f4a900623d4e97128a6aafc6}}
 
 
 
232
  *
233
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
234
  * @param int $stackPtr The position of the class token in the stack.
235
  *
236
  * @return string|false
237
  */
238
- public static function findExtendedClassName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
239
  {
240
  if (version_compare(self::getVersion(), '3.1.0', '>=') === true) {
241
  return $phpcsFile->findExtendedClassName($stackPtr);
@@ -248,7 +350,7 @@ class PHPCSHelper
248
  return false;
249
  }
250
 
251
- if ($tokens[$stackPtr]['code'] !== T_CLASS
252
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
253
  && $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
254
  ) {
@@ -260,15 +362,15 @@ class PHPCSHelper
260
  }
261
 
262
  $classCloserIndex = $tokens[$stackPtr]['scope_closer'];
263
- $extendsIndex = $phpcsFile->findNext(T_EXTENDS, $stackPtr, $classCloserIndex);
264
  if ($extendsIndex === false) {
265
  return false;
266
  }
267
 
268
  $find = array(
269
- T_NS_SEPARATOR,
270
- T_STRING,
271
- T_WHITESPACE,
272
  );
273
 
274
  $end = $phpcsFile->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
@@ -280,8 +382,7 @@ class PHPCSHelper
280
  }
281
 
282
  return $name;
283
-
284
- }//end findExtendedClassName()
285
 
286
 
287
  /**
@@ -294,14 +395,17 @@ class PHPCSHelper
294
  * in PHPCS 2.8.0, so only defer to upstream for higher versions.
295
  * Once the minimum supported PHPCS version for this sniff library goes beyond
296
  * that, this method can be removed and calls to it replaced with
297
- * `$phpcsFile->findImplementedInterfaceNames($stackPtr)` calls.}}
 
 
 
298
  *
299
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
300
  * @param int $stackPtr The position of the class token.
301
  *
302
  * @return array|false
303
  */
304
- public static function findImplementedInterfaceNames(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
305
  {
306
  if (version_compare(self::getVersion(), '2.7.1', '>') === true) {
307
  return $phpcsFile->findImplementedInterfaceNames($stackPtr);
@@ -314,7 +418,7 @@ class PHPCSHelper
314
  return false;
315
  }
316
 
317
- if ($tokens[$stackPtr]['code'] !== T_CLASS
318
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
319
  ) {
320
  return false;
@@ -325,16 +429,16 @@ class PHPCSHelper
325
  }
326
 
327
  $classOpenerIndex = $tokens[$stackPtr]['scope_opener'];
328
- $implementsIndex = $phpcsFile->findNext(T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
329
  if ($implementsIndex === false) {
330
  return false;
331
  }
332
 
333
  $find = array(
334
- T_NS_SEPARATOR,
335
- T_STRING,
336
- T_WHITESPACE,
337
- T_COMMA,
338
  );
339
 
340
  $end = $phpcsFile->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
@@ -348,8 +452,7 @@ class PHPCSHelper
348
  $names = array_map('trim', $names);
349
  return $names;
350
  }
351
-
352
- }//end findImplementedInterfaceNames()
353
 
354
 
355
  /**
@@ -377,7 +480,10 @@ class PHPCSHelper
377
  * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
378
  * class.
379
  *
380
- * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit 53a28408d345044c0360c2c1b4a2aaebf4a3b8c9}}
 
 
 
381
  *
382
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
383
  * @param int $stackPtr The position in the stack of the
@@ -388,7 +494,7 @@ class PHPCSHelper
388
  * @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of
389
  * type T_FUNCTION or T_CLOSURE.
390
  */
391
- public static function getMethodParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
392
  {
393
  if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
394
  return $phpcsFile->getMethodParameters($stackPtr);
@@ -401,10 +507,10 @@ class PHPCSHelper
401
  return false;
402
  }
403
 
404
- if ($tokens[$stackPtr]['code'] !== T_FUNCTION
405
- && $tokens[$stackPtr]['code'] !== T_CLOSURE
406
  ) {
407
- throw new \PHP_CodeSniffer_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
408
  }
409
 
410
  $opener = $tokens[$stackPtr]['parenthesis_opener'];
@@ -477,7 +583,7 @@ class PHPCSHelper
477
  // also be a constant used as a default value.
478
  $prevComma = false;
479
  for ($t = $i; $t >= $opener; $t--) {
480
- if ($tokens[$t]['code'] === T_COMMA) {
481
  $prevComma = $t;
482
  break;
483
  }
@@ -486,7 +592,7 @@ class PHPCSHelper
486
  if ($prevComma !== false) {
487
  $nextEquals = false;
488
  for ($t = $prevComma; $t < $i; $t++) {
489
- if ($tokens[$t]['code'] === T_EQUAL) {
490
  $nextEquals = $t;
491
  break;
492
  }
@@ -568,6 +674,5 @@ class PHPCSHelper
568
  }//end for
569
 
570
  return $vars;
571
-
572
- }//end getMethodParameters()
573
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
+ use PHP_CodeSniffer_Exception as PHPCS_Exception;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
  /**
 
 
18
  * PHPCS cross-version compatibility helper class.
19
  *
20
  * A number of PHPCS classes were split up into several classes in PHPCS 3.x
22
  * This class provides helper methods for functions which were contained in
23
  * one of these classes and which are used within the PHPCompatibility library.
24
  *
25
+ * Additionally, this class contains some duplicates of PHPCS native methods.
26
+ * These methods have received bug fixes or improved functionality between the
27
+ * lowest supported PHPCS version and the latest PHPCS stable version and
28
+ * to provide the same results cross-version, PHPCompatibility needs to use
29
+ * the up-to-date versions of these methods.
30
+ *
31
+ * @since 8.0.0
32
+ * @since 8.2.0 The duplicate PHPCS methods have been moved from the `Sniff`
33
+ * base class to this class.
34
  */
35
  class PHPCSHelper
36
  {
38
  /**
39
  * Get the PHPCS version number.
40
  *
41
+ * @since 8.0.0
42
+ *
43
  * @return string
44
  */
45
  public static function getVersion()
46
  {
47
+ if (\defined('\PHP_CodeSniffer\Config::VERSION')) {
48
  // PHPCS 3.x.
49
  return \PHP_CodeSniffer\Config::VERSION;
50
  } else {
51
+ // PHPCS 2.x.
52
  return \PHP_CodeSniffer::VERSION;
53
  }
54
  }
59
  *
60
  * PHPCS cross-version compatibility helper.
61
  *
62
+ * @since 8.0.0
63
+ *
64
  * @param string $key The name of the config value.
65
  * @param string|null $value The value to set. If null, the config entry
66
  * is deleted, reverting it to the default value.
75
  // PHPCS 3.x.
76
  \PHP_CodeSniffer\Config::setConfigData($key, $value, $temp);
77
  } else {
78
+ // PHPCS 2.x.
79
  \PHP_CodeSniffer::setConfigData($key, $value, $temp);
80
  }
81
  }
84
  /**
85
  * Get the value of a single PHPCS config key.
86
  *
87
+ * @since 8.0.0
88
+ *
89
  * @param string $key The name of the config value.
90
  *
91
  * @return string|null
96
  // PHPCS 3.x.
97
  return \PHP_CodeSniffer\Config::getConfigData($key);
98
  } else {
99
+ // PHPCS 2.x.
100
  return \PHP_CodeSniffer::getConfigData($key);
101
  }
102
  }
108
  * This config key can be set in the `CodeSniffer.conf` file, on the
109
  * command-line or in a ruleset.
110
  *
111
+ * @since 8.2.0
112
+ *
113
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
114
  * @param string $key The name of the config value.
115
  *
116
  * @return string|null
117
  */
118
+ public static function getCommandLineData(File $phpcsFile, $key)
119
  {
120
+ if (class_exists('\PHP_CodeSniffer\Config')) {
121
  // PHPCS 3.x.
122
  $config = $phpcsFile->config;
123
  if (isset($config->{$key})) {
124
  return $config->{$key};
125
  }
126
  } else {
127
+ // PHPCS 2.x.
128
  $config = $phpcsFile->phpcs->cli->getCommandLineValues();
129
  if (isset($config[$key])) {
130
  return $config[$key];
135
  }
136
 
137
 
138
+ /**
139
+ * Returns the position of the first non-whitespace token in a statement.
140
+ *
141
+ * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
142
+ * class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1.
143
+ *
144
+ * Once the minimum supported PHPCS version for this standard goes beyond
145
+ * that, this method can be removed and calls to it replaced with
146
+ * `$phpcsFile->findStartOfStatement($start, $ignore)` calls.
147
+ *
148
+ * Last synced with PHPCS version: PHPCS 3.3.2 at commit 6ad28354c04b364c3c71a34e4a18b629cc3b231e}
149
+ *
150
+ * @since 9.1.0
151
+ *
152
+ * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
153
+ * @param int $start The position to start searching from in the token stack.
154
+ * @param int|array $ignore Token types that should not be considered stop points.
155
+ *
156
+ * @return int
157
+ */
158
+ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = null)
159
+ {
160
+ if (version_compare(self::getVersion(), '2.7.1', '>=') === true) {
161
+ return $phpcsFile->findStartOfStatement($start, $ignore);
162
+ }
163
+
164
+ $tokens = $phpcsFile->getTokens();
165
+ $endTokens = Tokens::$blockOpeners;
166
+
167
+ $endTokens[\T_COLON] = true;
168
+ $endTokens[\T_COMMA] = true;
169
+ $endTokens[\T_DOUBLE_ARROW] = true;
170
+ $endTokens[\T_SEMICOLON] = true;
171
+ $endTokens[\T_OPEN_TAG] = true;
172
+ $endTokens[\T_CLOSE_TAG] = true;
173
+ $endTokens[\T_OPEN_SHORT_ARRAY] = true;
174
+
175
+ if ($ignore !== null) {
176
+ $ignore = (array) $ignore;
177
+ foreach ($ignore as $code) {
178
+ if (isset($endTokens[$code]) === true) {
179
+ unset($endTokens[$code]);
180
+ }
181
+ }
182
+ }
183
+
184
+ $lastNotEmpty = $start;
185
+
186
+ for ($i = $start; $i >= 0; $i--) {
187
+ if (isset($endTokens[$tokens[$i]['code']]) === true) {
188
+ // Found the end of the previous statement.
189
+ return $lastNotEmpty;
190
+ }
191
+
192
+ if (isset($tokens[$i]['scope_opener']) === true
193
+ && $i === $tokens[$i]['scope_closer']
194
+ ) {
195
+ // Found the end of the previous scope block.
196
+ return $lastNotEmpty;
197
+ }
198
+
199
+ // Skip nested statements.
200
+ if (isset($tokens[$i]['bracket_opener']) === true
201
+ && $i === $tokens[$i]['bracket_closer']
202
+ ) {
203
+ $i = $tokens[$i]['bracket_opener'];
204
+ } elseif (isset($tokens[$i]['parenthesis_opener']) === true
205
+ && $i === $tokens[$i]['parenthesis_closer']
206
+ ) {
207
+ $i = $tokens[$i]['parenthesis_opener'];
208
+ }
209
+
210
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
211
+ $lastNotEmpty = $i;
212
+ }
213
+ }//end for
214
+
215
+ return 0;
216
+ }
217
+
218
+
219
  /**
220
  * Returns the position of the last non-whitespace token in a statement.
221
  *
222
  * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
223
+ * class and introduced in PHPCS 2.1.0 and improved in PHPCS 2.7.1 and 3.3.0.
224
  *
225
  * Once the minimum supported PHPCS version for this standard goes beyond
226
  * that, this method can be removed and calls to it replaced with
227
  * `$phpcsFile->findEndOfStatement($start, $ignore)` calls.
228
  *
229
+ * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit f5d899dcb5c534a1c3cca34668624517856ba823}
230
+ *
231
+ * @since 8.2.0
232
  *
233
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
234
  * @param int $start The position to start searching from in the token stack.
236
  *
237
  * @return int
238
  */
239
+ public static function findEndOfStatement(File $phpcsFile, $start, $ignore = null)
240
  {
241
  if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
242
  return $phpcsFile->findEndOfStatement($start, $ignore);
244
 
245
  $tokens = $phpcsFile->getTokens();
246
  $endTokens = array(
247
+ \T_COLON => true,
248
+ \T_COMMA => true,
249
+ \T_DOUBLE_ARROW => true,
250
+ \T_SEMICOLON => true,
251
+ \T_CLOSE_PARENTHESIS => true,
252
+ \T_CLOSE_SQUARE_BRACKET => true,
253
+ \T_CLOSE_CURLY_BRACKET => true,
254
+ \T_CLOSE_SHORT_ARRAY => true,
255
+ \T_OPEN_TAG => true,
256
+ \T_CLOSE_TAG => true,
257
  );
258
 
259
  if ($ignore !== null) {
270
  for ($i = $start; $i < $phpcsFile->numTokens; $i++) {
271
  if ($i !== $start && isset($endTokens[$tokens[$i]['code']]) === true) {
272
  // Found the end of the statement.
273
+ if ($tokens[$i]['code'] === \T_CLOSE_PARENTHESIS
274
+ || $tokens[$i]['code'] === \T_CLOSE_SQUARE_BRACKET
275
+ || $tokens[$i]['code'] === \T_CLOSE_CURLY_BRACKET
276
+ || $tokens[$i]['code'] === \T_CLOSE_SHORT_ARRAY
277
+ || $tokens[$i]['code'] === \T_OPEN_TAG
278
+ || $tokens[$i]['code'] === \T_CLOSE_TAG
279
  ) {
280
  return $lastNotEmpty;
281
  }
288
  && ($i === $tokens[$i]['scope_opener']
289
  || $i === $tokens[$i]['scope_condition'])
290
  ) {
291
+ if ($i === $start && isset(Tokens::$scopeOpeners[$tokens[$i]['code']]) === true) {
292
  return $tokens[$i]['scope_closer'];
293
  }
294
 
303
  $i = $tokens[$i]['parenthesis_closer'];
304
  }
305
 
306
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === false) {
307
  $lastNotEmpty = $i;
308
  }
309
  }//end for
310
 
311
  return ($phpcsFile->numTokens - 1);
312
+ }
 
313
 
314
 
315
  /**
327
  * that, this method can be removed and calls to it replaced with
328
  * `$phpcsFile->findExtendedClassName($stackPtr)` calls.
329
  *
330
+ * Last synced with PHPCS version: PHPCS 3.1.0-alpha at commit a9efcc9b0703f3f9f4a900623d4e97128a6aafc6}
331
+ *
332
+ * @since 7.1.4
333
+ * @since 8.2.0 Moved from the `Sniff` class to this class.
334
  *
335
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
336
  * @param int $stackPtr The position of the class token in the stack.
337
  *
338
  * @return string|false
339
  */
340
+ public static function findExtendedClassName(File $phpcsFile, $stackPtr)
341
  {
342
  if (version_compare(self::getVersion(), '3.1.0', '>=') === true) {
343
  return $phpcsFile->findExtendedClassName($stackPtr);
350
  return false;
351
  }
352
 
353
+ if ($tokens[$stackPtr]['code'] !== \T_CLASS
354
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
355
  && $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
356
  ) {
362
  }
363
 
364
  $classCloserIndex = $tokens[$stackPtr]['scope_closer'];
365
+ $extendsIndex = $phpcsFile->findNext(\T_EXTENDS, $stackPtr, $classCloserIndex);
366
  if ($extendsIndex === false) {
367
  return false;
368
  }
369
 
370
  $find = array(
371
+ \T_NS_SEPARATOR,
372
+ \T_STRING,
373
+ \T_WHITESPACE,
374
  );
375
 
376
  $end = $phpcsFile->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
382
  }
383
 
384
  return $name;
385
+ }
 
386
 
387
 
388
  /**
395
  * in PHPCS 2.8.0, so only defer to upstream for higher versions.
396
  * Once the minimum supported PHPCS version for this sniff library goes beyond
397
  * that, this method can be removed and calls to it replaced with
398
+ * `$phpcsFile->findImplementedInterfaceNames($stackPtr)` calls.}
399
+ *
400
+ * @since 7.0.3
401
+ * @since 8.2.0 Moved from the `Sniff` class to this class.
402
  *
403
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
404
  * @param int $stackPtr The position of the class token.
405
  *
406
  * @return array|false
407
  */
408
+ public static function findImplementedInterfaceNames(File $phpcsFile, $stackPtr)
409
  {
410
  if (version_compare(self::getVersion(), '2.7.1', '>') === true) {
411
  return $phpcsFile->findImplementedInterfaceNames($stackPtr);
418
  return false;
419
  }
420
 
421
+ if ($tokens[$stackPtr]['code'] !== \T_CLASS
422
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
423
  ) {
424
  return false;
429
  }
430
 
431
  $classOpenerIndex = $tokens[$stackPtr]['scope_opener'];
432
+ $implementsIndex = $phpcsFile->findNext(\T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
433
  if ($implementsIndex === false) {
434
  return false;
435
  }
436
 
437
  $find = array(
438
+ \T_NS_SEPARATOR,
439
+ \T_STRING,
440
+ \T_WHITESPACE,
441
+ \T_COMMA,
442
  );
443
 
444
  $end = $phpcsFile->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
452
  $names = array_map('trim', $names);
453
  return $names;
454
  }
455
+ }
 
456
 
457
 
458
  /**
480
  * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
481
  * class.
482
  *
483
+ * Last synced with PHPCS version: PHPCS 3.3.0-alpha at commit 53a28408d345044c0360c2c1b4a2aaebf4a3b8c9}
484
+ *
485
+ * @since 7.0.3
486
+ * @since 8.2.0 Moved from the `Sniff` class to this class.
487
  *
488
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
489
  * @param int $stackPtr The position in the stack of the
494
  * @throws \PHP_CodeSniffer_Exception If the specified $stackPtr is not of
495
  * type T_FUNCTION or T_CLOSURE.
496
  */
497
+ public static function getMethodParameters(File $phpcsFile, $stackPtr)
498
  {
499
  if (version_compare(self::getVersion(), '3.3.0', '>=') === true) {
500
  return $phpcsFile->getMethodParameters($stackPtr);
507
  return false;
508
  }
509
 
510
+ if ($tokens[$stackPtr]['code'] !== \T_FUNCTION
511
+ && $tokens[$stackPtr]['code'] !== \T_CLOSURE
512
  ) {
513
+ throw new PHPCS_Exception('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
514
  }
515
 
516
  $opener = $tokens[$stackPtr]['parenthesis_opener'];
583
  // also be a constant used as a default value.
584
  $prevComma = false;
585
  for ($t = $i; $t >= $opener; $t--) {
586
+ if ($tokens[$t]['code'] === \T_COMMA) {
587
  $prevComma = $t;
588
  break;
589
  }
592
  if ($prevComma !== false) {
593
  $nextEquals = false;
594
  for ($t = $prevComma; $t < $i; $t++) {
595
+ if ($tokens[$t]['code'] === \T_EQUAL) {
596
  $nextEquals = $t;
597
  break;
598
  }
674
  }//end for
675
 
676
  return $vars;
677
+ }
 
678
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php CHANGED
@@ -1,47 +1,61 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2014 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
  use PHPCompatibility\PHPCSHelper;
 
 
 
 
14
 
15
  /**
16
- * \PHPCompatibility\Sniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Wim Godden <wim.godden@cu.be>
21
- * @copyright 2014 Cu.be Solutions bvba
22
  */
23
- abstract class Sniff implements \PHP_CodeSniffer_Sniff
24
  {
25
 
 
 
 
 
 
 
 
 
 
 
26
  const REGEX_COMPLEX_VARS = '`(?:(\{)?(?<!\\\\)\$)?(\{)?(?<!\\\\)\$(\{)?(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(?:->\$?(?P>varname)|\[[^\]]+\]|::\$?(?P>varname)|\([^\)]*\))*(?(3)\}|)(?(2)\}|)(?(1)\}|)`';
27
 
28
  /**
29
  * List of superglobals as an array of strings.
30
  *
31
- * Used by the ParameterShadowSuperGlobals and ForbiddenClosureUseVariableNames sniffs.
 
 
 
32
  *
33
  * @var array
34
  */
35
  protected $superglobals = array(
36
- '$GLOBALS',
37
- '$_SERVER',
38
- '$_GET',
39
- '$_POST',
40
- '$_FILES',
41
- '$_COOKIE',
42
- '$_SESSION',
43
- '$_REQUEST',
44
- '$_ENV',
45
  );
46
 
47
  /**
@@ -50,6 +64,9 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
50
  * Used by the new/removed hash algorithm sniffs.
51
  * Key is the function name, value is the 1-based parameter position in the function call.
52
  *
 
 
 
53
  * @var array
54
  */
55
  protected $hashAlgoFunctions = array(
@@ -68,6 +85,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
68
  * Used by the new/removed ini directives sniffs.
69
  * Key is the function name, value is the 1-based parameter position in the function call.
70
  *
 
 
71
  * @var array
72
  */
73
  protected $iniFunctions = array(
@@ -94,6 +113,9 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
94
  * PHP version numbers should always be in Major.Minor format. Both "5", "5.3.2"
95
  * would be treated as invalid, and ignored.
96
  *
 
 
 
97
  * @return array $arrTestVersions will hold an array containing min/max version
98
  * of PHP that we are checking against (see above). If only a
99
  * single version number is specified, then this is used as
@@ -132,7 +154,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
132
  if (version_compare($min, $max, '>')) {
133
  trigger_error(
134
  "Invalid range in testVersion setting: '" . $testVersion . "'",
135
- E_USER_WARNING
136
  );
137
  return $default;
138
  } else {
@@ -144,7 +166,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
144
 
145
  trigger_error(
146
  "Invalid testVersion setting: '" . $testVersion . "'",
147
- E_USER_WARNING
148
  );
149
  return $default;
150
  }
@@ -163,6 +185,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
163
  *
164
  * Should be used when sniffing for *old* PHP features (deprecated/removed).
165
  *
 
 
166
  * @param string $phpVersion A PHP version number in 'major.minor' format.
167
  *
168
  * @return bool True if testVersion has not been provided or if the PHP version
@@ -174,14 +198,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
174
  $testVersion = $this->getTestVersion();
175
  $testVersion = $testVersion[1];
176
 
177
- if (is_null($testVersion)
178
  || version_compare($testVersion, $phpVersion) >= 0
179
  ) {
180
  return true;
181
  } else {
182
  return false;
183
  }
184
- }//end supportsAbove()
185
 
186
 
187
  /**
@@ -190,6 +214,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
190
  *
191
  * Should be used when sniffing for *new* PHP features.
192
  *
 
 
193
  * @param string $phpVersion A PHP version number in 'major.minor' format.
194
  *
195
  * @return bool True if the PHP version is equal to or lower than the lowest
@@ -201,19 +227,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
201
  $testVersion = $this->getTestVersion();
202
  $testVersion = $testVersion[0];
203
 
204
- if (is_null($testVersion) === false
205
  && version_compare($testVersion, $phpVersion) <= 0
206
  ) {
207
  return true;
208
  } else {
209
  return false;
210
  }
211
- }//end supportsBelow()
212
 
213
 
214
  /**
215
  * Add a PHPCS message to the output stack as either a warning or an error.
216
  *
 
 
217
  * @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to.
218
  * @param string $message The message.
219
  * @param int $stackPtr The position of the token
@@ -227,7 +255,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
227
  *
228
  * @return void
229
  */
230
- public function addMessage(\PHP_CodeSniffer_File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array())
231
  {
232
  if ($isError === true) {
233
  $phpcsFile->addError($message, $stackPtr, $code, $data);
@@ -242,6 +270,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
242
  *
243
  * Pre-empt issues with arbitrary strings being used as error codes in XML and PHP.
244
  *
 
 
245
  * @param string $baseString Arbitrary string.
246
  *
247
  * @return string
@@ -257,6 +287,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
257
  *
258
  * Intended for use with the contents of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING.
259
  *
 
 
260
  * @param string $string The raw string.
261
  *
262
  * @return string String without quotes around it.
@@ -272,6 +304,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
272
  *
273
  * Intended for use with the contents of a T_DOUBLE_QUOTED_STRING.
274
  *
 
 
275
  * @param string $string The raw string.
276
  *
277
  * @return string String without variables in it.
@@ -289,22 +323,22 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
289
  /**
290
  * Make all top level array keys in an array lowercase.
291
  *
 
 
292
  * @param array $array Initial array.
293
  *
294
  * @return array Same array, but with all lowercase top level keys.
295
  */
296
  public function arrayKeysToLowercase($array)
297
  {
298
- $keys = array_keys($array);
299
- $keys = array_map('strtolower', $keys);
300
- return array_combine($keys, $array);
301
  }
302
 
303
 
304
  /**
305
  * Checks if a function call has parameters.
306
  *
307
- * Expects to be passed the T_STRING stack pointer for the function call.
308
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
309
  *
310
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it
@@ -313,12 +347,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
313
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120
314
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152
315
  *
 
 
316
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
317
  * @param int $stackPtr The position of the function call token.
318
  *
319
  * @return bool
320
  */
321
- public function doesFunctionCallHaveParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
322
  {
323
  $tokens = $phpcsFile->getTokens();
324
 
@@ -328,14 +364,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
328
  }
329
 
330
  // Is this one of the tokens this function handles ?
331
- if (in_array($tokens[$stackPtr]['code'], array(T_STRING, T_ARRAY, T_OPEN_SHORT_ARRAY), true) === false) {
332
  return false;
333
  }
334
 
335
- $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
336
 
337
  // Deal with short array syntax.
338
- if ($tokens[$stackPtr]['code'] === T_OPEN_SHORT_ARRAY) {
339
  if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
340
  return false;
341
  }
@@ -350,7 +386,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
350
 
351
  // Deal with function calls & long arrays.
352
  // Next non-empty token should be the open parenthesis.
353
- if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
354
  return false;
355
  }
356
 
@@ -359,7 +395,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
359
  }
360
 
361
  $closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
362
- $nextNextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true);
363
 
364
  if ($nextNextNonEmpty === $closeParenthesis) {
365
  // No parameters.
@@ -373,7 +409,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
373
  /**
374
  * Count the number of parameters a function call has been passed.
375
  *
376
- * Expects to be passed the T_STRING stack pointer for the function call.
377
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
378
  *
379
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
@@ -383,25 +419,27 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
383
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114
384
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151
385
  *
 
 
386
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
387
  * @param int $stackPtr The position of the function call token.
388
  *
389
  * @return int
390
  */
391
- public function getFunctionCallParameterCount(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
392
  {
393
  if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
394
  return 0;
395
  }
396
 
397
- return count($this->getFunctionCallParameters($phpcsFile, $stackPtr));
398
  }
399
 
400
 
401
  /**
402
  * Get information on all parameters passed to a function call.
403
  *
404
- * Expects to be passed the T_STRING stack pointer for the function call.
405
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
406
  *
407
  * Will return an multi-dimentional array with the start token pointer, end token
@@ -411,30 +449,32 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
411
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
412
  * it will tokenize the values / key/value pairs contained in the array call.
413
  *
 
 
414
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
415
  * @param int $stackPtr The position of the function call token.
416
  *
417
  * @return array
418
  */
419
- public function getFunctionCallParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
420
  {
421
  if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
422
  return array();
423
  }
424
 
425
- // Ok, we know we have a T_STRING, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters
426
  // and valid open & close brackets/parenthesis.
427
  $tokens = $phpcsFile->getTokens();
428
 
429
  // Mark the beginning and end tokens.
430
- if ($tokens[$stackPtr]['code'] === T_OPEN_SHORT_ARRAY) {
431
  $opener = $stackPtr;
432
  $closer = $tokens[$stackPtr]['bracket_closer'];
433
 
434
  $nestedParenthesisCount = 0;
435
 
436
  } else {
437
- $opener = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
438
  $closer = $tokens[$opener]['parenthesis_closer'];
439
 
440
  $nestedParenthesisCount = 1;
@@ -442,14 +482,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
442
 
443
  // Which nesting level is the one we are interested in ?
444
  if (isset($tokens[$opener]['nested_parenthesis'])) {
445
- $nestedParenthesisCount += count($tokens[$opener]['nested_parenthesis']);
446
  }
447
 
448
  $parameters = array();
449
  $nextComma = $opener;
450
  $paramStart = $opener + 1;
451
  $cnt = 1;
452
- while (($nextComma = $phpcsFile->findNext(array(T_COMMA, $tokens[$closer]['code'], T_OPEN_SHORT_ARRAY, T_CLOSURE), $nextComma + 1, $closer + 1)) !== false) {
453
  // Ignore anything within short array definition brackets.
454
  if ($tokens[$nextComma]['type'] === 'T_OPEN_SHORT_ARRAY'
455
  && (isset($tokens[$nextComma]['bracket_opener'])
@@ -475,7 +515,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
475
  // Ignore comma's at a lower nesting level.
476
  if ($tokens[$nextComma]['type'] === 'T_COMMA'
477
  && isset($tokens[$nextComma]['nested_parenthesis'])
478
- && count($tokens[$nextComma]['nested_parenthesis']) !== $nestedParenthesisCount
479
  ) {
480
  continue;
481
  }
@@ -490,10 +530,12 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
490
  $parameters[$cnt]['end'] = $nextComma - 1;
491
  $parameters[$cnt]['raw'] = trim($phpcsFile->getTokensAsString($paramStart, ($nextComma - $paramStart)));
492
 
493
- // Check if there are more tokens before the closing parenthesis.
494
- // Prevents code like the following from setting a third parameter:
495
- // functionCall( $param1, $param2, );
496
- $hasNextParam = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $nextComma + 1, $closer, true, null, true);
 
 
497
  if ($hasNextParam === false) {
498
  break;
499
  }
@@ -510,20 +552,22 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
510
  /**
511
  * Get information on a specific parameter passed to a function call.
512
  *
513
- * Expects to be passed the T_STRING stack pointer for the function call.
514
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
515
  *
516
  * Will return a array with the start token pointer, end token pointer and the raw value
517
  * of the parameter at a specific offset.
518
  * If the specified parameter is not found, will return false.
519
  *
 
 
520
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
521
  * @param int $stackPtr The position of the function call token.
522
  * @param int $paramOffset The 1-based index position of the parameter to retrieve.
523
  *
524
  * @return array|false
525
  */
526
- public function getFunctionCallParameter(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $paramOffset)
527
  {
528
  $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
529
 
@@ -542,6 +586,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
542
  * will check that the token has at least one condition which is of a
543
  * type defined in $validScopes.
544
  *
 
 
545
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
546
  * @param int $stackPtr The position of the token.
547
  * @param array|int $validScopes Optional. Array of valid scopes
@@ -553,7 +599,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
553
  * If the $scopeTypes are set: True if *one* of the conditions is a
554
  * valid scope, false otherwise.
555
  */
556
- public function tokenHasScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $validScopes = null)
557
  {
558
  $tokens = $phpcsFile->getTokens();
559
 
@@ -579,6 +625,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
579
  /**
580
  * Verify whether a token is within a class scope.
581
  *
 
 
582
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
583
  * @param int $stackPtr The position of the token.
584
  * @param bool $strict Whether to strictly check for the T_CLASS
@@ -587,84 +635,35 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
587
  *
588
  * @return bool True if within class scope, false otherwise.
589
  */
590
- public function inClassScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $strict = true)
591
  {
592
- $validScopes = array(T_CLASS);
593
- if (defined('T_ANON_CLASS') === true) {
594
- $validScopes[] = T_ANON_CLASS;
595
  }
596
 
597
  if ($strict === false) {
598
- $validScopes[] = T_INTERFACE;
599
-
600
- if (defined('T_TRAIT')) {
601
- // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
602
- $validScopes[] = T_TRAIT;
603
- }
604
  }
605
 
606
  return $phpcsFile->hasCondition($stackPtr, $validScopes);
607
  }
608
 
609
 
610
- /**
611
- * Verify whether a token is within a scoped use statement.
612
- *
613
- * PHPCS cross-version compatibility method.
614
- *
615
- * In PHPCS 1.x no conditions are set for a scoped use statement.
616
- * This method works around that limitation.
617
- *
618
- * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
619
- * @param int $stackPtr The position of the token.
620
- *
621
- * @return bool True if within use scope, false otherwise.
622
- */
623
- public function inUseScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
624
- {
625
- static $isLowPHPCS, $ignoreTokens;
626
-
627
- if (isset($isLowPHPCS) === false) {
628
- $isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.3.0', '<');
629
- }
630
- if (isset($ignoreTokens) === false) {
631
- $ignoreTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
632
- $ignoreTokens[T_STRING] = T_STRING;
633
- $ignoreTokens[T_AS] = T_AS;
634
- $ignoreTokens[T_PUBLIC] = T_PUBLIC;
635
- $ignoreTokens[T_PROTECTED] = T_PROTECTED;
636
- $ignoreTokens[T_PRIVATE] = T_PRIVATE;
637
- }
638
-
639
- // PHPCS 2.0.
640
- if ($isLowPHPCS === false) {
641
- return $phpcsFile->hasCondition($stackPtr, T_USE);
642
- } else {
643
- // PHPCS 1.x.
644
- $tokens = $phpcsFile->getTokens();
645
- $maybeCurlyOpen = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
646
- if ($tokens[$maybeCurlyOpen]['code'] === T_OPEN_CURLY_BRACKET) {
647
- $maybeUseStatement = $phpcsFile->findPrevious($ignoreTokens, ($maybeCurlyOpen - 1), null, true);
648
- if ($tokens[$maybeUseStatement]['code'] === T_USE) {
649
- return true;
650
- }
651
- }
652
- return false;
653
- }
654
- }
655
-
656
-
657
  /**
658
  * Returns the fully qualified class name for a new class instantiation.
659
  *
660
  * Returns an empty string if the class name could not be reliably inferred.
661
  *
 
 
662
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
663
  * @param int $stackPtr The position of a T_NEW token.
664
  *
665
  * @return string
666
  */
667
- public function getFQClassNameFromNewToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
668
  {
669
  $tokens = $phpcsFile->getTokens();
670
 
@@ -673,30 +672,30 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
673
  return '';
674
  }
675
 
676
- if ($tokens[$stackPtr]['code'] !== T_NEW) {
677
  return '';
678
  }
679
 
680
- $start = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
681
  if ($start === false) {
682
  return '';
683
  }
684
 
685
  // Bow out if the next token is a variable as we don't know where it was defined.
686
- if ($tokens[$start]['code'] === T_VARIABLE) {
687
  return '';
688
  }
689
 
690
  // Bow out if the next token is the class keyword.
691
- if ($tokens[$start]['type'] === 'T_ANON_CLASS' || $tokens[$start]['code'] === T_CLASS) {
692
  return '';
693
  }
694
 
695
  $find = array(
696
- T_NS_SEPARATOR,
697
- T_STRING,
698
- T_NAMESPACE,
699
- T_WHITESPACE,
700
  );
701
 
702
  $end = $phpcsFile->findNext($find, ($start + 1), null, true, null, true);
@@ -713,12 +712,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
713
  * Returns an empty string if the class does not extend another class or if
714
  * the class name could not be reliably inferred.
715
  *
 
 
716
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
717
  * @param int $stackPtr The position of a T_CLASS token.
718
  *
719
  * @return string
720
  */
721
- public function getFQExtendedClassName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
722
  {
723
  $tokens = $phpcsFile->getTokens();
724
 
@@ -727,7 +728,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
727
  return '';
728
  }
729
 
730
- if ($tokens[$stackPtr]['code'] !== T_CLASS
731
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
732
  && $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
733
  ) {
@@ -735,7 +736,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
735
  }
736
 
737
  $extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr);
738
- if (empty($extends) || is_string($extends) === false) {
739
  return '';
740
  }
741
 
@@ -749,12 +750,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
749
  *
750
  * Returns an empty string if the class name could not be reliably inferred.
751
  *
 
 
752
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
753
  * @param int $stackPtr The position of a T_NEW token.
754
  *
755
  * @return string
756
  */
757
- public function getFQClassNameFromDoubleColonToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
758
  {
759
  $tokens = $phpcsFile->getTokens();
760
 
@@ -763,23 +766,23 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
763
  return '';
764
  }
765
 
766
- if ($tokens[$stackPtr]['code'] !== T_DOUBLE_COLON) {
767
  return '';
768
  }
769
 
770
  // Nothing to do if previous token is a variable as we don't know where it was defined.
771
- if ($tokens[$stackPtr - 1]['code'] === T_VARIABLE) {
772
  return '';
773
  }
774
 
775
  // Nothing to do if 'parent' or 'static' as we don't know how far the class tree extends.
776
- if (in_array($tokens[$stackPtr - 1]['code'], array(T_PARENT, T_STATIC), true)) {
777
  return '';
778
  }
779
 
780
  // Get the classname from the class declaration if self is used.
781
- if ($tokens[$stackPtr - 1]['code'] === T_SELF) {
782
- $classDeclarationPtr = $phpcsFile->findPrevious(T_CLASS, $stackPtr - 1);
783
  if ($classDeclarationPtr === false) {
784
  return '';
785
  }
@@ -788,10 +791,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
788
  }
789
 
790
  $find = array(
791
- T_NS_SEPARATOR,
792
- T_STRING,
793
- T_NAMESPACE,
794
- T_WHITESPACE,
795
  );
796
 
797
  $start = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true, null, true);
@@ -813,13 +816,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
813
  * Checks if a class/function/constant name is already fully qualified and
814
  * if not, enrich it with the relevant namespace information.
815
  *
 
 
816
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
817
  * @param int $stackPtr The position of the token.
818
  * @param string $name The class / function / constant name.
819
  *
820
  * @return string
821
  */
822
- public function getFQName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $name)
823
  {
824
  if (strpos($name, '\\') === 0) {
825
  // Already fully qualified.
@@ -844,15 +849,20 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
844
  /**
845
  * Is the class/function/constant name namespaced or global ?
846
  *
 
 
847
  * @param string $FQName Fully Qualified name of a class, function etc.
848
  * I.e. should always start with a `\`.
849
  *
850
  * @return bool True if namespaced, false if global.
 
 
 
851
  */
852
  public function isNamespaced($FQName)
853
  {
854
  if (strpos($FQName, '\\') !== 0) {
855
- throw new \PHP_CodeSniffer_Exception('$FQName must be a fully qualified name');
856
  }
857
 
858
  return (strpos(substr($FQName, 1), '\\') !== false);
@@ -862,12 +872,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
862
  /**
863
  * Determine the namespace name an arbitrary token lives in.
864
  *
 
 
865
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
866
  * @param int $stackPtr The token position for which to determine the namespace.
867
  *
868
  * @return string Namespace name or empty string if it couldn't be determined or no namespace applies.
869
  */
870
- public function determineNamespace(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
871
  {
872
  $tokens = $phpcsFile->getTokens();
873
 
@@ -878,7 +890,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
878
 
879
  // Check for scoped namespace {}.
880
  if (empty($tokens[$stackPtr]['conditions']) === false) {
881
- $namespacePtr = $phpcsFile->getCondition($stackPtr, T_NAMESPACE);
882
  if ($namespacePtr !== false) {
883
  $namespace = $this->getDeclaredNamespaceName($phpcsFile, $namespacePtr);
884
  if ($namespace !== false) {
@@ -900,7 +912,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
900
  $previousNSToken = $stackPtr;
901
  $namespace = false;
902
  do {
903
- $previousNSToken = $phpcsFile->findPrevious(T_NAMESPACE, ($previousNSToken - 1));
904
 
905
  // Stop if we encounter a scoped namespace declaration as we already know we're not in one.
906
  if (empty($tokens[$previousNSToken]['scope_condition']) === false && $tokens[$previousNSToken]['scope_condition'] === $previousNSToken) {
@@ -925,13 +937,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
925
  * For hierarchical namespaces, the name will be composed of several tokens,
926
  * i.e. MyProject\Sub\Level which will be returned together as one string.
927
  *
 
 
928
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
929
  * @param int|bool $stackPtr The position of a T_NAMESPACE token.
930
  *
931
  * @return string|false Namespace name or false if not a namespace declaration.
932
  * Namespace name can be an empty string for global namespace declaration.
933
  */
934
- public function getDeclaredNamespaceName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
935
  {
936
  $tokens = $phpcsFile->getTokens();
937
 
@@ -940,27 +954,29 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
940
  return false;
941
  }
942
 
943
- if ($tokens[$stackPtr]['code'] !== T_NAMESPACE) {
944
  return false;
945
  }
946
 
947
- if ($tokens[($stackPtr + 1)]['code'] === T_NS_SEPARATOR) {
948
- // Not a namespace declaration, but use of, i.e. namespace\someFunction();
949
  return false;
950
  }
951
 
952
- $nextToken = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
953
- if ($tokens[$nextToken]['code'] === T_OPEN_CURLY_BRACKET) {
954
- // Declaration for global namespace when using multiple namespaces in a file.
955
- // I.e.: namespace {}
 
 
956
  return '';
957
  }
958
 
959
  // Ok, this should be a namespace declaration, so get all the parts together.
960
  $validTokens = array(
961
- T_STRING => true,
962
- T_NS_SEPARATOR => true,
963
- T_WHITESPACE => true,
964
  );
965
 
966
  $namespaceName = '';
@@ -981,6 +997,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
981
  *
982
  * Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token.
983
  *
 
 
984
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
985
  * @param int $stackPtr The position of the token.
986
  *
@@ -988,15 +1006,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
988
  * no return type was found or the passed token was
989
  * not of the correct type.
990
  */
991
- public function getReturnTypeHintToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
992
  {
993
  $tokens = $phpcsFile->getTokens();
994
 
995
- if (defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === T_RETURN_TYPE) {
996
  return $stackPtr;
997
  }
998
 
999
- if ($tokens[$stackPtr]['code'] !== T_FUNCTION && $tokens[$stackPtr]['code'] !== T_CLOSURE) {
1000
  return false;
1001
  }
1002
 
@@ -1009,7 +1027,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1009
  if (isset($tokens[$stackPtr]['scope_opener'])) {
1010
  $endOfFunctionDeclaration = $tokens[$stackPtr]['scope_opener'];
1011
  } else {
1012
- $nextSemiColon = $phpcsFile->findNext(T_SEMICOLON, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, false, null, true);
1013
  if ($nextSemiColon !== false) {
1014
  $endOfFunctionDeclaration = $nextSemiColon;
1015
  }
@@ -1020,7 +1038,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1020
  }
1021
 
1022
  $hasColon = $phpcsFile->findNext(
1023
- array(T_COLON, T_INLINE_ELSE),
1024
  ($tokens[$stackPtr]['parenthesis_closer'] + 1),
1025
  $endOfFunctionDeclaration
1026
  );
@@ -1038,11 +1056,11 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1038
  * As of PHPCS 3.3.0 `array` as a type declaration will be tokenized as `T_STRING`.
1039
  */
1040
  $unrecognizedTypes = array(
1041
- T_CALLABLE,
1042
- T_SELF,
1043
- T_PARENT,
1044
- T_ARRAY, // PHPCS < 2.4.0.
1045
- T_STRING,
1046
  );
1047
 
1048
  return $phpcsFile->findPrevious($unrecognizedTypes, ($endOfFunctionDeclaration - 1), $hasColon);
@@ -1062,31 +1080,31 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1062
  * Expects to be passed a T_RETURN_TYPE token or the return value from a call to
1063
  * the Sniff::getReturnTypeHintToken() method.
1064
  *
 
 
1065
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1066
  * @param int $stackPtr The position of the return type token.
1067
  *
1068
- * @return string|false The name of the return type token.
1069
  */
1070
- public function getReturnTypeHintName(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1071
  {
1072
  $tokens = $phpcsFile->getTokens();
1073
 
1074
  // In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE.
1075
- $colon = $phpcsFile->findPrevious(array(T_COLON, T_INLINE_ELSE, T_FUNCTION, T_CLOSE_PARENTHESIS), ($stackPtr - 1));
1076
  if ($colon === false
1077
- || ($tokens[$colon]['code'] !== T_COLON && $tokens[$colon]['code'] !== T_INLINE_ELSE)
1078
  ) {
1079
  // Shouldn't happen, just in case.
1080
- return;
1081
  }
1082
 
1083
- $emptyTokens = array_flip(\PHP_CodeSniffer_Tokens::$emptyTokens); // PHPCS 1.x compat.
1084
-
1085
  $returnTypeHint = '';
1086
  for ($i = ($colon + 1); $i <= $stackPtr; $i++) {
1087
  // As of PHPCS 3.3.0+, all tokens are tokenized as "normal", so T_CALLABLE, T_SELF etc are
1088
  // all possible, just exclude anything that's regarded as empty and the nullable indicator.
1089
- if (isset($emptyTokens[$tokens[$i]['code']])) {
1090
  continue;
1091
  }
1092
 
@@ -1094,7 +1112,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1094
  continue;
1095
  }
1096
 
1097
- if (defined('T_NULLABLE') === false && $tokens[$i]['code'] === T_INLINE_THEN) {
1098
  // Old PHPCS.
1099
  continue;
1100
  }
@@ -1114,17 +1132,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1114
  * anonymous classes. Along the same lines, the`getMemberProperties()`
1115
  * method does not support the `var` prefix.
1116
  *
 
 
1117
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1118
  * @param int $stackPtr The position in the stack of the
1119
  * T_VARIABLE token to verify.
1120
  *
1121
  * @return bool
1122
  */
1123
- public function isClassProperty(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1124
  {
1125
  $tokens = $phpcsFile->getTokens();
1126
 
1127
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== T_VARIABLE) {
1128
  return false;
1129
  }
1130
 
@@ -1134,10 +1154,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1134
  'T_ANON_CLASS' => true,
1135
  'T_TRAIT' => true,
1136
  );
1137
- if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) === true) {
 
 
1138
  // Make sure it's not a method parameter.
1139
  if (empty($tokens[$stackPtr]['nested_parenthesis']) === true) {
1140
  return true;
 
 
 
 
 
 
 
 
 
1141
  }
1142
  }
1143
 
@@ -1148,17 +1179,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1148
  /**
1149
  * Check whether a T_CONST token is a class constant declaration.
1150
  *
 
 
1151
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1152
  * @param int $stackPtr The position in the stack of the
1153
  * T_CONST token to verify.
1154
  *
1155
  * @return bool
1156
  */
1157
- public function isClassConstant(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1158
  {
1159
  $tokens = $phpcsFile->getTokens();
1160
 
1161
- if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== T_CONST) {
1162
  return false;
1163
  }
1164
 
@@ -1168,7 +1201,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1168
  'T_ANON_CLASS' => true,
1169
  'T_INTERFACE' => true,
1170
  );
1171
- if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) === true) {
1172
  return true;
1173
  }
1174
 
@@ -1182,17 +1215,19 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1182
  *
1183
  * Used to check, for instance, if a T_CONST is a class constant.
1184
  *
 
 
1185
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1186
  * @param int $stackPtr The position in the stack of the
1187
- * T_CONST token to verify.
1188
  * @param array $validScopes Array of token types.
1189
  * Keys should be the token types in string
1190
  * format to allow for newer token types.
1191
  * Value is irrelevant.
1192
  *
1193
- * @return bool
1194
  */
1195
- protected function validDirectScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $validScopes)
1196
  {
1197
  $tokens = $phpcsFile->getTokens();
1198
 
@@ -1211,7 +1246,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1211
  }
1212
 
1213
  if (isset($validScopes[$tokens[$ptr]['type']]) === true) {
1214
- return true;
1215
  }
1216
 
1217
  return false;
@@ -1226,6 +1261,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1226
  * Strips potential nullable indicator and potential global namespace
1227
  * indicator from the type hints before returning them.
1228
  *
 
 
1229
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1230
  * @param int $stackPtr The position of the token.
1231
  *
@@ -1234,16 +1271,16 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1234
  * - no type hints were found
1235
  * - or the passed token was not of the correct type.
1236
  */
1237
- public function getTypeHintsFromFunctionDeclaration(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1238
  {
1239
  $tokens = $phpcsFile->getTokens();
1240
 
1241
- if ($tokens[$stackPtr]['code'] !== T_FUNCTION && $tokens[$stackPtr]['code'] !== T_CLOSURE) {
1242
  return array();
1243
  }
1244
 
1245
  $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
1246
- if (empty($parameters) || is_array($parameters) === false) {
1247
  return array();
1248
  }
1249
 
@@ -1272,13 +1309,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1272
  /**
1273
  * Get the hash algorithm name from the parameter in a hash function call.
1274
  *
 
 
1275
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1276
  * @param int $stackPtr The position of the T_STRING function token.
1277
  *
1278
  * @return string|false The algorithm name without quotes if this was a relevant hash
1279
  * function call or false if it was not.
1280
  */
1281
- public function getHashAlgorithmParameter(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1282
  {
1283
  $tokens = $phpcsFile->getTokens();
1284
 
@@ -1287,7 +1326,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1287
  return false;
1288
  }
1289
 
1290
- if ($tokens[$stackPtr]['code'] !== T_STRING) {
1291
  return false;
1292
  }
1293
 
@@ -1316,12 +1355,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1316
  /**
1317
  * Determine whether an arbitrary T_STRING token is the use of a global constant.
1318
  *
 
 
1319
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1320
- * @param int $stackPtr The position of the function call token.
1321
  *
1322
  * @return bool
1323
  */
1324
- public function isUseOfGlobalConstant(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1325
  {
1326
  static $isLowPHPCS, $isLowPHP;
1327
 
@@ -1333,7 +1374,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1333
  }
1334
 
1335
  // Is this one of the tokens this function handles ?
1336
- if ($tokens[$stackPtr]['code'] !== T_STRING) {
1337
  return false;
1338
  }
1339
 
@@ -1341,16 +1382,16 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1341
  if (isset($isLowPHPCS, $isLowPHP) === false) {
1342
  $isLowPHP = false;
1343
  $isLowPHPCS = false;
1344
- if (version_compare(PHP_VERSION_ID, '50400', '<')) {
1345
  $isLowPHP = true;
1346
  $isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.4.0', '<');
1347
  }
1348
  }
1349
 
1350
- $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
1351
  if ($next !== false
1352
- && ($tokens[$next]['code'] === T_OPEN_PARENTHESIS
1353
- || $tokens[$next]['code'] === T_DOUBLE_COLON)
1354
  ) {
1355
  // Function call or declaration.
1356
  return false;
@@ -1378,10 +1419,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1378
  'T_PRIVATE' => true,
1379
  );
1380
 
1381
- $prev = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
1382
  if ($prev !== false
1383
  && (isset($tokensToIgnore[$tokens[$prev]['type']]) === true
1384
- || ($tokens[$prev]['code'] === T_STRING
1385
  && (($isLowPHPCS === true
1386
  && $tokens[$prev]['content'] === 'trait')
1387
  || ($isLowPHP === true
@@ -1392,15 +1433,15 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1392
  }
1393
 
1394
  if ($prev !== false
1395
- && $tokens[$prev]['code'] === T_NS_SEPARATOR
1396
- && $tokens[($prev - 1)]['code'] === T_STRING
1397
  ) {
1398
  // Namespaced constant of the same name.
1399
  return false;
1400
  }
1401
 
1402
  if ($prev !== false
1403
- && $tokens[$prev]['code'] === T_CONST
1404
  && $this->isClassConstant($phpcsFile, $prev) === true
1405
  ) {
1406
  // Class constant declaration of the same name.
@@ -1416,14 +1457,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1416
  }
1417
  }
1418
 
1419
- $firstOnLine = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($i + 1), null, true);
1420
- if ($firstOnLine !== false && $tokens[$firstOnLine]['code'] === T_USE) {
1421
- $nextOnLine = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($firstOnLine + 1), null, true);
1422
  if ($nextOnLine !== false) {
1423
- if (($tokens[$nextOnLine]['code'] === T_STRING && $tokens[$nextOnLine]['content'] === 'const')
1424
- || $tokens[$nextOnLine]['code'] === T_CONST // Happens in some PHPCS versions.
1425
  ) {
1426
- $hasNsSep = $phpcsFile->findNext(T_NS_SEPARATOR, ($nextOnLine + 1), $stackPtr);
1427
  if ($hasNsSep !== false) {
1428
  // Namespaced const (group) use statement.
1429
  return false;
@@ -1448,6 +1489,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1448
  *
1449
  * Note: Zero is *not* regarded as a positive number.
1450
  *
 
 
1451
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1452
  * @param int $start Start of the snippet (inclusive), i.e. this
1453
  * token will be examined as part of the snippet.
@@ -1459,7 +1502,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1459
  * False if not or if it could not be reliably determined
1460
  * (variable or calculations and such).
1461
  */
1462
- public function isPositiveNumber(\PHP_CodeSniffer_File $phpcsFile, $start, $end, $allowFloats = false)
1463
  {
1464
  $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
1465
 
@@ -1480,6 +1523,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1480
  *
1481
  * Note: Zero is *not* regarded as a negative number.
1482
  *
 
 
1483
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1484
  * @param int $start Start of the snippet (inclusive), i.e. this
1485
  * token will be examined as part of the snippet.
@@ -1491,7 +1536,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1491
  * False if not or if it could not be reliably determined
1492
  * (variable or calculations and such).
1493
  */
1494
- public function isNegativeNumber(\PHP_CodeSniffer_File $phpcsFile, $start, $end, $allowFloats = false)
1495
  {
1496
  $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
1497
 
@@ -1500,7 +1545,6 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1500
  }
1501
 
1502
  return ($number < 0);
1503
-
1504
  }
1505
 
1506
  /**
@@ -1515,6 +1559,8 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1515
  * Mainly intended for examining variable assignments, function call parameters, array values
1516
  * where the start and end of the snippet to examine is very clear.
1517
  *
 
 
1518
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1519
  * @param int $start Start of the snippet (inclusive), i.e. this
1520
  * token will be examined as part of the snippet.
@@ -1529,19 +1575,18 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1529
  * number or if it could not be reliably determined
1530
  * (variable or calculations and such).
1531
  */
1532
- protected function isNumber(\PHP_CodeSniffer_File $phpcsFile, $start, $end, $allowFloats = false)
1533
  {
1534
- $stringTokens = array_flip(\PHP_CodeSniffer_Tokens::$heredocTokens); // Flipping for PHPCS 1.x compat.
1535
- $stringTokens += array_flip(\PHP_CodeSniffer_Tokens::$stringTokens); // Flipping for PHPCS 1.x compat.
1536
 
1537
- $validTokens = array();
1538
- $validTokens[T_LNUMBER] = true;
1539
- $validTokens[T_TRUE] = true; // Evaluates to int 1.
1540
- $validTokens[T_FALSE] = true; // Evaluates to int 0.
1541
- $validTokens[T_NULL] = true; // Evaluates to int 0.
1542
 
1543
  if ($allowFloats === true) {
1544
- $validTokens[T_DNUMBER] = true;
1545
  }
1546
 
1547
  $maybeValidTokens = $stringTokens + $validTokens;
@@ -1554,17 +1599,17 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1554
  return false;
1555
  }
1556
 
1557
- $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $start, $searchEnd, true);
1558
  while ($nextNonEmpty !== false
1559
- && ($tokens[$nextNonEmpty]['code'] === T_PLUS
1560
- || $tokens[$nextNonEmpty]['code'] === T_MINUS)
1561
  ) {
1562
 
1563
- if ($tokens[$nextNonEmpty]['code'] === T_MINUS) {
1564
  $negativeNumber = ($negativeNumber === false) ? true : false;
1565
  }
1566
 
1567
- $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
1568
  }
1569
 
1570
  if ($nextNonEmpty === false || isset($maybeValidTokens[$tokens[$nextNonEmpty]['code']]) === false) {
@@ -1572,23 +1617,23 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1572
  }
1573
 
1574
  $content = false;
1575
- if ($tokens[$nextNonEmpty]['code'] === T_LNUMBER
1576
- || $tokens[$nextNonEmpty]['code'] === T_DNUMBER
1577
  ) {
1578
  $content = (float) $tokens[$nextNonEmpty]['content'];
1579
- } elseif ($tokens[$nextNonEmpty]['code'] === T_TRUE) {
1580
  $content = 1.0;
1581
- } elseif ($tokens[$nextNonEmpty]['code'] === T_FALSE
1582
- || $tokens[$nextNonEmpty]['code'] === T_NULL
1583
  ) {
1584
  $content = 0.0;
1585
  } elseif (isset($stringTokens[$tokens[$nextNonEmpty]['code']]) === true) {
1586
 
1587
- if ($tokens[$nextNonEmpty]['code'] === T_START_HEREDOC
1588
- || $tokens[$nextNonEmpty]['code'] === T_START_NOWDOC
1589
  ) {
1590
  // Skip past heredoc/nowdoc opener to the first content.
1591
- $firstDocToken = $phpcsFile->findNext(array(T_HEREDOC, T_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
1592
  if ($firstDocToken === false) {
1593
  // Live coding or parse error.
1594
  return false;
@@ -1597,7 +1642,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1597
  $stringContent = $content = $tokens[$firstDocToken]['content'];
1598
 
1599
  // Skip forward to the end in preparation for the next part of the examination.
1600
- $nextNonEmpty = $phpcsFile->findNext(array(T_END_HEREDOC, T_END_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
1601
  if ($nextNonEmpty === false) {
1602
  // Live coding or parse error.
1603
  return false;
@@ -1618,7 +1663,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1618
 
1619
  /*
1620
  * Regexes based on the formats outlined in the manual, created by JRF.
1621
- * @link http://php.net/manual/en/language.types.float.php
1622
  */
1623
  $regexInt = '`^\s*[0-9]+`';
1624
  $regexFloat = '`^\s*(?:[+-]?(?:(?:(?P<LNUM>[0-9]+)|(?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*)))[eE][+-]?(?P>LNUM))|(?P>DNUM))`';
@@ -1655,7 +1700,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1655
  // use that to get the numeric value if possible.
1656
  // If the filter extension is not available, the value will be zero, but so be it.
1657
  if (function_exists('filter_var')) {
1658
- $filtered = filter_var($hexNumberString[1], FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
1659
  if ($filtered !== false) {
1660
  $content = $filtered;
1661
  }
@@ -1664,7 +1709,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1664
  }
1665
 
1666
  // OK, so we have a number, now is there still more code after it ?
1667
- $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
1668
  if ($nextNonEmpty !== false) {
1669
  return false;
1670
  }
@@ -1681,18 +1726,147 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1681
  }
1682
 
1683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1684
  /**
1685
  * Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct.
1686
  *
1687
  * Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays.
1688
  * In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET.
1689
  *
 
 
1690
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1691
  * @param int $stackPtr The position of the function call token.
1692
  *
1693
  * @return bool
1694
  */
1695
- public function isShortList(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1696
  {
1697
  $tokens = $phpcsFile->getTokens();
1698
 
@@ -1702,21 +1876,21 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1702
  }
1703
 
1704
  // Is this one of the tokens this function handles ?
1705
- if ($tokens[$stackPtr]['code'] !== T_OPEN_SHORT_ARRAY
1706
- && $tokens[$stackPtr]['code'] !== T_CLOSE_SHORT_ARRAY
1707
  ) {
1708
  return false;
1709
  }
1710
 
1711
  switch ($tokens[$stackPtr]['code']) {
1712
- case T_OPEN_SHORT_ARRAY:
1713
  if (isset($tokens[$stackPtr]['bracket_closer']) === true) {
1714
  $opener = $stackPtr;
1715
  $closer = $tokens[$stackPtr]['bracket_closer'];
1716
  }
1717
  break;
1718
 
1719
- case T_CLOSE_SHORT_ARRAY:
1720
  if (isset($tokens[$stackPtr]['bracket_opener']) === true) {
1721
  $opener = $tokens[$stackPtr]['bracket_opener'];
1722
  $closer = $stackPtr;
@@ -1733,21 +1907,14 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1733
  * PHPCS cross-version compatibility: work around for square brackets misidentified
1734
  * as short array when preceded by a variable variable in older PHPCS versions.
1735
  */
1736
- $prevNonEmpty = $phpcsFile->findPrevious(
1737
- \PHP_CodeSniffer_Tokens::$emptyTokens,
1738
- ($opener - 1),
1739
- null,
1740
- true,
1741
- null,
1742
- true
1743
- );
1744
 
1745
  if ($prevNonEmpty !== false
1746
- && $tokens[$prevNonEmpty]['code'] === T_CLOSE_CURLY_BRACKET
1747
  && isset($tokens[$prevNonEmpty]['bracket_opener']) === true
1748
  ) {
1749
  $maybeVariableVariable = $phpcsFile->findPrevious(
1750
- \PHP_CodeSniffer_Tokens::$emptyTokens,
1751
  ($tokens[$prevNonEmpty]['bracket_opener'] - 1),
1752
  null,
1753
  true,
@@ -1755,34 +1922,27 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1755
  true
1756
  );
1757
 
1758
- if ($tokens[$maybeVariableVariable]['code'] === T_VARIABLE
1759
- || $tokens[$maybeVariableVariable]['code'] === T_DOLLAR
1760
  ) {
1761
  return false;
1762
  }
1763
  }
1764
 
1765
- $nextNonEmpty = $phpcsFile->findNext(
1766
- \PHP_CodeSniffer_Tokens::$emptyTokens,
1767
- ($closer + 1),
1768
- null,
1769
- true,
1770
- null,
1771
- true
1772
- );
1773
 
1774
- if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_EQUAL) {
1775
  return true;
1776
  }
1777
 
1778
  if ($prevNonEmpty !== false
1779
- && $tokens[$prevNonEmpty]['code'] === T_AS
1780
  && isset($tokens[$prevNonEmpty]['nested_parenthesis']) === true
1781
  ) {
1782
  $parentheses = array_reverse($tokens[$prevNonEmpty]['nested_parenthesis'], true);
1783
  foreach ($parentheses as $open => $close) {
1784
  if (isset($tokens[$open]['parenthesis_owner'])
1785
- && $tokens[$tokens[$open]['parenthesis_owner']]['code'] === T_FOREACH
1786
  ) {
1787
  return true;
1788
  }
@@ -1793,7 +1953,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1793
  $parentOpener = $opener;
1794
  do {
1795
  $parentOpener = $phpcsFile->findPrevious(
1796
- array(T_OPEN_SHORT_ARRAY, T_OPEN_SQUARE_BRACKET),
1797
  ($parentOpener - 1),
1798
  null,
1799
  false,
@@ -1816,10 +1976,10 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1816
  $phpcsVersion = PHPCSHelper::getVersion();
1817
  if ((version_compare($phpcsVersion, '2.0', '>') === true
1818
  && version_compare($phpcsVersion, '2.8', '<') === true)
1819
- && $tokens[$parentOpener]['code'] === T_OPEN_SQUARE_BRACKET
1820
  ) {
1821
  $nextNonEmpty = $phpcsFile->findNext(
1822
- \PHP_CodeSniffer_Tokens::$emptyTokens,
1823
  ($tokens[$parentOpener]['bracket_closer'] + 1),
1824
  null,
1825
  true,
@@ -1827,7 +1987,7 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1827
  true
1828
  );
1829
 
1830
- if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_EQUAL) {
1831
  return true;
1832
  }
1833
 
@@ -1839,4 +1999,269 @@ abstract class Sniff implements \PHP_CodeSniffer_Sniff
1839
 
1840
  return false;
1841
  }
1842
- }//end class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility;
12
 
13
  use PHPCompatibility\PHPCSHelper;
14
+ use PHP_CodeSniffer_Exception as PHPCS_Exception;
15
+ use PHP_CodeSniffer_File as File;
16
+ use PHP_CodeSniffer_Sniff as PHPCS_Sniff;
17
+ use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
+ * Base class from which all PHPCompatibility sniffs extend.
21
  *
22
+ * @since 5.6
 
 
 
23
  */
24
+ abstract class Sniff implements PHPCS_Sniff
25
  {
26
 
27
+ /**
28
+ * Regex to match variables in a double quoted string.
29
+ *
30
+ * This matches plain variables, but also more complex variables, such
31
+ * as $obj->prop, self::prop and $var[].
32
+ *
33
+ * @since 7.1.2
34
+ *
35
+ * @var string
36
+ */
37
  const REGEX_COMPLEX_VARS = '`(?:(\{)?(?<!\\\\)\$)?(\{)?(?<!\\\\)\$(\{)?(?P<varname>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(?:->\$?(?P>varname)|\[[^\]]+\]|::\$?(?P>varname)|\([^\)]*\))*(?(3)\}|)(?(2)\}|)(?(1)\}|)`';
38
 
39
  /**
40
  * List of superglobals as an array of strings.
41
  *
42
+ * Used by the ForbiddenParameterShadowSuperGlobals and ForbiddenClosureUseVariableNames sniffs.
43
+ *
44
+ * @since 7.0.0
45
+ * @since 7.1.4 Moved from the `ForbiddenParameterShadowSuperGlobals` sniff to the base `Sniff` class.
46
  *
47
  * @var array
48
  */
49
  protected $superglobals = array(
50
+ '$GLOBALS' => true,
51
+ '$_SERVER' => true,
52
+ '$_GET' => true,
53
+ '$_POST' => true,
54
+ '$_FILES' => true,
55
+ '$_COOKIE' => true,
56
+ '$_SESSION' => true,
57
+ '$_REQUEST' => true,
58
+ '$_ENV' => true,
59
  );
60
 
61
  /**
64
  * Used by the new/removed hash algorithm sniffs.
65
  * Key is the function name, value is the 1-based parameter position in the function call.
66
  *
67
+ * @since 5.5
68
+ * @since 7.0.7 Moved from the `RemovedHashAlgorithms` sniff to the base `Sniff` class.
69
+ *
70
  * @var array
71
  */
72
  protected $hashAlgoFunctions = array(
85
  * Used by the new/removed ini directives sniffs.
86
  * Key is the function name, value is the 1-based parameter position in the function call.
87
  *
88
+ * @since 7.1.0
89
+ *
90
  * @var array
91
  */
92
  protected $iniFunctions = array(
113
  * PHP version numbers should always be in Major.Minor format. Both "5", "5.3.2"
114
  * would be treated as invalid, and ignored.
115
  *
116
+ * @since 7.0.0
117
+ * @since 7.1.3 Now allows for partial ranges such as `5.2-`.
118
+ *
119
  * @return array $arrTestVersions will hold an array containing min/max version
120
  * of PHP that we are checking against (see above). If only a
121
  * single version number is specified, then this is used as
154
  if (version_compare($min, $max, '>')) {
155
  trigger_error(
156
  "Invalid range in testVersion setting: '" . $testVersion . "'",
157
+ \E_USER_WARNING
158
  );
159
  return $default;
160
  } else {
166
 
167
  trigger_error(
168
  "Invalid testVersion setting: '" . $testVersion . "'",
169
+ \E_USER_WARNING
170
  );
171
  return $default;
172
  }
185
  *
186
  * Should be used when sniffing for *old* PHP features (deprecated/removed).
187
  *
188
+ * @since 5.6
189
+ *
190
  * @param string $phpVersion A PHP version number in 'major.minor' format.
191
  *
192
  * @return bool True if testVersion has not been provided or if the PHP version
198
  $testVersion = $this->getTestVersion();
199
  $testVersion = $testVersion[1];
200
 
201
+ if (\is_null($testVersion)
202
  || version_compare($testVersion, $phpVersion) >= 0
203
  ) {
204
  return true;
205
  } else {
206
  return false;
207
  }
208
+ }
209
 
210
 
211
  /**
214
  *
215
  * Should be used when sniffing for *new* PHP features.
216
  *
217
+ * @since 5.6
218
+ *
219
  * @param string $phpVersion A PHP version number in 'major.minor' format.
220
  *
221
  * @return bool True if the PHP version is equal to or lower than the lowest
227
  $testVersion = $this->getTestVersion();
228
  $testVersion = $testVersion[0];
229
 
230
+ if (\is_null($testVersion) === false
231
  && version_compare($testVersion, $phpVersion) <= 0
232
  ) {
233
  return true;
234
  } else {
235
  return false;
236
  }
237
+ }
238
 
239
 
240
  /**
241
  * Add a PHPCS message to the output stack as either a warning or an error.
242
  *
243
+ * @since 7.1.0
244
+ *
245
  * @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to.
246
  * @param string $message The message.
247
  * @param int $stackPtr The position of the token
255
  *
256
  * @return void
257
  */
258
+ public function addMessage(File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array())
259
  {
260
  if ($isError === true) {
261
  $phpcsFile->addError($message, $stackPtr, $code, $data);
270
  *
271
  * Pre-empt issues with arbitrary strings being used as error codes in XML and PHP.
272
  *
273
+ * @since 7.1.0
274
+ *
275
  * @param string $baseString Arbitrary string.
276
  *
277
  * @return string
287
  *
288
  * Intended for use with the contents of a T_CONSTANT_ENCAPSED_STRING / T_DOUBLE_QUOTED_STRING.
289
  *
290
+ * @since 7.0.6
291
+ *
292
  * @param string $string The raw string.
293
  *
294
  * @return string String without quotes around it.
304
  *
305
  * Intended for use with the contents of a T_DOUBLE_QUOTED_STRING.
306
  *
307
+ * @since 7.1.2
308
+ *
309
  * @param string $string The raw string.
310
  *
311
  * @return string String without variables in it.
323
  /**
324
  * Make all top level array keys in an array lowercase.
325
  *
326
+ * @since 7.1.0
327
+ *
328
  * @param array $array Initial array.
329
  *
330
  * @return array Same array, but with all lowercase top level keys.
331
  */
332
  public function arrayKeysToLowercase($array)
333
  {
334
+ return array_change_key_case($array, \CASE_LOWER);
 
 
335
  }
336
 
337
 
338
  /**
339
  * Checks if a function call has parameters.
340
  *
341
+ * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
342
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
343
  *
344
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it
347
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/120
348
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/152
349
  *
350
+ * @since 7.0.3
351
+ *
352
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
353
  * @param int $stackPtr The position of the function call token.
354
  *
355
  * @return bool
356
  */
357
+ public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr)
358
  {
359
  $tokens = $phpcsFile->getTokens();
360
 
364
  }
365
 
366
  // Is this one of the tokens this function handles ?
367
+ if (\in_array($tokens[$stackPtr]['code'], array(\T_STRING, \T_ARRAY, \T_OPEN_SHORT_ARRAY, \T_VARIABLE), true) === false) {
368
  return false;
369
  }
370
 
371
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
372
 
373
  // Deal with short array syntax.
374
+ if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
375
  if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
376
  return false;
377
  }
386
 
387
  // Deal with function calls & long arrays.
388
  // Next non-empty token should be the open parenthesis.
389
+ if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
390
  return false;
391
  }
392
 
395
  }
396
 
397
  $closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
398
+ $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true);
399
 
400
  if ($nextNextNonEmpty === $closeParenthesis) {
401
  // No parameters.
409
  /**
410
  * Count the number of parameters a function call has been passed.
411
  *
412
+ * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
413
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
414
  *
415
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
419
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/114
420
  * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/151
421
  *
422
+ * @since 7.0.3
423
+ *
424
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
425
  * @param int $stackPtr The position of the function call token.
426
  *
427
  * @return int
428
  */
429
+ public function getFunctionCallParameterCount(File $phpcsFile, $stackPtr)
430
  {
431
  if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
432
  return 0;
433
  }
434
 
435
+ return \count($this->getFunctionCallParameters($phpcsFile, $stackPtr));
436
  }
437
 
438
 
439
  /**
440
  * Get information on all parameters passed to a function call.
441
  *
442
+ * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
443
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
444
  *
445
  * Will return an multi-dimentional array with the start token pointer, end token
449
  * Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer,
450
  * it will tokenize the values / key/value pairs contained in the array call.
451
  *
452
+ * @since 7.0.5 Split off from the `getFunctionCallParameterCount()` method.
453
+ *
454
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
455
  * @param int $stackPtr The position of the function call token.
456
  *
457
  * @return array
458
  */
459
+ public function getFunctionCallParameters(File $phpcsFile, $stackPtr)
460
  {
461
  if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) {
462
  return array();
463
  }
464
 
465
+ // Ok, we know we have a T_STRING, T_VARIABLE, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters
466
  // and valid open & close brackets/parenthesis.
467
  $tokens = $phpcsFile->getTokens();
468
 
469
  // Mark the beginning and end tokens.
470
+ if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
471
  $opener = $stackPtr;
472
  $closer = $tokens[$stackPtr]['bracket_closer'];
473
 
474
  $nestedParenthesisCount = 0;
475
 
476
  } else {
477
+ $opener = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
478
  $closer = $tokens[$opener]['parenthesis_closer'];
479
 
480
  $nestedParenthesisCount = 1;
482
 
483
  // Which nesting level is the one we are interested in ?
484
  if (isset($tokens[$opener]['nested_parenthesis'])) {
485
+ $nestedParenthesisCount += \count($tokens[$opener]['nested_parenthesis']);
486
  }
487
 
488
  $parameters = array();
489
  $nextComma = $opener;
490
  $paramStart = $opener + 1;
491
  $cnt = 1;
492
+ while (($nextComma = $phpcsFile->findNext(array(\T_COMMA, $tokens[$closer]['code'], \T_OPEN_SHORT_ARRAY, \T_CLOSURE), $nextComma + 1, $closer + 1)) !== false) {
493
  // Ignore anything within short array definition brackets.
494
  if ($tokens[$nextComma]['type'] === 'T_OPEN_SHORT_ARRAY'
495
  && (isset($tokens[$nextComma]['bracket_opener'])
515
  // Ignore comma's at a lower nesting level.
516
  if ($tokens[$nextComma]['type'] === 'T_COMMA'
517
  && isset($tokens[$nextComma]['nested_parenthesis'])
518
+ && \count($tokens[$nextComma]['nested_parenthesis']) !== $nestedParenthesisCount
519
  ) {
520
  continue;
521
  }
530
  $parameters[$cnt]['end'] = $nextComma - 1;
531
  $parameters[$cnt]['raw'] = trim($phpcsFile->getTokensAsString($paramStart, ($nextComma - $paramStart)));
532
 
533
+ /*
534
+ * Check if there are more tokens before the closing parenthesis.
535
+ * Prevents code like the following from setting a third parameter:
536
+ * `functionCall( $param1, $param2, );`.
537
+ */
538
+ $hasNextParam = $phpcsFile->findNext(Tokens::$emptyTokens, $nextComma + 1, $closer, true, null, true);
539
  if ($hasNextParam === false) {
540
  break;
541
  }
552
  /**
553
  * Get information on a specific parameter passed to a function call.
554
  *
555
+ * Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
556
  * If passed a T_STRING which is *not* a function call, the behaviour is unreliable.
557
  *
558
  * Will return a array with the start token pointer, end token pointer and the raw value
559
  * of the parameter at a specific offset.
560
  * If the specified parameter is not found, will return false.
561
  *
562
+ * @since 7.0.5
563
+ *
564
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
565
  * @param int $stackPtr The position of the function call token.
566
  * @param int $paramOffset The 1-based index position of the parameter to retrieve.
567
  *
568
  * @return array|false
569
  */
570
+ public function getFunctionCallParameter(File $phpcsFile, $stackPtr, $paramOffset)
571
  {
572
  $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
573
 
586
  * will check that the token has at least one condition which is of a
587
  * type defined in $validScopes.
588
  *
589
+ * @since 7.0.5 Largely split off from the `inClassScope()` method.
590
+ *
591
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
592
  * @param int $stackPtr The position of the token.
593
  * @param array|int $validScopes Optional. Array of valid scopes
599
  * If the $scopeTypes are set: True if *one* of the conditions is a
600
  * valid scope, false otherwise.
601
  */
602
+ public function tokenHasScope(File $phpcsFile, $stackPtr, $validScopes = null)
603
  {
604
  $tokens = $phpcsFile->getTokens();
605
 
625
  /**
626
  * Verify whether a token is within a class scope.
627
  *
628
+ * @since 7.0.3
629
+ *
630
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
631
  * @param int $stackPtr The position of the token.
632
  * @param bool $strict Whether to strictly check for the T_CLASS
635
  *
636
  * @return bool True if within class scope, false otherwise.
637
  */
638
+ public function inClassScope(File $phpcsFile, $stackPtr, $strict = true)
639
  {
640
+ $validScopes = array(\T_CLASS);
641
+ if (\defined('T_ANON_CLASS') === true) {
642
+ $validScopes[] = \T_ANON_CLASS;
643
  }
644
 
645
  if ($strict === false) {
646
+ $validScopes[] = \T_INTERFACE;
647
+ $validScopes[] = \T_TRAIT;
 
 
 
 
648
  }
649
 
650
  return $phpcsFile->hasCondition($stackPtr, $validScopes);
651
  }
652
 
653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
654
  /**
655
  * Returns the fully qualified class name for a new class instantiation.
656
  *
657
  * Returns an empty string if the class name could not be reliably inferred.
658
  *
659
+ * @since 7.0.3
660
+ *
661
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
662
  * @param int $stackPtr The position of a T_NEW token.
663
  *
664
  * @return string
665
  */
666
+ public function getFQClassNameFromNewToken(File $phpcsFile, $stackPtr)
667
  {
668
  $tokens = $phpcsFile->getTokens();
669
 
672
  return '';
673
  }
674
 
675
+ if ($tokens[$stackPtr]['code'] !== \T_NEW) {
676
  return '';
677
  }
678
 
679
+ $start = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
680
  if ($start === false) {
681
  return '';
682
  }
683
 
684
  // Bow out if the next token is a variable as we don't know where it was defined.
685
+ if ($tokens[$start]['code'] === \T_VARIABLE) {
686
  return '';
687
  }
688
 
689
  // Bow out if the next token is the class keyword.
690
+ if ($tokens[$start]['type'] === 'T_ANON_CLASS' || $tokens[$start]['code'] === \T_CLASS) {
691
  return '';
692
  }
693
 
694
  $find = array(
695
+ \T_NS_SEPARATOR,
696
+ \T_STRING,
697
+ \T_NAMESPACE,
698
+ \T_WHITESPACE,
699
  );
700
 
701
  $end = $phpcsFile->findNext($find, ($start + 1), null, true, null, true);
712
  * Returns an empty string if the class does not extend another class or if
713
  * the class name could not be reliably inferred.
714
  *
715
+ * @since 7.0.3
716
+ *
717
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
718
  * @param int $stackPtr The position of a T_CLASS token.
719
  *
720
  * @return string
721
  */
722
+ public function getFQExtendedClassName(File $phpcsFile, $stackPtr)
723
  {
724
  $tokens = $phpcsFile->getTokens();
725
 
728
  return '';
729
  }
730
 
731
+ if ($tokens[$stackPtr]['code'] !== \T_CLASS
732
  && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
733
  && $tokens[$stackPtr]['type'] !== 'T_INTERFACE'
734
  ) {
736
  }
737
 
738
  $extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr);
739
+ if (empty($extends) || \is_string($extends) === false) {
740
  return '';
741
  }
742
 
750
  *
751
  * Returns an empty string if the class name could not be reliably inferred.
752
  *
753
+ * @since 7.0.3
754
+ *
755
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
756
  * @param int $stackPtr The position of a T_NEW token.
757
  *
758
  * @return string
759
  */
760
+ public function getFQClassNameFromDoubleColonToken(File $phpcsFile, $stackPtr)
761
  {
762
  $tokens = $phpcsFile->getTokens();
763
 
766
  return '';
767
  }
768
 
769
+ if ($tokens[$stackPtr]['code'] !== \T_DOUBLE_COLON) {
770
  return '';
771
  }
772
 
773
  // Nothing to do if previous token is a variable as we don't know where it was defined.
774
+ if ($tokens[$stackPtr - 1]['code'] === \T_VARIABLE) {
775
  return '';
776
  }
777
 
778
  // Nothing to do if 'parent' or 'static' as we don't know how far the class tree extends.
779
+ if (\in_array($tokens[$stackPtr - 1]['code'], array(\T_PARENT, \T_STATIC), true)) {
780
  return '';
781
  }
782
 
783
  // Get the classname from the class declaration if self is used.
784
+ if ($tokens[$stackPtr - 1]['code'] === \T_SELF) {
785
+ $classDeclarationPtr = $phpcsFile->findPrevious(\T_CLASS, $stackPtr - 1);
786
  if ($classDeclarationPtr === false) {
787
  return '';
788
  }
791
  }
792
 
793
  $find = array(
794
+ \T_NS_SEPARATOR,
795
+ \T_STRING,
796
+ \T_NAMESPACE,
797
+ \T_WHITESPACE,
798
  );
799
 
800
  $start = $phpcsFile->findPrevious($find, $stackPtr - 1, null, true, null, true);
816
  * Checks if a class/function/constant name is already fully qualified and
817
  * if not, enrich it with the relevant namespace information.
818
  *
819
+ * @since 7.0.3
820
+ *
821
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
822
  * @param int $stackPtr The position of the token.
823
  * @param string $name The class / function / constant name.
824
  *
825
  * @return string
826
  */
827
+ public function getFQName(File $phpcsFile, $stackPtr, $name)
828
  {
829
  if (strpos($name, '\\') === 0) {
830
  // Already fully qualified.
849
  /**
850
  * Is the class/function/constant name namespaced or global ?
851
  *
852
+ * @since 7.0.3
853
+ *
854
  * @param string $FQName Fully Qualified name of a class, function etc.
855
  * I.e. should always start with a `\`.
856
  *
857
  * @return bool True if namespaced, false if global.
858
+ *
859
+ * @throws \PHP_CodeSniffer_Exception If the name in the passed parameter
860
+ * is not fully qualified.
861
  */
862
  public function isNamespaced($FQName)
863
  {
864
  if (strpos($FQName, '\\') !== 0) {
865
+ throw new PHPCS_Exception('$FQName must be a fully qualified name');
866
  }
867
 
868
  return (strpos(substr($FQName, 1), '\\') !== false);
872
  /**
873
  * Determine the namespace name an arbitrary token lives in.
874
  *
875
+ * @since 7.0.3
876
+ *
877
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
878
  * @param int $stackPtr The token position for which to determine the namespace.
879
  *
880
  * @return string Namespace name or empty string if it couldn't be determined or no namespace applies.
881
  */
882
+ public function determineNamespace(File $phpcsFile, $stackPtr)
883
  {
884
  $tokens = $phpcsFile->getTokens();
885
 
890
 
891
  // Check for scoped namespace {}.
892
  if (empty($tokens[$stackPtr]['conditions']) === false) {
893
+ $namespacePtr = $phpcsFile->getCondition($stackPtr, \T_NAMESPACE);
894
  if ($namespacePtr !== false) {
895
  $namespace = $this->getDeclaredNamespaceName($phpcsFile, $namespacePtr);
896
  if ($namespace !== false) {
912
  $previousNSToken = $stackPtr;
913
  $namespace = false;
914
  do {
915
+ $previousNSToken = $phpcsFile->findPrevious(\T_NAMESPACE, ($previousNSToken - 1));
916
 
917
  // Stop if we encounter a scoped namespace declaration as we already know we're not in one.
918
  if (empty($tokens[$previousNSToken]['scope_condition']) === false && $tokens[$previousNSToken]['scope_condition'] === $previousNSToken) {
937
  * For hierarchical namespaces, the name will be composed of several tokens,
938
  * i.e. MyProject\Sub\Level which will be returned together as one string.
939
  *
940
+ * @since 7.0.3
941
+ *
942
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
943
  * @param int|bool $stackPtr The position of a T_NAMESPACE token.
944
  *
945
  * @return string|false Namespace name or false if not a namespace declaration.
946
  * Namespace name can be an empty string for global namespace declaration.
947
  */
948
+ public function getDeclaredNamespaceName(File $phpcsFile, $stackPtr)
949
  {
950
  $tokens = $phpcsFile->getTokens();
951
 
954
  return false;
955
  }
956
 
957
+ if ($tokens[$stackPtr]['code'] !== \T_NAMESPACE) {
958
  return false;
959
  }
960
 
961
+ if ($tokens[($stackPtr + 1)]['code'] === \T_NS_SEPARATOR) {
962
+ // Not a namespace declaration, but use of, i.e. `namespace\someFunction();`.
963
  return false;
964
  }
965
 
966
+ $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
967
+ if ($tokens[$nextToken]['code'] === \T_OPEN_CURLY_BRACKET) {
968
+ /*
969
+ * Declaration for global namespace when using multiple namespaces in a file.
970
+ * I.e.: `namespace {}`.
971
+ */
972
  return '';
973
  }
974
 
975
  // Ok, this should be a namespace declaration, so get all the parts together.
976
  $validTokens = array(
977
+ \T_STRING => true,
978
+ \T_NS_SEPARATOR => true,
979
+ \T_WHITESPACE => true,
980
  );
981
 
982
  $namespaceName = '';
997
  *
998
  * Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token.
999
  *
1000
+ * @since 7.1.2
1001
+ *
1002
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1003
  * @param int $stackPtr The position of the token.
1004
  *
1006
  * no return type was found or the passed token was
1007
  * not of the correct type.
1008
  */
1009
+ public function getReturnTypeHintToken(File $phpcsFile, $stackPtr)
1010
  {
1011
  $tokens = $phpcsFile->getTokens();
1012
 
1013
+ if (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) {
1014
  return $stackPtr;
1015
  }
1016
 
1017
+ if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) {
1018
  return false;
1019
  }
1020
 
1027
  if (isset($tokens[$stackPtr]['scope_opener'])) {
1028
  $endOfFunctionDeclaration = $tokens[$stackPtr]['scope_opener'];
1029
  } else {
1030
+ $nextSemiColon = $phpcsFile->findNext(\T_SEMICOLON, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, false, null, true);
1031
  if ($nextSemiColon !== false) {
1032
  $endOfFunctionDeclaration = $nextSemiColon;
1033
  }
1038
  }
1039
 
1040
  $hasColon = $phpcsFile->findNext(
1041
+ array(\T_COLON, \T_INLINE_ELSE),
1042
  ($tokens[$stackPtr]['parenthesis_closer'] + 1),
1043
  $endOfFunctionDeclaration
1044
  );
1056
  * As of PHPCS 3.3.0 `array` as a type declaration will be tokenized as `T_STRING`.
1057
  */
1058
  $unrecognizedTypes = array(
1059
+ \T_CALLABLE,
1060
+ \T_SELF,
1061
+ \T_PARENT,
1062
+ \T_ARRAY, // PHPCS < 2.4.0.
1063
+ \T_STRING,
1064
  );
1065
 
1066
  return $phpcsFile->findPrevious($unrecognizedTypes, ($endOfFunctionDeclaration - 1), $hasColon);
1080
  * Expects to be passed a T_RETURN_TYPE token or the return value from a call to
1081
  * the Sniff::getReturnTypeHintToken() method.
1082
  *
1083
+ * @since 8.2.0
1084
+ *
1085
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1086
  * @param int $stackPtr The position of the return type token.
1087
  *
1088
+ * @return string The name of the return type token.
1089
  */
1090
+ public function getReturnTypeHintName(File $phpcsFile, $stackPtr)
1091
  {
1092
  $tokens = $phpcsFile->getTokens();
1093
 
1094
  // In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE.
1095
+ $colon = $phpcsFile->findPrevious(array(\T_COLON, \T_INLINE_ELSE, \T_FUNCTION, \T_CLOSE_PARENTHESIS), ($stackPtr - 1));
1096
  if ($colon === false
1097
+ || ($tokens[$colon]['code'] !== \T_COLON && $tokens[$colon]['code'] !== \T_INLINE_ELSE)
1098
  ) {
1099
  // Shouldn't happen, just in case.
1100
+ return '';
1101
  }
1102
 
 
 
1103
  $returnTypeHint = '';
1104
  for ($i = ($colon + 1); $i <= $stackPtr; $i++) {
1105
  // As of PHPCS 3.3.0+, all tokens are tokenized as "normal", so T_CALLABLE, T_SELF etc are
1106
  // all possible, just exclude anything that's regarded as empty and the nullable indicator.
1107
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) {
1108
  continue;
1109
  }
1110
 
1112
  continue;
1113
  }
1114
 
1115
+ if (\defined('T_NULLABLE') === false && $tokens[$i]['code'] === \T_INLINE_THEN) {
1116
  // Old PHPCS.
1117
  continue;
1118
  }
1132
  * anonymous classes. Along the same lines, the`getMemberProperties()`
1133
  * method does not support the `var` prefix.
1134
  *
1135
+ * @since 7.1.4
1136
+ *
1137
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1138
  * @param int $stackPtr The position in the stack of the
1139
  * T_VARIABLE token to verify.
1140
  *
1141
  * @return bool
1142
  */
1143
+ public function isClassProperty(File $phpcsFile, $stackPtr)
1144
  {
1145
  $tokens = $phpcsFile->getTokens();
1146
 
1147
+ if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) {
1148
  return false;
1149
  }
1150
 
1154
  'T_ANON_CLASS' => true,
1155
  'T_TRAIT' => true,
1156
  );
1157
+
1158
+ $scopePtr = $this->validDirectScope($phpcsFile, $stackPtr, $validScopes);
1159
+ if ($scopePtr !== false) {
1160
  // Make sure it's not a method parameter.
1161
  if (empty($tokens[$stackPtr]['nested_parenthesis']) === true) {
1162
  return true;
1163
+ } else {
1164
+ $parenthesis = array_keys($tokens[$stackPtr]['nested_parenthesis']);
1165
+ $deepestOpen = array_pop($parenthesis);
1166
+ if ($deepestOpen < $scopePtr
1167
+ || isset($tokens[$deepestOpen]['parenthesis_owner']) === false
1168
+ || $tokens[$tokens[$deepestOpen]['parenthesis_owner']]['code'] !== \T_FUNCTION
1169
+ ) {
1170
+ return true;
1171
+ }
1172
  }
1173
  }
1174
 
1179
  /**
1180
  * Check whether a T_CONST token is a class constant declaration.
1181
  *
1182
+ * @since 7.1.4
1183
+ *
1184
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1185
  * @param int $stackPtr The position in the stack of the
1186
  * T_CONST token to verify.
1187
  *
1188
  * @return bool
1189
  */
1190
+ public function isClassConstant(File $phpcsFile, $stackPtr)
1191
  {
1192
  $tokens = $phpcsFile->getTokens();
1193
 
1194
+ if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) {
1195
  return false;
1196
  }
1197
 
1201
  'T_ANON_CLASS' => true,
1202
  'T_INTERFACE' => true,
1203
  );
1204
+ if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) !== false) {
1205
  return true;
1206
  }
1207
 
1215
  *
1216
  * Used to check, for instance, if a T_CONST is a class constant.
1217
  *
1218
+ * @since 7.1.4
1219
+ *
1220
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1221
  * @param int $stackPtr The position in the stack of the
1222
+ * token to verify.
1223
  * @param array $validScopes Array of token types.
1224
  * Keys should be the token types in string
1225
  * format to allow for newer token types.
1226
  * Value is irrelevant.
1227
  *
1228
+ * @return int|bool StackPtr to the scope if valid, false otherwise.
1229
  */
1230
+ protected function validDirectScope(File $phpcsFile, $stackPtr, $validScopes)
1231
  {
1232
  $tokens = $phpcsFile->getTokens();
1233
 
1246
  }
1247
 
1248
  if (isset($validScopes[$tokens[$ptr]['type']]) === true) {
1249
+ return $ptr;
1250
  }
1251
 
1252
  return false;
1261
  * Strips potential nullable indicator and potential global namespace
1262
  * indicator from the type hints before returning them.
1263
  *
1264
+ * @since 7.1.4
1265
+ *
1266
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1267
  * @param int $stackPtr The position of the token.
1268
  *
1271
  * - no type hints were found
1272
  * - or the passed token was not of the correct type.
1273
  */
1274
+ public function getTypeHintsFromFunctionDeclaration(File $phpcsFile, $stackPtr)
1275
  {
1276
  $tokens = $phpcsFile->getTokens();
1277
 
1278
+ if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) {
1279
  return array();
1280
  }
1281
 
1282
  $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
1283
+ if (empty($parameters) || \is_array($parameters) === false) {
1284
  return array();
1285
  }
1286
 
1309
  /**
1310
  * Get the hash algorithm name from the parameter in a hash function call.
1311
  *
1312
+ * @since 7.0.7 Logic was originally contained in the `RemovedHashAlgorithms` sniff.
1313
+ *
1314
  * @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile.
1315
  * @param int $stackPtr The position of the T_STRING function token.
1316
  *
1317
  * @return string|false The algorithm name without quotes if this was a relevant hash
1318
  * function call or false if it was not.
1319
  */
1320
+ public function getHashAlgorithmParameter(File $phpcsFile, $stackPtr)
1321
  {
1322
  $tokens = $phpcsFile->getTokens();
1323
 
1326
  return false;
1327
  }
1328
 
1329
+ if ($tokens[$stackPtr]['code'] !== \T_STRING) {
1330
  return false;
1331
  }
1332
 
1355
  /**
1356
  * Determine whether an arbitrary T_STRING token is the use of a global constant.
1357
  *
1358
+ * @since 8.1.0
1359
+ *
1360
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1361
+ * @param int $stackPtr The position of the T_STRING token.
1362
  *
1363
  * @return bool
1364
  */
1365
+ public function isUseOfGlobalConstant(File $phpcsFile, $stackPtr)
1366
  {
1367
  static $isLowPHPCS, $isLowPHP;
1368
 
1374
  }
1375
 
1376
  // Is this one of the tokens this function handles ?
1377
+ if ($tokens[$stackPtr]['code'] !== \T_STRING) {
1378
  return false;
1379
  }
1380
 
1382
  if (isset($isLowPHPCS, $isLowPHP) === false) {
1383
  $isLowPHP = false;
1384
  $isLowPHPCS = false;
1385
+ if (version_compare(\PHP_VERSION_ID, '50400', '<')) {
1386
  $isLowPHP = true;
1387
  $isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.4.0', '<');
1388
  }
1389
  }
1390
 
1391
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
1392
  if ($next !== false
1393
+ && ($tokens[$next]['code'] === \T_OPEN_PARENTHESIS
1394
+ || $tokens[$next]['code'] === \T_DOUBLE_COLON)
1395
  ) {
1396
  // Function call or declaration.
1397
  return false;
1419
  'T_PRIVATE' => true,
1420
  );
1421
 
1422
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
1423
  if ($prev !== false
1424
  && (isset($tokensToIgnore[$tokens[$prev]['type']]) === true
1425
+ || ($tokens[$prev]['code'] === \T_STRING
1426
  && (($isLowPHPCS === true
1427
  && $tokens[$prev]['content'] === 'trait')
1428
  || ($isLowPHP === true
1433
  }
1434
 
1435
  if ($prev !== false
1436
+ && $tokens[$prev]['code'] === \T_NS_SEPARATOR
1437
+ && $tokens[($prev - 1)]['code'] === \T_STRING
1438
  ) {
1439
  // Namespaced constant of the same name.
1440
  return false;
1441
  }
1442
 
1443
  if ($prev !== false
1444
+ && $tokens[$prev]['code'] === \T_CONST
1445
  && $this->isClassConstant($phpcsFile, $prev) === true
1446
  ) {
1447
  // Class constant declaration of the same name.
1457
  }
1458
  }
1459
 
1460
+ $firstOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
1461
+ if ($firstOnLine !== false && $tokens[$firstOnLine]['code'] === \T_USE) {
1462
+ $nextOnLine = $phpcsFile->findNext(Tokens::$emptyTokens, ($firstOnLine + 1), null, true);
1463
  if ($nextOnLine !== false) {
1464
+ if (($tokens[$nextOnLine]['code'] === \T_STRING && $tokens[$nextOnLine]['content'] === 'const')
1465
+ || $tokens[$nextOnLine]['code'] === \T_CONST // Happens in some PHPCS versions.
1466
  ) {
1467
+ $hasNsSep = $phpcsFile->findNext(\T_NS_SEPARATOR, ($nextOnLine + 1), $stackPtr);
1468
  if ($hasNsSep !== false) {
1469
  // Namespaced const (group) use statement.
1470
  return false;
1489
  *
1490
  * Note: Zero is *not* regarded as a positive number.
1491
  *
1492
+ * @since 8.2.0
1493
+ *
1494
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1495
  * @param int $start Start of the snippet (inclusive), i.e. this
1496
  * token will be examined as part of the snippet.
1502
  * False if not or if it could not be reliably determined
1503
  * (variable or calculations and such).
1504
  */
1505
+ public function isPositiveNumber(File $phpcsFile, $start, $end, $allowFloats = false)
1506
  {
1507
  $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
1508
 
1523
  *
1524
  * Note: Zero is *not* regarded as a negative number.
1525
  *
1526
+ * @since 8.2.0
1527
+ *
1528
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1529
  * @param int $start Start of the snippet (inclusive), i.e. this
1530
  * token will be examined as part of the snippet.
1536
  * False if not or if it could not be reliably determined
1537
  * (variable or calculations and such).
1538
  */
1539
+ public function isNegativeNumber(File $phpcsFile, $start, $end, $allowFloats = false)
1540
  {
1541
  $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats);
1542
 
1545
  }
1546
 
1547
  return ($number < 0);
 
1548
  }
1549
 
1550
  /**
1559
  * Mainly intended for examining variable assignments, function call parameters, array values
1560
  * where the start and end of the snippet to examine is very clear.
1561
  *
1562
+ * @since 8.2.0
1563
+ *
1564
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1565
  * @param int $start Start of the snippet (inclusive), i.e. this
1566
  * token will be examined as part of the snippet.
1575
  * number or if it could not be reliably determined
1576
  * (variable or calculations and such).
1577
  */
1578
+ protected function isNumber(File $phpcsFile, $start, $end, $allowFloats = false)
1579
  {
1580
+ $stringTokens = Tokens::$heredocTokens + Tokens::$stringTokens;
 
1581
 
1582
+ $validTokens = array();
1583
+ $validTokens[\T_LNUMBER] = true;
1584
+ $validTokens[\T_TRUE] = true; // Evaluates to int 1.
1585
+ $validTokens[\T_FALSE] = true; // Evaluates to int 0.
1586
+ $validTokens[\T_NULL] = true; // Evaluates to int 0.
1587
 
1588
  if ($allowFloats === true) {
1589
+ $validTokens[\T_DNUMBER] = true;
1590
  }
1591
 
1592
  $maybeValidTokens = $stringTokens + $validTokens;
1599
  return false;
1600
  }
1601
 
1602
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $searchEnd, true);
1603
  while ($nextNonEmpty !== false
1604
+ && ($tokens[$nextNonEmpty]['code'] === \T_PLUS
1605
+ || $tokens[$nextNonEmpty]['code'] === \T_MINUS)
1606
  ) {
1607
 
1608
+ if ($tokens[$nextNonEmpty]['code'] === \T_MINUS) {
1609
  $negativeNumber = ($negativeNumber === false) ? true : false;
1610
  }
1611
 
1612
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
1613
  }
1614
 
1615
  if ($nextNonEmpty === false || isset($maybeValidTokens[$tokens[$nextNonEmpty]['code']]) === false) {
1617
  }
1618
 
1619
  $content = false;
1620
+ if ($tokens[$nextNonEmpty]['code'] === \T_LNUMBER
1621
+ || $tokens[$nextNonEmpty]['code'] === \T_DNUMBER
1622
  ) {
1623
  $content = (float) $tokens[$nextNonEmpty]['content'];
1624
+ } elseif ($tokens[$nextNonEmpty]['code'] === \T_TRUE) {
1625
  $content = 1.0;
1626
+ } elseif ($tokens[$nextNonEmpty]['code'] === \T_FALSE
1627
+ || $tokens[$nextNonEmpty]['code'] === \T_NULL
1628
  ) {
1629
  $content = 0.0;
1630
  } elseif (isset($stringTokens[$tokens[$nextNonEmpty]['code']]) === true) {
1631
 
1632
+ if ($tokens[$nextNonEmpty]['code'] === \T_START_HEREDOC
1633
+ || $tokens[$nextNonEmpty]['code'] === \T_START_NOWDOC
1634
  ) {
1635
  // Skip past heredoc/nowdoc opener to the first content.
1636
+ $firstDocToken = $phpcsFile->findNext(array(\T_HEREDOC, \T_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
1637
  if ($firstDocToken === false) {
1638
  // Live coding or parse error.
1639
  return false;
1642
  $stringContent = $content = $tokens[$firstDocToken]['content'];
1643
 
1644
  // Skip forward to the end in preparation for the next part of the examination.
1645
+ $nextNonEmpty = $phpcsFile->findNext(array(\T_END_HEREDOC, \T_END_NOWDOC), ($nextNonEmpty + 1), $searchEnd);
1646
  if ($nextNonEmpty === false) {
1647
  // Live coding or parse error.
1648
  return false;
1663
 
1664
  /*
1665
  * Regexes based on the formats outlined in the manual, created by JRF.
1666
+ * @link https://www.php.net/manual/en/language.types.float.php
1667
  */
1668
  $regexInt = '`^\s*[0-9]+`';
1669
  $regexFloat = '`^\s*(?:[+-]?(?:(?:(?P<LNUM>[0-9]+)|(?P<DNUM>([0-9]*\.(?P>LNUM)|(?P>LNUM)\.[0-9]*)))[eE][+-]?(?P>LNUM))|(?P>DNUM))`';
1700
  // use that to get the numeric value if possible.
1701
  // If the filter extension is not available, the value will be zero, but so be it.
1702
  if (function_exists('filter_var')) {
1703
+ $filtered = filter_var($hexNumberString[1], \FILTER_VALIDATE_INT, \FILTER_FLAG_ALLOW_HEX);
1704
  if ($filtered !== false) {
1705
  $content = $filtered;
1706
  }
1709
  }
1710
 
1711
  // OK, so we have a number, now is there still more code after it ?
1712
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextNonEmpty + 1), $searchEnd, true);
1713
  if ($nextNonEmpty !== false) {
1714
  return false;
1715
  }
1726
  }
1727
 
1728
 
1729
+ /**
1730
+ * Determine whether the tokens between $start and $end together form a numberic calculation
1731
+ * as recognized by PHP.
1732
+ *
1733
+ * The outcome of this function is reliable for `true`, `false` should be regarded as "undetermined".
1734
+ *
1735
+ * Mainly intended for examining variable assignments, function call parameters, array values
1736
+ * where the start and end of the snippet to examine is very clear.
1737
+ *
1738
+ * @since 9.0.0
1739
+ *
1740
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1741
+ * @param int $start Start of the snippet (inclusive), i.e. this
1742
+ * token will be examined as part of the snippet.
1743
+ * @param int $end End of the snippet (inclusive), i.e. this
1744
+ * token will be examined as part of the snippet.
1745
+ *
1746
+ * @return bool
1747
+ */
1748
+ protected function isNumericCalculation(File $phpcsFile, $start, $end)
1749
+ {
1750
+ $arithmeticTokens = Tokens::$arithmeticTokens;
1751
+
1752
+ // phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound
1753
+ if (\defined('T_POW') && isset($arithmeticTokens[\T_POW]) === false) {
1754
+ // T_POW was not added to the arithmetic array until PHPCS 2.9.0.
1755
+ $arithmeticTokens[\T_POW] = \T_POW;
1756
+ }
1757
+ // phpcs:enable
1758
+
1759
+ $skipTokens = Tokens::$emptyTokens;
1760
+ $skipTokens[] = \T_MINUS;
1761
+ $skipTokens[] = \T_PLUS;
1762
+
1763
+ // Find the first arithmetic operator, but skip past +/- signs before numbers.
1764
+ $nextNonEmpty = ($start - 1);
1765
+ do {
1766
+ $nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true);
1767
+ $arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1));
1768
+ } while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator);
1769
+
1770
+ if ($arithmeticOperator === false) {
1771
+ return false;
1772
+ }
1773
+
1774
+ $tokens = $phpcsFile->getTokens();
1775
+ $subsetStart = $start;
1776
+ $subsetEnd = ($arithmeticOperator - 1);
1777
+
1778
+ while ($this->isNumber($phpcsFile, $subsetStart, $subsetEnd, true) !== false
1779
+ && isset($tokens[($arithmeticOperator + 1)]) === true
1780
+ ) {
1781
+ // Recognize T_POW for PHPCS < 2.4.0 on low PHP versions.
1782
+ if (\defined('T_POW') === false
1783
+ && $tokens[$arithmeticOperator]['code'] === \T_MULTIPLY
1784
+ && $tokens[($arithmeticOperator + 1)]['code'] === \T_MULTIPLY
1785
+ && isset($tokens[$arithmeticOperator + 2]) === true
1786
+ ) {
1787
+ // Move operator one forward to the second * in T_POW.
1788
+ ++$arithmeticOperator;
1789
+ }
1790
+
1791
+ $subsetStart = ($arithmeticOperator + 1);
1792
+ $nextNonEmpty = $arithmeticOperator;
1793
+ do {
1794
+ $nextNonEmpty = $phpcsFile->findNext($skipTokens, ($nextNonEmpty + 1), ($end + 1), true);
1795
+ $arithmeticOperator = $phpcsFile->findNext($arithmeticTokens, ($nextNonEmpty + 1), ($end + 1));
1796
+ } while ($nextNonEmpty !== false && $arithmeticOperator !== false && $nextNonEmpty === $arithmeticOperator);
1797
+
1798
+ if ($arithmeticOperator === false) {
1799
+ // Last calculation operator already reached.
1800
+ if ($this->isNumber($phpcsFile, $subsetStart, $end, true) !== false) {
1801
+ return true;
1802
+ }
1803
+
1804
+ return false;
1805
+ }
1806
+
1807
+ $subsetEnd = ($arithmeticOperator - 1);
1808
+ }
1809
+
1810
+ return false;
1811
+ }
1812
+
1813
+
1814
+
1815
+ /**
1816
+ * Determine whether a ternary is a short ternary, i.e. without "middle".
1817
+ *
1818
+ * N.B.: This is a back-fill for a new method which is expected to go into
1819
+ * PHP_CodeSniffer 3.5.0.
1820
+ * Once that method has been merged into PHPCS, this one should be moved
1821
+ * to the PHPCSHelper.php file.
1822
+ *
1823
+ * @since 9.2.0
1824
+ *
1825
+ * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
1826
+ *
1827
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1828
+ * @param int $stackPtr The position of the ternary operator
1829
+ * in the stack.
1830
+ *
1831
+ * @return bool True if short ternary, or false otherwise.
1832
+ */
1833
+ public function isShortTernary(File $phpcsFile, $stackPtr)
1834
+ {
1835
+ $tokens = $phpcsFile->getTokens();
1836
+ if (isset($tokens[$stackPtr]) === false
1837
+ || $tokens[$stackPtr]['code'] !== \T_INLINE_THEN
1838
+ ) {
1839
+ return false;
1840
+ }
1841
+
1842
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
1843
+ if ($nextNonEmpty === false) {
1844
+ // Live coding or parse error.
1845
+ return false;
1846
+ }
1847
+
1848
+ if ($tokens[$nextNonEmpty]['code'] === \T_INLINE_ELSE) {
1849
+ return true;
1850
+ }
1851
+
1852
+ return false;
1853
+ }
1854
+
1855
+
1856
  /**
1857
  * Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct.
1858
  *
1859
  * Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays.
1860
  * In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET.
1861
  *
1862
+ * @since 8.2.0
1863
+ *
1864
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1865
  * @param int $stackPtr The position of the function call token.
1866
  *
1867
  * @return bool
1868
  */
1869
+ public function isShortList(File $phpcsFile, $stackPtr)
1870
  {
1871
  $tokens = $phpcsFile->getTokens();
1872
 
1876
  }
1877
 
1878
  // Is this one of the tokens this function handles ?
1879
+ if ($tokens[$stackPtr]['code'] !== \T_OPEN_SHORT_ARRAY
1880
+ && $tokens[$stackPtr]['code'] !== \T_CLOSE_SHORT_ARRAY
1881
  ) {
1882
  return false;
1883
  }
1884
 
1885
  switch ($tokens[$stackPtr]['code']) {
1886
+ case \T_OPEN_SHORT_ARRAY:
1887
  if (isset($tokens[$stackPtr]['bracket_closer']) === true) {
1888
  $opener = $stackPtr;
1889
  $closer = $tokens[$stackPtr]['bracket_closer'];
1890
  }
1891
  break;
1892
 
1893
+ case \T_CLOSE_SHORT_ARRAY:
1894
  if (isset($tokens[$stackPtr]['bracket_opener']) === true) {
1895
  $opener = $tokens[$stackPtr]['bracket_opener'];
1896
  $closer = $stackPtr;
1907
  * PHPCS cross-version compatibility: work around for square brackets misidentified
1908
  * as short array when preceded by a variable variable in older PHPCS versions.
1909
  */
1910
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true, null, true);
 
 
 
 
 
 
 
1911
 
1912
  if ($prevNonEmpty !== false
1913
+ && $tokens[$prevNonEmpty]['code'] === \T_CLOSE_CURLY_BRACKET
1914
  && isset($tokens[$prevNonEmpty]['bracket_opener']) === true
1915
  ) {
1916
  $maybeVariableVariable = $phpcsFile->findPrevious(
1917
+ Tokens::$emptyTokens,
1918
  ($tokens[$prevNonEmpty]['bracket_opener'] - 1),
1919
  null,
1920
  true,
1922
  true
1923
  );
1924
 
1925
+ if ($tokens[$maybeVariableVariable]['code'] === \T_VARIABLE
1926
+ || $tokens[$maybeVariableVariable]['code'] === \T_DOLLAR
1927
  ) {
1928
  return false;
1929
  }
1930
  }
1931
 
1932
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($closer + 1), null, true, null, true);
 
 
 
 
 
 
 
1933
 
1934
+ if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) {
1935
  return true;
1936
  }
1937
 
1938
  if ($prevNonEmpty !== false
1939
+ && $tokens[$prevNonEmpty]['code'] === \T_AS
1940
  && isset($tokens[$prevNonEmpty]['nested_parenthesis']) === true
1941
  ) {
1942
  $parentheses = array_reverse($tokens[$prevNonEmpty]['nested_parenthesis'], true);
1943
  foreach ($parentheses as $open => $close) {
1944
  if (isset($tokens[$open]['parenthesis_owner'])
1945
+ && $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH
1946
  ) {
1947
  return true;
1948
  }
1953
  $parentOpener = $opener;
1954
  do {
1955
  $parentOpener = $phpcsFile->findPrevious(
1956
+ array(\T_OPEN_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET),
1957
  ($parentOpener - 1),
1958
  null,
1959
  false,
1976
  $phpcsVersion = PHPCSHelper::getVersion();
1977
  if ((version_compare($phpcsVersion, '2.0', '>') === true
1978
  && version_compare($phpcsVersion, '2.8', '<') === true)
1979
+ && $tokens[$parentOpener]['code'] === \T_OPEN_SQUARE_BRACKET
1980
  ) {
1981
  $nextNonEmpty = $phpcsFile->findNext(
1982
+ Tokens::$emptyTokens,
1983
  ($tokens[$parentOpener]['bracket_closer'] + 1),
1984
  null,
1985
  true,
1987
  true
1988
  );
1989
 
1990
+ if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === \T_EQUAL) {
1991
  return true;
1992
  }
1993
 
1999
 
2000
  return false;
2001
  }
2002
+
2003
+
2004
+ /**
2005
+ * Determine whether the tokens between $start and $end could together represent a variable.
2006
+ *
2007
+ * @since 9.0.0
2008
+ *
2009
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
2010
+ * @param int $start Starting point stack pointer. Inclusive.
2011
+ * I.e. this token should be taken into account.
2012
+ * @param int $end End point stack pointer. Exclusive.
2013
+ * I.e. this token should not be taken into account.
2014
+ * @param int $targetNestingLevel The nesting level the variable should be at.
2015
+ *
2016
+ * @return bool
2017
+ */
2018
+ public function isVariable(File $phpcsFile, $start, $end, $targetNestingLevel)
2019
+ {
2020
+ static $tokenBlackList, $bracketTokens;
2021
+
2022
+ // Create the token arrays only once.
2023
+ if (isset($tokenBlackList, $bracketTokens) === false) {
2024
+
2025
+ $tokenBlackList = array(
2026
+ \T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS,
2027
+ \T_STRING_CONCAT => \T_STRING_CONCAT,
2028
+ );
2029
+ $tokenBlackList += Tokens::$assignmentTokens;
2030
+ $tokenBlackList += Tokens::$equalityTokens;
2031
+ $tokenBlackList += Tokens::$comparisonTokens;
2032
+ $tokenBlackList += Tokens::$operators;
2033
+ $tokenBlackList += Tokens::$booleanOperators;
2034
+ $tokenBlackList += Tokens::$castTokens;
2035
+
2036
+ /*
2037
+ * List of brackets which can be part of a variable variable.
2038
+ *
2039
+ * Key is the open bracket token, value the close bracket token.
2040
+ */
2041
+ $bracketTokens = array(
2042
+ \T_OPEN_CURLY_BRACKET => \T_CLOSE_CURLY_BRACKET,
2043
+ \T_OPEN_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET,
2044
+ );
2045
+ }
2046
+
2047
+ $tokens = $phpcsFile->getTokens();
2048
+
2049
+ // If no variable at all was found, then it's definitely a no-no.
2050
+ $hasVariable = $phpcsFile->findNext(\T_VARIABLE, $start, $end);
2051
+ if ($hasVariable === false) {
2052
+ return false;
2053
+ }
2054
+
2055
+ // Check if the variable found is at the right level. Deeper levels are always an error.
2056
+ if (isset($tokens[$hasVariable]['nested_parenthesis'])
2057
+ && \count($tokens[$hasVariable]['nested_parenthesis']) !== $targetNestingLevel
2058
+ ) {
2059
+ return false;
2060
+ }
2061
+
2062
+ // Ok, so the first variable is at the right level, now are there any
2063
+ // blacklisted tokens within the empty() ?
2064
+ $hasBadToken = $phpcsFile->findNext($tokenBlackList, $start, $end);
2065
+ if ($hasBadToken === false) {
2066
+ return true;
2067
+ }
2068
+
2069
+ // If there are also bracket tokens, the blacklisted token might be part of a variable
2070
+ // variable, but if there are no bracket tokens, we know we have an error.
2071
+ $hasBrackets = $phpcsFile->findNext($bracketTokens, $start, $end);
2072
+ if ($hasBrackets === false) {
2073
+ return false;
2074
+ }
2075
+
2076
+ // Ok, we have both a blacklisted token as well as brackets, so we need to walk
2077
+ // the tokens of the variable variable.
2078
+ for ($i = $start; $i < $end; $i++) {
2079
+ // If this is a bracket token, skip to the end of the bracketed expression.
2080
+ if (isset($bracketTokens[$tokens[$i]['code']], $tokens[$i]['bracket_closer'])) {
2081
+ $i = $tokens[$i]['bracket_closer'];
2082
+ continue;
2083
+ }
2084
+
2085
+ // If it's a blacklisted token, not within brackets, we have an error.
2086
+ if (isset($tokenBlackList[$tokens[$i]['code']])) {
2087
+ return false;
2088
+ }
2089
+ }
2090
+
2091
+ return true;
2092
+ }
2093
+
2094
+ /**
2095
+ * Determine whether a T_MINUS/T_PLUS token is a unary operator.
2096
+ *
2097
+ * N.B.: This is a back-fill for a new method which is expected to go into
2098
+ * PHP_CodeSniffer 3.5.0.
2099
+ * Once that method has been merged into PHPCS, this one should be moved
2100
+ * to the PHPCSHelper.php file.
2101
+ *
2102
+ * @since 9.2.0
2103
+ *
2104
+ * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
2105
+ *
2106
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
2107
+ * @param int $stackPtr The position of the plus/minus token.
2108
+ *
2109
+ * @return bool True if the token passed is a unary operator.
2110
+ * False otherwise or if the token is not a T_PLUS/T_MINUS token.
2111
+ */
2112
+ public static function isUnaryPlusMinus(File $phpcsFile, $stackPtr)
2113
+ {
2114
+ $tokens = $phpcsFile->getTokens();
2115
+
2116
+ if (isset($tokens[$stackPtr]) === false
2117
+ || ($tokens[$stackPtr]['code'] !== \T_PLUS
2118
+ && $tokens[$stackPtr]['code'] !== \T_MINUS)
2119
+ ) {
2120
+ return false;
2121
+ }
2122
+
2123
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
2124
+ if ($next === false) {
2125
+ // Live coding or parse error.
2126
+ return false;
2127
+ }
2128
+
2129
+ if (isset(Tokens::$operators[$tokens[$next]['code']]) === true) {
2130
+ // Next token is an operator, so this is not a unary.
2131
+ return false;
2132
+ }
2133
+
2134
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
2135
+
2136
+ if ($tokens[$prev]['code'] === \T_RETURN) {
2137
+ // Just returning a positive/negative value; eg. (return -1).
2138
+ return true;
2139
+ }
2140
+
2141
+ if (isset(Tokens::$operators[$tokens[$prev]['code']]) === true) {
2142
+ // Just trying to operate on a positive/negative value; eg. ($var * -1).
2143
+ return true;
2144
+ }
2145
+
2146
+ if (isset(Tokens::$comparisonTokens[$tokens[$prev]['code']]) === true) {
2147
+ // Just trying to compare a positive/negative value; eg. ($var === -1).
2148
+ return true;
2149
+ }
2150
+
2151
+ if (isset(Tokens::$booleanOperators[$tokens[$prev]['code']]) === true) {
2152
+ // Just trying to compare a positive/negative value; eg. ($var || -1 === $b).
2153
+ return true;
2154
+ }
2155
+
2156
+ if (isset(Tokens::$assignmentTokens[$tokens[$prev]['code']]) === true) {
2157
+ // Just trying to assign a positive/negative value; eg. ($var = -1).
2158
+ return true;
2159
+ }
2160
+
2161
+ if (isset(Tokens::$castTokens[$tokens[$prev]['code']]) === true) {
2162
+ // Just casting a positive/negative value; eg. (string) -$var.
2163
+ return true;
2164
+ }
2165
+
2166
+ // Other indicators that a plus/minus sign is a unary operator.
2167
+ $invalidTokens = array(
2168
+ \T_COMMA => true,
2169
+ \T_OPEN_PARENTHESIS => true,
2170
+ \T_OPEN_SQUARE_BRACKET => true,
2171
+ \T_OPEN_SHORT_ARRAY => true,
2172
+ \T_COLON => true,
2173
+ \T_INLINE_THEN => true,
2174
+ \T_INLINE_ELSE => true,
2175
+ \T_CASE => true,
2176
+ \T_OPEN_CURLY_BRACKET => true,
2177
+ \T_STRING_CONCAT => true,
2178
+ );
2179
+
2180
+ if (isset($invalidTokens[$tokens[$prev]['code']]) === true) {
2181
+ // Just trying to use a positive/negative value; eg. myFunction($var, -2).
2182
+ return true;
2183
+ }
2184
+
2185
+ return false;
2186
+ }
2187
+
2188
+ /**
2189
+ * Get the complete contents of a multi-line text string.
2190
+ *
2191
+ * N.B.: This is a back-fill for a new method which is expected to go into
2192
+ * PHP_CodeSniffer 3.5.0.
2193
+ * Once that method has been merged into PHPCS, this one should be moved
2194
+ * to the PHPCSHelper.php file.
2195
+ *
2196
+ * @since 9.3.0
2197
+ *
2198
+ * @codeCoverageIgnore Method as pulled upstream is accompanied by unit tests.
2199
+ *
2200
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
2201
+ * @param int $stackPtr Pointer to the first text string token
2202
+ * of a multi-line text string or to a
2203
+ * Nowdoc/Heredoc opener.
2204
+ * @param bool $stripQuotes Optional. Whether to strip text delimiter
2205
+ * quotes off the resulting text string.
2206
+ * Defaults to true.
2207
+ *
2208
+ * @return string
2209
+ *
2210
+ * @throws \PHP_CodeSniffer_Exception If the specified position is not a
2211
+ * valid text string token or if the
2212
+ * token is not the first text string token.
2213
+ */
2214
+ public function getCompleteTextString(File $phpcsFile, $stackPtr, $stripQuotes = true)
2215
+ {
2216
+ $tokens = $phpcsFile->getTokens();
2217
+
2218
+ // Must be the start of a text string token.
2219
+ if ($tokens[$stackPtr]['code'] !== \T_START_HEREDOC
2220
+ && $tokens[$stackPtr]['code'] !== \T_START_NOWDOC
2221
+ && $tokens[$stackPtr]['code'] !== \T_CONSTANT_ENCAPSED_STRING
2222
+ && $tokens[$stackPtr]['code'] !== \T_DOUBLE_QUOTED_STRING
2223
+ ) {
2224
+ throw new PHPCS_Exception('$stackPtr must be of type T_START_HEREDOC, T_START_NOWDOC, T_CONSTANT_ENCAPSED_STRING or T_DOUBLE_QUOTED_STRING');
2225
+ }
2226
+
2227
+ if ($tokens[$stackPtr]['code'] === \T_CONSTANT_ENCAPSED_STRING
2228
+ || $tokens[$stackPtr]['code'] === \T_DOUBLE_QUOTED_STRING
2229
+ ) {
2230
+ $prev = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
2231
+ if ($tokens[$stackPtr]['code'] === $tokens[$prev]['code']) {
2232
+ throw new PHPCS_Exception('$stackPtr must be the start of the text string');
2233
+ }
2234
+ }
2235
+
2236
+ switch ($tokens[$stackPtr]['code']) {
2237
+ case \T_START_HEREDOC:
2238
+ $stripQuotes = false;
2239
+ $targetType = \T_HEREDOC;
2240
+ $current = ($stackPtr + 1);
2241
+ break;
2242
+
2243
+ case \T_START_NOWDOC:
2244
+ $stripQuotes = false;
2245
+ $targetType = \T_NOWDOC;
2246
+ $current = ($stackPtr + 1);
2247
+ break;
2248
+
2249
+ default:
2250
+ $targetType = $tokens[$stackPtr]['code'];
2251
+ $current = $stackPtr;
2252
+ break;
2253
+ }
2254
+
2255
+ $string = '';
2256
+ do {
2257
+ $string .= $tokens[$current]['content'];
2258
+ ++$current;
2259
+ } while ($tokens[$current]['code'] === $targetType);
2260
+
2261
+ if ($stripQuotes === true) {
2262
+ return $this->stripQuotes($string);
2263
+ }
2264
+
2265
+ return $string;
2266
+ }
2267
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/ForbiddenAbstractPrivateMethodsSniff.php CHANGED
@@ -17,13 +17,13 @@ use PHP_CodeSniffer_File as File;
17
  * Abstract private methods are not allowed since PHP 5.1.
18
  *
19
  * Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but
20
- * were then disallowed on the grounds that the behaviours of private and abstract
21
  * are mutually exclusive.
22
  *
23
- * @link https://www.php.net/manual/en/migration51.oop.php#migration51.oop-methods
24
- *
25
  * PHP version 5.1
26
  *
 
 
27
  * @since 9.2.0
28
  */
29
  class ForbiddenAbstractPrivateMethodsSniff extends Sniff
17
  * Abstract private methods are not allowed since PHP 5.1.
18
  *
19
  * Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but
20
+ * were then disallowed on the grounds that the behaviours of `private` and `abstract`
21
  * are mutually exclusive.
22
  *
 
 
23
  * PHP version 5.1
24
  *
25
+ * @link https://www.php.net/manual/en/migration51.oop.php#migration51.oop-methods
26
+ *
27
  * @since 9.2.0
28
  */
29
  class ForbiddenAbstractPrivateMethodsSniff extends Sniff
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewAnonymousClassesSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Classes\NewAnonymousClasses.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Classes;
@@ -16,15 +15,14 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Classes\NewAnonymousClasses.
20
- *
21
- * Anonymous classes are supported in PHP 7.0
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim.godden@cu.be>
 
28
  */
29
  class NewAnonymousClassesSniff extends Sniff
30
  {
@@ -35,6 +33,8 @@ class NewAnonymousClassesSniff extends Sniff
35
  * The dedicated anonymous class token is added from the `register()`
36
  * method if the token is available.
37
  *
 
 
38
  * @var array
39
  */
40
  private $indicators = array(
@@ -44,6 +44,8 @@ class NewAnonymousClassesSniff extends Sniff
44
  /**
45
  * Returns an array of tokens this test wants to listen for.
46
  *
 
 
47
  * @return array
48
  */
49
  public function register()
@@ -59,6 +61,8 @@ class NewAnonymousClassesSniff extends Sniff
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
 
 
62
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
63
  * @param int $stackPtr The position of the current token in the
64
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Classes;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Anonymous classes are supported since PHP 7.0.
 
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/language.oop5.anonymous.php
23
+ * @link https://wiki.php.net/rfc/anonymous_classes
24
+ *
25
+ * @since 7.0.0
26
  */
27
  class NewAnonymousClassesSniff extends Sniff
28
  {
33
  * The dedicated anonymous class token is added from the `register()`
34
  * method if the token is available.
35
  *
36
+ * @since 7.1.2
37
+ *
38
  * @var array
39
  */
40
  private $indicators = array(
44
  /**
45
  * Returns an array of tokens this test wants to listen for.
46
  *
47
+ * @since 7.0.0
48
+ *
49
  * @return array
50
  */
51
  public function register()
61
  /**
62
  * Processes this test, when one of its tokens is encountered.
63
  *
64
+ * @since 7.0.0
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.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Classes\NewClassesSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2013 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Classes;
@@ -14,12 +14,21 @@ use PHPCompatibility\AbstractNewFeatureSniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\Classes\NewClassesSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
22
- * @copyright 2013 Cu.be Solutions bvba
 
 
 
 
 
 
 
 
 
23
  */
24
  class NewClassesSniff extends AbstractNewFeatureSniff
25
  {
@@ -30,6 +39,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
30
  * The array lists : version number with false (not present) or true (present).
31
  * If's sufficient to list the first version where the class appears.
32
  *
 
 
33
  * @var array(string => array(string => bool))
34
  */
35
  protected $newClasses = array(
@@ -385,6 +396,26 @@ class NewClassesSniff extends AbstractNewFeatureSniff
385
  '7.1' => true,
386
  ),
387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  );
389
 
390
  /**
@@ -396,9 +427,11 @@ class NewClassesSniff extends AbstractNewFeatureSniff
396
  * {@internal Classes listed here do not need to be added to the $newClasses
397
  * property as well.
398
  * This list is automatically added to the $newClasses property
399
- * in the `register()` method.}}
 
 
400
  *
401
- * {@internal Helper to update this list: https://3v4l.org/MhlUp}}
402
  *
403
  * @var array(string => array(string => bool))
404
  */
@@ -566,7 +599,11 @@ class NewClassesSniff extends AbstractNewFeatureSniff
566
  '7.3' => true,
567
  ),
568
 
569
- 'ReflectionReference' => array(
 
 
 
 
570
  '7.3' => false,
571
  '7.4' => true,
572
  ),
@@ -576,6 +613,17 @@ class NewClassesSniff extends AbstractNewFeatureSniff
576
  /**
577
  * Returns an array of tokens this test wants to listen for.
578
  *
 
 
 
 
 
 
 
 
 
 
 
579
  * @return array
580
  */
581
  public function register()
@@ -611,6 +659,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
611
  /**
612
  * Processes this test, when one of its tokens is encountered.
613
  *
 
 
614
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
615
  * @param int $stackPtr The position of the current token in
616
  * the stack passed in $tokens.
@@ -652,6 +702,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
652
  /**
653
  * Processes this test for when a token resulting in a singular class name is encountered.
654
  *
 
 
655
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
656
  * @param int $stackPtr The position of the current token in
657
  * the stack passed in $tokens.
@@ -695,7 +747,9 @@ class NewClassesSniff extends AbstractNewFeatureSniff
695
  /**
696
  * Processes this test for when a function token is encountered.
697
  *
698
- * - Detect new classes when used as a type hint.
 
 
699
  *
700
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
701
  * @param int $stackPtr The position of the current token in
@@ -731,6 +785,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
731
  *
732
  * - Detect exceptions when used in a catch statement.
733
  *
 
 
734
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
735
  * @param int $stackPtr The position of the current token in
736
  * the stack passed in $tokens.
@@ -797,6 +853,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
797
  *
798
  * - Detect new classes when used as a return type declaration.
799
  *
 
 
800
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
801
  * @param int $stackPtr The position of the current token in
802
  * the stack passed in $tokens.
@@ -805,7 +863,11 @@ class NewClassesSniff extends AbstractNewFeatureSniff
805
  */
806
  private function processReturnTypeToken(File $phpcsFile, $stackPtr)
807
  {
808
- $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
 
 
 
 
809
  $returnTypeHint = ltrim($returnTypeHint, '\\');
810
  $returnTypeHintLc = strtolower($returnTypeHint);
811
 
@@ -825,6 +887,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
825
  /**
826
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
827
  *
 
 
828
  * @param array $itemInfo Base information about the item.
829
  *
830
  * @return array Version and other information about the item.
@@ -838,6 +902,8 @@ class NewClassesSniff extends AbstractNewFeatureSniff
838
  /**
839
  * Get the error message template for this sniff.
840
  *
 
 
841
  * @return string
842
  */
843
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Classes;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of new PHP native classes.
18
  *
19
+ * The sniff analyses the following constructs to find usage of new classes:
20
+ * - Class instantiation using the `new` keyword.
21
+ * - (Anonymous) Class declarations to detect new classes being extended by userland classes.
22
+ * - Static use of class properties, constants or functions using the double colon.
23
+ * - Function/closure declarations to detect new classes used as parameter type declarations.
24
+ * - Function/closure declarations to detect new classes used as return type declarations.
25
+ * - Try/catch statements to detect new exception classes being caught.
26
+ *
27
+ * PHP version All
28
+ *
29
+ * @since 5.5
30
+ * @since 5.6 Now extends the base `Sniff` class.
31
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` class.
32
  */
33
  class NewClassesSniff extends AbstractNewFeatureSniff
34
  {
39
  * The array lists : version number with false (not present) or true (present).
40
  * If's sufficient to list the first version where the class appears.
41
  *
42
+ * @since 5.5
43
+ *
44
  * @var array(string => array(string => bool))
45
  */
46
  protected $newClasses = array(
396
  '7.1' => true,
397
  ),
398
 
399
+ 'FFI' => array(
400
+ '7.3' => false,
401
+ '7.4' => true,
402
+ ),
403
+ 'FFI\CData' => array(
404
+ '7.3' => false,
405
+ '7.4' => true,
406
+ ),
407
+ 'FFI\CType' => array(
408
+ '7.3' => false,
409
+ '7.4' => true,
410
+ ),
411
+ 'ReflectionReference' => array(
412
+ '7.3' => false,
413
+ '7.4' => true,
414
+ ),
415
+ 'WeakReference' => array(
416
+ '7.3' => false,
417
+ '7.4' => true,
418
+ ),
419
  );
420
 
421
  /**
427
  * {@internal Classes listed here do not need to be added to the $newClasses
428
  * property as well.
429
  * This list is automatically added to the $newClasses property
430
+ * in the `register()` method.}
431
+ *
432
+ * {@internal Helper to update this list: https://3v4l.org/MhlUp}
433
  *
434
+ * @since 7.1.4
435
  *
436
  * @var array(string => array(string => bool))
437
  */
599
  '7.3' => true,
600
  ),
601
 
602
+ 'FFI\Exception' => array(
603
+ '7.3' => false,
604
+ '7.4' => true,
605
+ ),
606
+ 'FFI\ParserException' => array(
607
  '7.3' => false,
608
  '7.4' => true,
609
  ),
613
  /**
614
  * Returns an array of tokens this test wants to listen for.
615
  *
616
+ * @since 5.5
617
+ * @since 7.0.3 - Now also targets the `class` keyword to detect extended classes.
618
+ * - Now also targets double colons to detect static class use.
619
+ * @since 7.1.4 - Now also targets anonymous classes to detect extended classes.
620
+ * - Now also targets functions/closures to detect new classes used
621
+ * as parameter type declarations.
622
+ * - Now also targets the `catch` control structure to detect new
623
+ * exception classes being caught.
624
+ * @since 8.2.0 Now also targets the `T_RETURN_TYPE` token to detect new classes used
625
+ * as return type declarations.
626
+ *
627
  * @return array
628
  */
629
  public function register()
659
  /**
660
  * Processes this test, when one of its tokens is encountered.
661
  *
662
+ * @since 5.5
663
+ *
664
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
665
  * @param int $stackPtr The position of the current token in
666
  * the stack passed in $tokens.
702
  /**
703
  * Processes this test for when a token resulting in a singular class name is encountered.
704
  *
705
+ * @since 7.1.4
706
+ *
707
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
708
  * @param int $stackPtr The position of the current token in
709
  * the stack passed in $tokens.
747
  /**
748
  * Processes this test for when a function token is encountered.
749
  *
750
+ * - Detect new classes when used as a parameter type declaration.
751
+ *
752
+ * @since 7.1.4
753
  *
754
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
755
  * @param int $stackPtr The position of the current token in
785
  *
786
  * - Detect exceptions when used in a catch statement.
787
  *
788
+ * @since 7.1.4
789
+ *
790
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
791
  * @param int $stackPtr The position of the current token in
792
  * the stack passed in $tokens.
853
  *
854
  * - Detect new classes when used as a return type declaration.
855
  *
856
+ * @since 8.2.0
857
+ *
858
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
859
  * @param int $stackPtr The position of the current token in
860
  * the stack passed in $tokens.
863
  */
864
  private function processReturnTypeToken(File $phpcsFile, $stackPtr)
865
  {
866
+ $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
867
+ if (empty($returnTypeHint)) {
868
+ return;
869
+ }
870
+
871
  $returnTypeHint = ltrim($returnTypeHint, '\\');
872
  $returnTypeHintLc = strtolower($returnTypeHint);
873
 
887
  /**
888
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
889
  *
890
+ * @since 7.1.0
891
+ *
892
  * @param array $itemInfo Base information about the item.
893
  *
894
  * @return array Version and other information about the item.
902
  /**
903
  * Get the error message template for this sniff.
904
  *
905
+ * @since 7.1.0
906
+ *
907
  * @return string
908
  */
909
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Classes\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
  namespace PHPCompatibility\Sniffs\Classes;
@@ -16,21 +15,22 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Classes\NewConstVisibility.
20
- *
21
  * Visibility for class constants is available since PHP 7.1.
22
  *
23
  * PHP version 7.1
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
28
  */
29
  class NewConstVisibilitySniff extends Sniff
30
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,6 +41,8 @@ class NewConstVisibilitySniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token
46
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Classes;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
 
 
18
  * Visibility for class constants is available since PHP 7.1.
19
  *
20
  * PHP version 7.1
21
  *
22
+ * @link https://wiki.php.net/rfc/class_const_visibility
23
+ * @link https://www.php.net/manual/en/language.oop5.constants.php#language.oop5.basic.class.this
24
+ *
25
+ * @since 7.0.7
26
  */
27
  class NewConstVisibilitySniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
32
+ * @since 7.0.7
33
+ *
34
  * @return array
35
  */
36
  public function register()
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
44
+ * @since 7.0.7
45
+ *
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token
48
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewLateStaticBindingSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Classes\NewLateStaticBindingSniff.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Classes;
@@ -16,19 +15,27 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Classes\NewLateStaticBindingSniff.
 
 
 
 
20
  *
21
  * PHP version 5.3
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
26
  */
27
  class NewLateStaticBindingSniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -40,6 +47,8 @@ class NewLateStaticBindingSniff extends Sniff
40
  /**
41
  * Processes this test, when one of its tokens is encountered.
42
  *
 
 
43
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
44
  * @param int $stackPtr The position of the current token in the
45
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Classes;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of late static binding as introduced in PHP 5.3.
19
+ *
20
+ * Checks for:
21
+ * - Late static binding as introduced in PHP 5.3.
22
+ * - Late static binding being used outside of class scope (unsupported).
23
  *
24
  * PHP version 5.3
25
  *
26
+ * @link https://www.php.net/manual/en/language.oop5.late-static-bindings.php
27
+ * @link https://wiki.php.net/rfc/lsb_parentself_forwarding
28
+ *
29
+ * @since 7.0.3
30
+ * @since 9.0.0 Renamed from `LateStaticBindingSniff` to `NewLateStaticBindingSniff`.
31
  */
32
  class NewLateStaticBindingSniff extends Sniff
33
  {
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
37
+ * @since 7.0.3
38
+ *
39
  * @return array
40
  */
41
  public function register()
47
  /**
48
  * Processes this test, when one of its tokens is encountered.
49
  *
50
+ * @since 7.0.3
51
+ *
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token in the
54
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/NewTypedPropertiesSniff.php CHANGED
@@ -15,10 +15,11 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * Typed properties are available since PHP 7.4.
19
  *
20
  * PHP version 7.4
21
  *
 
22
  * @link https://wiki.php.net/rfc/typed_properties_v2
23
  *
24
  * @since 9.2.0
@@ -29,6 +30,8 @@ class NewTypedPropertiesSniff extends Sniff
29
  /**
30
  * Valid property modifier keywords.
31
  *
 
 
32
  * @var array
33
  */
34
  private $modifierKeywords = array(
@@ -43,6 +46,8 @@ class NewTypedPropertiesSniff extends Sniff
43
  /**
44
  * Returns an array of tokens this test wants to listen for.
45
  *
 
 
46
  * @return array
47
  */
48
  public function register()
@@ -53,6 +58,8 @@ class NewTypedPropertiesSniff extends Sniff
53
  /**
54
  * Processes this test, when one of its tokens is encountered.
55
  *
 
 
56
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
57
  * @param int $stackPtr The position of the current token in the
58
  * stack passed in $tokens.
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Typed class property declarations are available since PHP 7.4.
19
  *
20
  * PHP version 7.4
21
  *
22
+ * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.typed-properties
23
  * @link https://wiki.php.net/rfc/typed_properties_v2
24
  *
25
  * @since 9.2.0
30
  /**
31
  * Valid property modifier keywords.
32
  *
33
+ * @since 9.2.0
34
+ *
35
  * @var array
36
  */
37
  private $modifierKeywords = array(
46
  /**
47
  * Returns an array of tokens this test wants to listen for.
48
  *
49
+ * @since 9.2.0
50
+ *
51
  * @return array
52
  */
53
  public function register()
58
  /**
59
  * Processes this test, when one of its tokens is encountered.
60
  *
61
+ * @since 9.2.0
62
+ *
63
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
  * @param int $stackPtr The position of the current token in the
65
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Classes/RemovedOrphanedParentSniff.php CHANGED
@@ -14,15 +14,15 @@ use PHPCompatibility\Sniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * Using "parent" inside a class without parent is deprecated since PHP 7.4.
18
  *
19
  * This will throw a compile-time error in the future. Currently an error will only
20
  * be generated if/when the parent is accessed at run-time.
21
  *
22
- * @link https://github.com/php/php-src/blob/42cc58ff7b2fee1c17a00dc77a4873552ffb577f/UPGRADING#L303
23
- *
24
  * PHP version 7.4
25
  *
 
 
26
  * @since 9.2.0
27
  */
28
  class RemovedOrphanedParentSniff extends Sniff
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Using `parent` inside a class without parent is deprecated since PHP 7.4.
18
  *
19
  * This will throw a compile-time error in the future. Currently an error will only
20
  * be generated if/when the parent is accessed at run-time.
21
  *
 
 
22
  * PHP version 7.4
23
  *
24
+ * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.parent
25
+ *
26
  * @since 9.2.0
27
  */
28
  class RemovedOrphanedParentSniff extends Sniff
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Constants\NewConstantsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Constants;
@@ -13,11 +14,11 @@ use PHPCompatibility\AbstractNewFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\Constants\NewConstantsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
21
  */
22
  class NewConstantsSniff extends AbstractNewFeatureSniff
23
  {
@@ -28,9 +29,11 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
28
  * The array lists : version number with false (not present) or true (present).
29
  * If's sufficient to list the first version where the constant appears.
30
  *
31
- * Note: PHP Constants are case-sensitive!
 
 
32
  *
33
- * @var array(string => array(string => bool|string|null))
34
  */
35
  protected $newConstants = array(
36
  'E_STRICT' => array(
@@ -2687,6 +2690,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
2687
  '7.1' => false,
2688
  '7.2' => true,
2689
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2690
  'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
2691
  '7.1' => false,
2692
  '7.2' => true,
@@ -2735,6 +2754,22 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
2735
  '7.1' => false,
2736
  '7.2' => true,
2737
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2738
  'SODIUM_CRYPTO_AUTH_BYTES' => array(
2739
  '7.1' => false,
2740
  '7.2' => true,
@@ -2835,6 +2870,10 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
2835
  '7.1' => false,
2836
  '7.2' => true,
2837
  ),
 
 
 
 
2838
  'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array(
2839
  '7.1' => false,
2840
  '7.2' => true,
@@ -2923,6 +2962,38 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
2923
  '7.1' => false,
2924
  '7.2' => true,
2925
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2926
  'SODIUM_CRYPTO_SIGN_BYTES' => array(
2927
  '7.1' => false,
2928
  '7.2' => true,
@@ -3445,6 +3516,19 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3445
  '7.3' => true,
3446
  ),
3447
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3448
  'MB_ONIGURUMA_VERSION' => array(
3449
  '7.3' => false,
3450
  '7.4' => true,
@@ -3469,6 +3553,10 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3469
  '7.3' => false,
3470
  '7.4' => true,
3471
  ),
 
 
 
 
3472
  'PHP_WINDOWS_EVENT_CTRL_C' => array(
3473
  '7.3' => false,
3474
  '7.4' => true,
@@ -3477,6 +3565,10 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3477
  '7.3' => false,
3478
  '7.4' => true,
3479
  ),
 
 
 
 
3480
  'TIDY_TAG_ARTICLE' => array(
3481
  '7.3' => false,
3482
  '7.4' => true,
@@ -3595,6 +3687,8 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3595
  /**
3596
  * Returns an array of tokens this test wants to listen for.
3597
  *
 
 
3598
  * @return array
3599
  */
3600
  public function register()
@@ -3605,6 +3699,8 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3605
  /**
3606
  * Processes this test, when one of its tokens is encountered.
3607
  *
 
 
3608
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
3609
  * @param int $stackPtr The position of the current token in the
3610
  * stack passed in $tokens.
@@ -3634,6 +3730,8 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3634
  /**
3635
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
3636
  *
 
 
3637
  * @param array $itemInfo Base information about the item.
3638
  *
3639
  * @return array Version and other information about the item.
@@ -3647,6 +3745,8 @@ class NewConstantsSniff extends AbstractNewFeatureSniff
3647
  /**
3648
  * Get the error message template for this sniff.
3649
  *
 
 
3650
  * @return string
3651
  */
3652
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Constants;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of new PHP native global constants.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @since 8.1.0
22
  */
23
  class NewConstantsSniff extends AbstractNewFeatureSniff
24
  {
29
  * The array lists : version number with false (not present) or true (present).
30
  * If's sufficient to list the first version where the constant appears.
31
  *
32
+ * Note: PHP constants are case-sensitive!
33
+ *
34
+ * @since 8.1.0
35
  *
36
+ * @var array(string => array(string => bool))
37
  */
38
  protected $newConstants = array(
39
  'E_STRICT' => array(
2690
  '7.1' => false,
2691
  '7.2' => true,
2692
  ),
2693
+ 'SODIUM_BASE64_VARIANT_ORIGINAL' => array(
2694
+ '7.1' => false,
2695
+ '7.2' => true,
2696
+ ),
2697
+ 'SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING' => array(
2698
+ '7.1' => false,
2699
+ '7.2' => true,
2700
+ ),
2701
+ 'SODIUM_BASE64_VARIANT_URLSAFE' => array(
2702
+ '7.1' => false,
2703
+ '7.2' => true,
2704
+ ),
2705
+ 'SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING' => array(
2706
+ '7.1' => false,
2707
+ '7.2' => true,
2708
+ ),
2709
  'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
2710
  '7.1' => false,
2711
  '7.2' => true,
2754
  '7.1' => false,
2755
  '7.2' => true,
2756
  ),
2757
+ 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES' => array(
2758
+ '7.1' => false,
2759
+ '7.2' => true,
2760
+ ),
2761
+ 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NSECBYTES' => array(
2762
+ '7.1' => false,
2763
+ '7.2' => true,
2764
+ ),
2765
+ 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES' => array(
2766
+ '7.1' => false,
2767
+ '7.2' => true,
2768
+ ),
2769
+ 'SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_ABYTES' => array(
2770
+ '7.1' => false,
2771
+ '7.2' => true,
2772
+ ),
2773
  'SODIUM_CRYPTO_AUTH_BYTES' => array(
2774
  '7.1' => false,
2775
  '7.2' => true,
2870
  '7.1' => false,
2871
  '7.2' => true,
2872
  ),
2873
+ 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13' => array(
2874
+ '7.1' => false,
2875
+ '7.2' => true,
2876
+ ),
2877
  'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array(
2878
  '7.1' => false,
2879
  '7.2' => true,
2962
  '7.1' => false,
2963
  '7.2' => true,
2964
  ),
2965
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES' => array(
2966
+ '7.1' => false,
2967
+ '7.2' => true,
2968
+ ),
2969
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES' => array(
2970
+ '7.1' => false,
2971
+ '7.2' => true,
2972
+ ),
2973
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES' => array(
2974
+ '7.1' => false,
2975
+ '7.2' => true,
2976
+ ),
2977
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX' => array(
2978
+ '7.1' => false,
2979
+ '7.2' => true,
2980
+ ),
2981
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE' => array(
2982
+ '7.1' => false,
2983
+ '7.2' => true,
2984
+ ),
2985
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH' => array(
2986
+ '7.1' => false,
2987
+ '7.2' => true,
2988
+ ),
2989
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY' => array(
2990
+ '7.1' => false,
2991
+ '7.2' => true,
2992
+ ),
2993
+ 'SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL' => array(
2994
+ '7.1' => false,
2995
+ '7.2' => true,
2996
+ ),
2997
  'SODIUM_CRYPTO_SIGN_BYTES' => array(
2998
  '7.1' => false,
2999
  '7.2' => true,
3516
  '7.3' => true,
3517
  ),
3518
 
3519
+ 'CURL_VERSION_ALTSVC' => array(
3520
+ '7.3.5' => false,
3521
+ '7.3.6' => true,
3522
+ ),
3523
+ 'CURL_VERSION_CURLDEBUG' => array(
3524
+ '7.3.5' => false,
3525
+ '7.3.6' => true,
3526
+ ),
3527
+
3528
+ 'IMG_FILTER_SCATTER' => array(
3529
+ '7.3' => false,
3530
+ '7.4' => true,
3531
+ ),
3532
  'MB_ONIGURUMA_VERSION' => array(
3533
  '7.3' => false,
3534
  '7.4' => true,
3553
  '7.3' => false,
3554
  '7.4' => true,
3555
  ),
3556
+ 'PASSWORD_ARGON2_PROVIDER' => array(
3557
+ '7.3' => false,
3558
+ '7.4' => true,
3559
+ ),
3560
  'PHP_WINDOWS_EVENT_CTRL_C' => array(
3561
  '7.3' => false,
3562
  '7.4' => true,
3565
  '7.3' => false,
3566
  '7.4' => true,
3567
  ),
3568
+ 'T_BAD_CHARACTER' => array(
3569
+ '7.3' => false,
3570
+ '7.4' => true,
3571
+ ),
3572
  'TIDY_TAG_ARTICLE' => array(
3573
  '7.3' => false,
3574
  '7.4' => true,
3687
  /**
3688
  * Returns an array of tokens this test wants to listen for.
3689
  *
3690
+ * @since 8.1.0
3691
+ *
3692
  * @return array
3693
  */
3694
  public function register()
3699
  /**
3700
  * Processes this test, when one of its tokens is encountered.
3701
  *
3702
+ * @since 8.1.0
3703
+ *
3704
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
3705
  * @param int $stackPtr The position of the current token in the
3706
  * stack passed in $tokens.
3730
  /**
3731
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
3732
  *
3733
+ * @since 8.1.0
3734
+ *
3735
  * @param array $itemInfo Base information about the item.
3736
  *
3737
  * @return array Version and other information about the item.
3745
  /**
3746
  * Get the error message template for this sniff.
3747
  *
3748
+ * @since 8.1.0
3749
+ *
3750
  * @return string
3751
  */
3752
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/NewMagicClassConstantSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Constants\NewMagicClassConstantSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Constants;
@@ -16,16 +15,18 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Constants\NewMagicClassConstantSniff.
20
  *
21
- * The special ClassName::class constant is available as of PHP 5.5.0, and allows for
22
- * fully qualified class name resolution at compile.
23
  *
24
  * PHP version 5.5
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
29
  */
30
  class NewMagicClassConstantSniff extends Sniff
31
  {
@@ -33,6 +34,8 @@ class NewMagicClassConstantSniff extends Sniff
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
 
 
36
  * @return array
37
  */
38
  public function register()
@@ -43,6 +46,8 @@ class NewMagicClassConstantSniff extends Sniff
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
 
 
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token in the
48
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Constants;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect usage of the magic `::class` constant introduced in PHP 5.5.
19
  *
20
+ * The special `ClassName::class` constant is available as of PHP 5.5.0, and allows
21
+ * for fully qualified class name resolution at compile time.
22
  *
23
  * PHP version 5.5
24
  *
25
+ * @link https://wiki.php.net/rfc/class_name_scalars
26
+ * @link https://www.php.net/manual/en/language.oop5.constants.php#example-186
27
+ *
28
+ * @since 7.1.4
29
+ * @since 7.1.5 Removed the incorrect checks against invalid usage of the constant.
30
  */
31
  class NewMagicClassConstantSniff extends Sniff
32
  {
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
37
+ * @since 7.1.4
38
+ *
39
  * @return array
40
  */
41
  public function register()
46
  /**
47
  * Processes this test, when one of its tokens is encountered.
48
  *
49
+ * @since 7.1.4
50
+ *
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token in the
53
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Constants/RemovedConstantsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Constants\RemovedConstantsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Constants;
@@ -13,11 +14,11 @@ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\Constants\RemovedConstantsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
21
  */
22
  class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
23
  {
@@ -28,9 +29,14 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
28
  * The array lists : version number with false (deprecated) or true (removed).
29
  * If's sufficient to list the first version where the constant was deprecated/removed.
30
  *
 
 
 
31
  * Note: PHP Constants are case-sensitive!
32
  *
33
- * @var array(string => array(string => bool|string|null))
 
 
34
  */
35
  protected $removedConstants = array(
36
  // Disabled since PHP 5.3.0 due to thread safety issues.
@@ -60,6 +66,12 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
60
  'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array(
61
  '7.0' => true,
62
  ),
 
 
 
 
 
 
63
 
64
  'INTL_IDNA_VARIANT_2003' => array(
65
  '7.2' => false,
@@ -293,6 +305,13 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
293
  '7.3' => false,
294
  ),
295
 
 
 
 
 
 
 
 
296
  'IBASE_BKP_CONVERT' => array(
297
  '7.4' => true,
298
  ),
@@ -485,6 +504,8 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
485
  /**
486
  * Returns an array of tokens this test wants to listen for.
487
  *
 
 
488
  * @return array
489
  */
490
  public function register()
@@ -496,6 +517,8 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
496
  /**
497
  * Processes this test, when one of its tokens is encountered.
498
  *
 
 
499
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
500
  * @param int $stackPtr The position of the current token in
501
  * the stack passed in $tokens.
@@ -525,6 +548,8 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
525
  /**
526
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
527
  *
 
 
528
  * @param array $itemInfo Base information about the item.
529
  *
530
  * @return array Version and other information about the item.
@@ -538,6 +563,8 @@ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
538
  /**
539
  * Get the error message template for this sniff.
540
  *
 
 
541
  * @return string
542
  */
543
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Constants;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of deprecated and/or removed PHP native global constants.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @since 8.1.0
22
  */
23
  class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
24
  {
29
  * The array lists : version number with false (deprecated) or true (removed).
30
  * If's sufficient to list the first version where the constant was deprecated/removed.
31
  *
32
+ * Optional, the array can contain an `alternative` key listing an alternative constant
33
+ * to be used instead.
34
+ *
35
  * Note: PHP Constants are case-sensitive!
36
  *
37
+ * @since 8.1.0
38
+ *
39
+ * @var array(string => array(string => bool|string))
40
  */
41
  protected $removedConstants = array(
42
  // Disabled since PHP 5.3.0 due to thread safety issues.
66
  'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array(
67
  '7.0' => true,
68
  ),
69
+ 'T_CHARACTER' => array(
70
+ '7.0' => true,
71
+ ),
72
+ 'T_BAD_CHARACTER' => array(
73
+ '7.0' => true,
74
+ ),
75
 
76
  'INTL_IDNA_VARIANT_2003' => array(
77
  '7.2' => false,
305
  '7.3' => false,
306
  ),
307
 
308
+ 'CURLPIPE_HTTP1' => array(
309
+ '7.4' => false,
310
+ ),
311
+ 'FILTER_SANITIZE_MAGIC_QUOTES' => array(
312
+ '7.4' => false,
313
+ 'alternative' => 'FILTER_SANITIZE_ADD_SLASHES',
314
+ ),
315
  'IBASE_BKP_CONVERT' => array(
316
  '7.4' => true,
317
  ),
504
  /**
505
  * Returns an array of tokens this test wants to listen for.
506
  *
507
+ * @since 8.1.0
508
+ *
509
  * @return array
510
  */
511
  public function register()
517
  /**
518
  * Processes this test, when one of its tokens is encountered.
519
  *
520
+ * @since 8.1.0
521
+ *
522
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
523
  * @param int $stackPtr The position of the current token in
524
  * the stack passed in $tokens.
548
  /**
549
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
550
  *
551
+ * @since 8.1.0
552
+ *
553
  * @param array $itemInfo Base information about the item.
554
  *
555
  * @return array Version and other information about the item.
563
  /**
564
  * Get the error message template for this sniff.
565
  *
566
+ * @since 8.1.0
567
+ *
568
  * @return string
569
  */
570
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/DiscouragedSwitchContinueSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\DiscouragedSwitchContinue.
4
  *
5
- * PHP version 7.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -16,15 +15,21 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\ControlStructures\DiscouragedSwitchContinue.
20
  *
21
- * PHP 7.3 will throw a warning when continue is used to target a switch control structure.
 
 
22
  *
23
  * PHP version 7.3
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
28
  */
29
  class DiscouragedSwitchContinueSniff extends Sniff
30
  {
@@ -32,6 +37,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
32
  /**
33
  * Token codes of control structures which can be targeted using continue.
34
  *
 
 
35
  * @var array
36
  */
37
  protected $loopStructures = array(
@@ -45,6 +52,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
45
  /**
46
  * Tokens which start a new case within a switch.
47
  *
 
 
48
  * @var array
49
  */
50
  protected $caseTokens = array(
@@ -57,6 +66,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
57
  *
58
  * This array is enriched with the arithmetic operators in the register() method.
59
  *
 
 
60
  * @var array
61
  */
62
  protected $acceptedLevelTokens = array(
@@ -69,6 +80,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
69
  /**
70
  * Returns an array of tokens this test wants to listen for.
71
  *
 
 
72
  * @return array
73
  */
74
  public function register()
@@ -82,6 +95,8 @@ class DiscouragedSwitchContinueSniff extends Sniff
82
  /**
83
  * Processes this test, when one of its tokens is encountered.
84
  *
 
 
85
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
86
  * @param int $stackPtr The position of the current token in the
87
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of `continue` in `switch` control structures.
19
  *
20
+ * As of PHP 7.3, PHP will throw a warning when `continue` is used to target a `switch`
21
+ * control structure.
22
+ * The sniff takes numeric arguments used with `continue` into account.
23
  *
24
  * PHP version 7.3
25
  *
26
+ * @link https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.continue-targeting-switch
27
+ * @link https://wiki.php.net/rfc/continue_on_switch_deprecation
28
+ * @link https://github.com/php/php-src/commit/04e3523b7d095341f65ed5e71a3cac82fca690e4
29
+ * (actual implementation which is different from the RFC).
30
+ * @link https://www.php.net/manual/en/control-structures.switch.php
31
+ *
32
+ * @since 8.2.0
33
  */
34
  class DiscouragedSwitchContinueSniff extends Sniff
35
  {
37
  /**
38
  * Token codes of control structures which can be targeted using continue.
39
  *
40
+ * @since 8.2.0
41
+ *
42
  * @var array
43
  */
44
  protected $loopStructures = array(
52
  /**
53
  * Tokens which start a new case within a switch.
54
  *
55
+ * @since 8.2.0
56
+ *
57
  * @var array
58
  */
59
  protected $caseTokens = array(
66
  *
67
  * This array is enriched with the arithmetic operators in the register() method.
68
  *
69
+ * @since 8.2.0
70
+ *
71
  * @var array
72
  */
73
  protected $acceptedLevelTokens = array(
80
  /**
81
  * Returns an array of tokens this test wants to listen for.
82
  *
83
+ * @since 8.2.0
84
+ *
85
  * @return array
86
  */
87
  public function register()
95
  /**
96
  * Processes this test, when one of its tokens is encountered.
97
  *
98
+ * @since 8.2.0
99
+ *
100
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
101
  * @param int $stackPtr The position of the current token in the
102
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueOutsideLoopSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenBreakContinueOutsideLoop.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,15 +14,15 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenBreakContinueOutsideLoop.
19
- *
20
- * Forbids use of break or continue statements outside of looping structures.
21
  *
22
  * PHP version 7.0
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
27
  */
28
  class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
29
  {
@@ -31,6 +30,8 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
31
  /**
32
  * Token codes of control structure in which usage of break/continue is valid.
33
  *
 
 
34
  * @var array
35
  */
36
  protected $validLoopStructures = array(
@@ -44,6 +45,8 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
44
  /**
45
  * Token codes which did not correctly get a condition assigned in older PHPCS versions.
46
  *
 
 
47
  * @var array
48
  */
49
  protected $backCompat = array(
@@ -54,6 +57,8 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
54
  /**
55
  * Returns an array of tokens this test wants to listen for.
56
  *
 
 
57
  * @return array
58
  */
59
  public function register()
@@ -67,6 +72,8 @@ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
67
  /**
68
  * Processes this test, when one of its tokens is encountered.
69
  *
 
 
70
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
71
  * @param int $stackPtr The position of the current token in the
72
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect using `break` and/or `continue` statements outside of a looping structure.
 
 
18
  *
19
  * PHP version 7.0
20
  *
21
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.break-continue
22
+ * @link https://www.php.net/manual/en/control-structures.break.php
23
+ * @link https://www.php.net/manual/en/control-structures.continue.php
24
+ *
25
+ * @since 7.0.7
26
  */
27
  class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
28
  {
30
  /**
31
  * Token codes of control structure in which usage of break/continue is valid.
32
  *
33
+ * @since 7.0.7
34
+ *
35
  * @var array
36
  */
37
  protected $validLoopStructures = array(
45
  /**
46
  * Token codes which did not correctly get a condition assigned in older PHPCS versions.
47
  *
48
+ * @since 7.0.7
49
+ *
50
  * @var array
51
  */
52
  protected $backCompat = array(
57
  /**
58
  * Returns an array of tokens this test wants to listen for.
59
  *
60
+ * @since 7.0.7
61
+ *
62
  * @return array
63
  */
64
  public function register()
72
  /**
73
  * Processes this test, when one of its tokens is encountered.
74
  *
75
+ * @since 7.0.7
76
+ *
77
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
78
  * @param int $stackPtr The position of the current token in the
79
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenBreakContinueVariableArguments.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
- * @copyright 2012 Cu.be Solutions bvba
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -17,16 +15,20 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenBreakContinueVariableArguments.
21
  *
22
- * Forbids variable arguments on break or continue statements.
 
 
23
  *
24
  * PHP version 5.4
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Wim Godden <wim.godden@cu.be>
29
- * @copyright 2012 Cu.be Solutions bvba
 
 
30
  */
31
  class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
32
  {
@@ -35,6 +37,9 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
35
  *
36
  * Array key is the error code. Array value will be used as part of the error message.
37
  *
 
 
 
38
  * @var array
39
  */
40
  private $errorTypes = array(
@@ -45,6 +50,8 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
45
  /**
46
  * Returns an array of tokens this test wants to listen for.
47
  *
 
 
48
  * @return array
49
  */
50
  public function register()
@@ -55,6 +62,8 @@ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
55
  /**
56
  * Processes this test, when one of its tokens is encountered.
57
  *
 
 
58
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
59
  * @param int $stackPtr The position of the current token in the
60
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detects using 0 and variable numeric arguments on `break` and `continue` statements.
19
  *
20
+ * This sniff checks for:
21
+ * - Using `break` and/or `continue` with a variable as the numeric argument.
22
+ * - Using `break` and/or `continue` with a zero - 0 - as the numeric argument.
23
  *
24
  * PHP version 5.4
25
  *
26
+ * @link https://www.php.net/manual/en/migration54.incompatible.php
27
+ * @link https://www.php.net/manual/en/control-structures.break.php
28
+ * @link https://www.php.net/manual/en/control-structures.continue.php
29
+ *
30
+ * @since 5.5
31
+ * @since 5.6 Now extends the base `Sniff` class.
32
  */
33
  class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
34
  {
37
  *
38
  * Array key is the error code. Array value will be used as part of the error message.
39
  *
40
+ * @since 7.0.5
41
+ * @since 7.1.0 Changed from class constants to property.
42
+ *
43
  * @var array
44
  */
45
  private $errorTypes = array(
50
  /**
51
  * Returns an array of tokens this test wants to listen for.
52
  *
53
+ * @since 5.5
54
+ *
55
  * @return array
56
  */
57
  public function register()
62
  /**
63
  * Processes this test, when one of its tokens is encountered.
64
  *
65
+ * @since 5.5
66
+ *
67
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
68
  * @param int $stackPtr The position of the current token in the
69
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenSwitchWithMultipleDefaultBlocksSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,15 +14,14 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ControlStructures\ForbiddenSwitchWithMultipleDefaultBlocksSniff.
19
- *
20
- * Switch statements can not have multiple default blocks since PHP 7.0
21
  *
22
  * PHP version 7.0
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Wim Godden <wim@cu.be>
 
27
  */
28
  class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
29
  {
@@ -31,6 +29,8 @@ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,6 +41,8 @@ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token
46
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Switch statements can not have multiple default blocks since PHP 7.0.
 
 
18
  *
19
  * PHP version 7.0
20
  *
21
+ * @link https://wiki.php.net/rfc/switch.default.multiple
22
+ * @link https://www.php.net/manual/en/control-structures.switch.php
23
+ *
24
+ * @since 7.0.0
25
  */
26
  class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
27
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
32
+ * @since 7.0.0
33
+ *
34
  * @return array
35
  */
36
  public function register()
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
44
+ * @since 7.0.0
45
+ *
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token
48
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewExecutionDirectivesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\NewExecutionDirectivesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,11 +16,24 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ControlStructures\NewExecutionDirectivesSniff.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  */
24
  class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
25
  {
@@ -31,7 +45,9 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
31
  * If the execution order is conditional, add the condition as a string to the version nr.
32
  * If's sufficient to list the first version where the execution directive appears.
33
  *
34
- * @var array(string => array(string => int|string|null))
 
 
35
  */
36
  protected $newDirectives = array(
37
  'ticks' => array(
@@ -56,6 +72,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
56
  /**
57
  * Tokens to ignore when trying to find the value for the directive.
58
  *
 
 
59
  * @var array
60
  */
61
  protected $ignoreTokens = array();
@@ -64,6 +82,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
64
  /**
65
  * Returns an array of tokens this test wants to listen for.
66
  *
 
 
67
  * @return array
68
  */
69
  public function register()
@@ -78,6 +98,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
78
  /**
79
  * Processes this test, when one of its tokens is encountered.
80
  *
 
 
81
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
82
  * @param int $stackPtr The position of the current token in
83
  * the stack passed in $tokens.
@@ -141,6 +163,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
141
  /**
142
  * Determine whether an error/warning should be thrown for an item based on collected information.
143
  *
 
 
144
  * @param array $errorInfo Detail information about an item.
145
  *
146
  * @return bool
@@ -154,6 +178,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
154
  /**
155
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
156
  *
 
 
157
  * @param array $itemInfo Base information about the item.
158
  *
159
  * @return array Version and other information about the item.
@@ -167,6 +193,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
167
  /**
168
  * Get an array of the non-PHP-version array keys used in a sub-array.
169
  *
 
 
170
  * @return array
171
  */
172
  protected function getNonVersionArrayKeys()
@@ -181,6 +209,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
181
  /**
182
  * Retrieve the relevant detail (version) information for use in an error message.
183
  *
 
 
184
  * @param array $itemArray Version and other information about the item.
185
  * @param array $itemInfo Base information about the item.
186
  *
@@ -211,6 +241,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
211
  /**
212
  * Get the error message template for this sniff.
213
  *
 
 
214
  * @return string
215
  */
216
  protected function getErrorMsgTemplate()
@@ -222,6 +254,11 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
222
  /**
223
  * Generates the error or warning for this item.
224
  *
 
 
 
 
 
225
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
226
  * @param int $stackPtr The position of the relevant token in
227
  * the stack.
@@ -252,6 +289,9 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
252
  /**
253
  * Generates a error or warning for this sniff.
254
  *
 
 
 
255
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
256
  * @param int $stackPtr The position of the execution directive value
257
  * in the token array.
@@ -298,6 +338,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
298
  *
299
  * Callback function to test whether the value for an execution directive is valid.
300
  *
 
 
301
  * @param mixed $value The value to test.
302
  *
303
  * @return bool
@@ -313,6 +355,8 @@ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
313
  *
314
  * Callback function to test whether the value for an execution directive is valid.
315
  *
 
 
316
  * @param mixed $value The value to test.
317
  *
318
  * @return bool
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Check for valid execution directives set with `declare()`.
20
  *
21
+ * The sniff contains three distinct checks:
22
+ * - Check if the execution directive used is valid. PHP currently only supports
23
+ * three execution directives.
24
+ * - Check if the execution directive used is available in the PHP versions
25
+ * for which support is being checked.
26
+ * In the case of the `encoding` directive on PHP 5.3, support is conditional
27
+ * on the `--enable-zend-multibyte` compilation option. This will be indicated as such.
28
+ * - Check whether the value for the directive is valid.
29
+ *
30
+ * PHP version All
31
+ *
32
+ * @link https://www.php.net/manual/en/control-structures.declare.php
33
+ * @link https://wiki.php.net/rfc/scalar_type_hints_v5#strict_types_declare_directive
34
+ *
35
+ * @since 7.0.3
36
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
37
  */
38
  class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
39
  {
45
  * If the execution order is conditional, add the condition as a string to the version nr.
46
  * If's sufficient to list the first version where the execution directive appears.
47
  *
48
+ * @since 7.0.3
49
+ *
50
+ * @var array(string => array(string => bool|string|array))
51
  */
52
  protected $newDirectives = array(
53
  'ticks' => array(
72
  /**
73
  * Tokens to ignore when trying to find the value for the directive.
74
  *
75
+ * @since 7.0.3
76
+ *
77
  * @var array
78
  */
79
  protected $ignoreTokens = array();
82
  /**
83
  * Returns an array of tokens this test wants to listen for.
84
  *
85
+ * @since 7.0.3
86
+ *
87
  * @return array
88
  */
89
  public function register()
98
  /**
99
  * Processes this test, when one of its tokens is encountered.
100
  *
101
+ * @since 7.0.3
102
+ *
103
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
104
  * @param int $stackPtr The position of the current token in
105
  * the stack passed in $tokens.
163
  /**
164
  * Determine whether an error/warning should be thrown for an item based on collected information.
165
  *
166
+ * @since 7.1.0
167
+ *
168
  * @param array $errorInfo Detail information about an item.
169
  *
170
  * @return bool
178
  /**
179
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
180
  *
181
+ * @since 7.1.0
182
+ *
183
  * @param array $itemInfo Base information about the item.
184
  *
185
  * @return array Version and other information about the item.
193
  /**
194
  * Get an array of the non-PHP-version array keys used in a sub-array.
195
  *
196
+ * @since 7.1.0
197
+ *
198
  * @return array
199
  */
200
  protected function getNonVersionArrayKeys()
209
  /**
210
  * Retrieve the relevant detail (version) information for use in an error message.
211
  *
212
+ * @since 7.1.0
213
+ *
214
  * @param array $itemArray Version and other information about the item.
215
  * @param array $itemInfo Base information about the item.
216
  *
241
  /**
242
  * Get the error message template for this sniff.
243
  *
244
+ * @since 7.1.0
245
+ *
246
  * @return string
247
  */
248
  protected function getErrorMsgTemplate()
254
  /**
255
  * Generates the error or warning for this item.
256
  *
257
+ * @since 7.0.3
258
+ * @since 7.1.0 This method now overloads the method from the `AbstractNewFeatureSniff` class.
259
+ * - Renamed from `maybeAddError()` to `addError()`.
260
+ * - Changed visibility from `protected` to `public`.
261
+ *
262
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
263
  * @param int $stackPtr The position of the relevant token in
264
  * the stack.
289
  /**
290
  * Generates a error or warning for this sniff.
291
  *
292
+ * @since 7.0.3
293
+ * @since 7.0.6 Renamed from `addErrorOnInvalidValue()` to `addWarningOnInvalidValue()`.
294
+ *
295
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
296
  * @param int $stackPtr The position of the execution directive value
297
  * in the token array.
338
  *
339
  * Callback function to test whether the value for an execution directive is valid.
340
  *
341
+ * @since 7.0.3
342
+ *
343
  * @param mixed $value The value to test.
344
  *
345
  * @return bool
355
  *
356
  * Callback function to test whether the value for an execution directive is valid.
357
  *
358
+ * @since 7.0.3
359
+ *
360
  * @param mixed $value The value to test.
361
  *
362
  * @return bool
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\NewForeachExpressionReferencingSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,16 +14,16 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * New `foreach` Expression Referencing.
19
  *
20
- * Before PHP 5.5.0, referencing $value is only possible if the iterated array
21
- * can be referenced (i.e. if it is a variable).
22
  *
23
  * PHP version 5.5
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
  */
29
  class NewForeachExpressionReferencingSniff extends Sniff
30
  {
@@ -32,6 +31,8 @@ class NewForeachExpressionReferencingSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -42,6 +43,8 @@ class NewForeachExpressionReferencingSniff extends Sniff
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
 
 
45
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
46
  * @param int $stackPtr The position of the current token in the
47
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect `foreach` expression referencing.
18
  *
19
+ * Before PHP 5.5.0, referencing `$value` in a `foreach` was only possible
20
+ * if the iterated array could be referenced (i.e. if it is a variable).
21
  *
22
  * PHP version 5.5
23
  *
24
+ * @link https://www.php.net/manual/en/control-structures.foreach.php
25
+ *
26
+ * @since 9.0.0
27
  */
28
  class NewForeachExpressionReferencingSniff extends Sniff
29
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
34
+ * @since 9.0.0
35
+ *
36
  * @return array
37
  */
38
  public function register()
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
46
+ * @since 9.0.0
47
+ *
48
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
49
  * @param int $stackPtr The position of the current token in the
50
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\NewListInForeachSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,13 +14,15 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * Detect unpacking nested arrays with list() in a foreach().
19
  *
20
  * PHP version 5.5
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
25
  */
26
  class NewListInForeachSniff extends Sniff
27
  {
@@ -29,6 +30,8 @@ class NewListInForeachSniff extends Sniff
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -39,6 +42,8 @@ class NewListInForeachSniff extends Sniff
39
  /**
40
  * Processes this test, when one of its tokens is encountered.
41
  *
 
 
42
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
43
  * @param int $stackPtr The position of the current token in the
44
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect unpacking nested arrays with `list()` in a `foreach()` as available since PHP 5.5.
18
  *
19
  * PHP version 5.5
20
  *
21
+ * @link https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.foreach-list
22
+ * @link https://wiki.php.net/rfc/foreachlist
23
+ * @link https://www.php.net/manual/en/control-structures.foreach.php#control-structures.foreach.list
24
+ *
25
+ * @since 9.0.0
26
  */
27
  class NewListInForeachSniff extends Sniff
28
  {
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
33
+ * @since 9.0.0
34
+ *
35
  * @return array
36
  */
37
  public function register()
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
45
+ * @since 9.0.0
46
+ *
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token in the
49
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewMultiCatchSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ControlStructures\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
  namespace PHPCompatibility\Sniffs\ControlStructures;
@@ -15,21 +14,23 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ControlStructures\NewMultiCatch.
19
- *
20
  * Catching multiple exception types in one statement is available since PHP 7.1.
21
  *
22
  * PHP version 7.1
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
27
  */
28
  class NewMultiCatchSniff extends Sniff
29
  {
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
 
 
33
  * @return array
34
  */
35
  public function register()
@@ -40,6 +41,8 @@ class NewMultiCatchSniff extends Sniff
40
  /**
41
  * Processes this test, when one of its tokens is encountered.
42
  *
 
 
43
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
44
  * @param int $stackPtr The position of the current token
45
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ControlStructures;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
 
 
17
  * Catching multiple exception types in one statement is available since PHP 7.1.
18
  *
19
  * PHP version 7.1
20
  *
21
+ * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.mulit-catch-exception-handling
22
+ * @link https://wiki.php.net/rfc/multiple-catch
23
+ * @link https://www.php.net/manual/en/language.exceptions.php#language.exceptions.catch
24
+ *
25
+ * @since 7.0.7
26
  */
27
  class NewMultiCatchSniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
32
+ * @since 7.0.7
33
+ *
34
  * @return array
35
  */
36
  public function register()
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
44
+ * @since 7.0.7
45
+ *
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token
48
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Extensions/RemovedExtensionsSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Extensions\RemovedExtensionsSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2012 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Extensions;
@@ -15,14 +15,25 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Extensions\RemovedExtensionsSniff.
19
  *
20
- * Discourages the use of removed extensions. Suggests alternative extensions if available
 
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Wim Godden <wim.godden@cu.be>
25
- * @copyright 2012 Cu.be Solutions bvba
 
 
 
 
 
 
 
 
 
 
26
  */
27
  class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
28
  {
@@ -39,17 +50,21 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
39
  * </properties>
40
  * </rule>
41
  *
 
 
42
  * @var array
43
  */
44
  public $functionWhitelist;
45
 
46
  /**
47
- * A list of removed extensions with their alternative, if any
48
  *
49
  * The array lists : version number with false (deprecated) and true (removed).
50
  * If's sufficient to list the first version where the extension was deprecated/removed.
51
  *
52
- * @var array(string|null)
 
 
53
  */
54
  protected $removedExtensions = array(
55
  'activescript' => array(
@@ -155,6 +170,10 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
155
  '5.1' => true,
156
  'alternative' => null,
157
  ),
 
 
 
 
158
  'sqlite' => array(
159
  '5.4' => true,
160
  'alternative' => null,
@@ -185,6 +204,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
185
  /**
186
  * Returns an array of tokens this test wants to listen for.
187
  *
 
 
188
  * @return array
189
  */
190
  public function register()
@@ -198,6 +219,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
198
  /**
199
  * Processes this test, when one of its tokens is encountered.
200
  *
 
 
201
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
202
  * @param int $stackPtr The position of the current token in the
203
  * stack passed in $tokens.
@@ -265,6 +288,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
265
  *
266
  * Parsing the list late as it may be provided as a property, but also inline.
267
  *
 
 
268
  * @param string $content Content of the current token.
269
  *
270
  * @return bool
@@ -295,6 +320,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
295
  /**
296
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
297
  *
 
 
298
  * @param array $itemInfo Base information about the item.
299
  *
300
  * @return array Version and other information about the item.
@@ -308,6 +335,8 @@ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
308
  /**
309
  * Get the error message template for this sniff.
310
  *
 
 
311
  * @return string
312
  */
313
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Extensions;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect the use of deprecated and/or removed PHP extensions.
19
  *
20
+ * This sniff examines function calls made and flags function calls to functions
21
+ * prefixed with the dedicated prefix from a deprecated/removed native PHP extension.
22
  *
23
+ * Suggests alternative extensions if available.
24
+ *
25
+ * As userland functions may be prefixed with a prefix also used by a native
26
+ * PHP extension, the sniff offers the ability to whitelist specific functions
27
+ * from being flagged by this sniff via a property in a custom ruleset
28
+ * (since PHPCompatibility 7.0.2).
29
+ *
30
+ * {@internal This sniff is a candidate for removal once all functions from all
31
+ * deprecated/removed extensions have been added to the RemovedFunctions sniff.}
32
+ *
33
+ * PHP version All
34
+ *
35
+ * @since 5.5
36
+ * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
37
  */
38
  class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
39
  {
50
  * </properties>
51
  * </rule>
52
  *
53
+ * @since 7.0.2
54
+ *
55
  * @var array
56
  */
57
  public $functionWhitelist;
58
 
59
  /**
60
+ * A list of removed extensions with their alternative, if any.
61
  *
62
  * The array lists : version number with false (deprecated) and true (removed).
63
  * If's sufficient to list the first version where the extension was deprecated/removed.
64
  *
65
+ * @since 5.5
66
+ *
67
+ * @var array(string => array(string => bool|string|null))
68
  */
69
  protected $removedExtensions = array(
70
  'activescript' => array(
170
  '5.1' => true,
171
  'alternative' => null,
172
  ),
173
+ 'recode' => array(
174
+ '7.4' => true,
175
+ 'alternative' => 'iconv or mbstring',
176
+ ),
177
  'sqlite' => array(
178
  '5.4' => true,
179
  'alternative' => null,
204
  /**
205
  * Returns an array of tokens this test wants to listen for.
206
  *
207
+ * @since 5.5
208
+ *
209
  * @return array
210
  */
211
  public function register()
219
  /**
220
  * Processes this test, when one of its tokens is encountered.
221
  *
222
+ * @since 5.5
223
+ *
224
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
225
  * @param int $stackPtr The position of the current token in the
226
  * stack passed in $tokens.
288
  *
289
  * Parsing the list late as it may be provided as a property, but also inline.
290
  *
291
+ * @since 7.0.2
292
+ *
293
  * @param string $content Content of the current token.
294
  *
295
  * @return bool
320
  /**
321
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
322
  *
323
+ * @since 7.1.0
324
+ *
325
  * @param array $itemInfo Base information about the item.
326
  *
327
  * @return array Version and other information about the item.
335
  /**
336
  * Get the error message template for this sniff.
337
  *
338
+ * @since 7.1.0
339
+ *
340
  * @return string
341
  */
342
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParameterShadowSuperGlobalsSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\ForbiddenParameterShadowSuperGlobalsSniff
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Declan Kelly <declankelly90@gmail.com>
10
- * @copyright 2015 Declan Kelly
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -17,18 +15,15 @@ use PHPCompatibility\PHPCSHelper;
17
  use PHP_CodeSniffer_File as File;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\FunctionDeclarations\ForbiddenParameterShadowSuperGlobalsSniff
21
  *
22
- * Discourages use of superglobals as parameters for functions.
23
- *
24
- * {@internal List of superglobals is maintained in the parent class.}}
25
  *
26
  * PHP version 5.4
27
  *
28
- * @category PHP
29
- * @package PHPCompatibility
30
- * @author Declan Kelly <declankelly90@gmail.com>
31
- * @copyright 2015 Declan Kelly
32
  */
33
  class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
34
  {
@@ -36,6 +31,9 @@ class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
36
  /**
37
  * Register the tokens to listen for.
38
  *
 
 
 
39
  * @return array
40
  */
41
  public function register()
@@ -49,6 +47,8 @@ class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
49
  /**
50
  * Processes the test.
51
  *
 
 
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token.
54
  *
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect the use of superglobals as parameters for functions, support for which was removed in PHP 5.4.
19
  *
20
+ * {@internal List of superglobals is maintained in the parent class.}
 
 
21
  *
22
  * PHP version 5.4
23
  *
24
+ * @link https://www.php.net/manual/en/migration54.incompatible.php
25
+ *
26
+ * @since 7.0.0
 
27
  */
28
  class ForbiddenParameterShadowSuperGlobalsSniff extends Sniff
29
  {
31
  /**
32
  * Register the tokens to listen for.
33
  *
34
+ * @since 7.0.0
35
+ * @since 7.1.3 Allows for closures.
36
+ *
37
  * @return array
38
  */
39
  public function register()
47
  /**
48
  * Processes the test.
49
  *
50
+ * @since 7.0.0
51
+ *
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token.
54
  *
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\ForbiddenParametersWithSameName.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -16,15 +15,13 @@ use PHPCompatibility\PHPCSHelper;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\FunctionDeclarations\ForbiddenParametersWithSameName.
20
- *
21
- * Functions can not have multiple parameters with the same name since PHP 7.0
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim@cu.be>
28
  */
29
  class ForbiddenParametersWithSameNameSniff extends Sniff
30
  {
@@ -32,6 +29,9 @@ class ForbiddenParametersWithSameNameSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -45,6 +45,8 @@ class ForbiddenParametersWithSameNameSniff extends Sniff
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.
@@ -72,7 +74,7 @@ class ForbiddenParametersWithSameNameSniff extends Sniff
72
 
73
  $paramNames = array();
74
  foreach ($parameters as $param) {
75
- $paramNames[] = strtolower($param['name']);
76
  }
77
 
78
  if (\count($paramNames) !== \count(array_unique($paramNames))) {
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Functions can not have multiple parameters with the same name since PHP 7.0.
 
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameters
23
+ *
24
+ * @since 7.0.0
25
  */
26
  class ForbiddenParametersWithSameNameSniff extends Sniff
27
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
32
+ * @since 7.0.0
33
+ * @since 7.1.3 Allows for closures.
34
+ *
35
  * @return array
36
  */
37
  public function register()
45
  /**
46
  * Processes this test, when one of its tokens is encountered.
47
  *
48
+ * @since 7.0.0
49
+ *
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $stackPtr The position of the current token
52
  * in the stack passed in $tokens.
74
 
75
  $paramNames = array();
76
  foreach ($parameters as $param) {
77
+ $paramNames[] = $param['name'];
78
  }
79
 
80
  if (\count($paramNames) !== \count(array_unique($paramNames))) {
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenToStringParametersSniff.php CHANGED
@@ -17,12 +17,13 @@ use PHP_CodeSniffer_File as File;
17
  /**
18
  * As of PHP 5.3, the __toString() magic method can no longer accept arguments.
19
  *
20
- * Sister-sniff to PHPCompatibility.MethodUse.ForbiddenToStringParameters.
21
- *
22
- * @link https://www.php.net/manual/en/migration53.incompatible.php
23
  *
24
  * PHP version 5.3
25
  *
 
 
 
26
  * @since 9.2.0
27
  */
28
  class ForbiddenToStringParametersSniff extends Sniff
@@ -32,10 +33,11 @@ class ForbiddenToStringParametersSniff extends Sniff
32
  * Valid scopes for the __toString() method to live in.
33
  *
34
  * @since 9.2.0
 
35
  *
36
  * @var array
37
  */
38
- public $ooScopeTokens = array(
39
  'T_CLASS' => true,
40
  'T_INTERFACE' => true,
41
  'T_TRAIT' => true,
17
  /**
18
  * As of PHP 5.3, the __toString() magic method can no longer accept arguments.
19
  *
20
+ * Sister-sniff to `PHPCompatibility.MethodUse.ForbiddenToStringParameters`.
 
 
21
  *
22
  * PHP version 5.3
23
  *
24
+ * @link https://www.php.net/manual/en/migration53.incompatible.php
25
+ * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring
26
+ *
27
  * @since 9.2.0
28
  */
29
  class ForbiddenToStringParametersSniff extends Sniff
33
  * Valid scopes for the __toString() method to live in.
34
  *
35
  * @since 9.2.0
36
+ * @since 9.3.2 Visibility changed from `public` to `protected`.
37
  *
38
  * @var array
39
  */
40
+ protected $ooScopeTokens = array(
41
  'T_CLASS' => true,
42
  'T_INTERFACE' => true,
43
  'T_TRAIT' => true,
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * PHP 7.1 Forbidden variable names in closure use statements.
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
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -17,16 +16,17 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * PHP 7.1 Forbidden variable names in closure use statements.
21
  *
22
- * Variables bound to a closure via the use construct cannot use the same name
23
- * as any superglobals, $this, or any parameter since PHP 7.1.
24
  *
25
  * PHP version 7.1
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
30
  */
31
  class ForbiddenVariableNamesInClosureUseSniff extends Sniff
32
  {
@@ -34,6 +34,8 @@ class ForbiddenVariableNamesInClosureUseSniff extends Sniff
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
 
 
37
  * @return array
38
  */
39
  public function register()
@@ -44,6 +46,8 @@ class ForbiddenVariableNamesInClosureUseSniff extends Sniff
44
  /**
45
  * Processes this test, when one of its tokens is encountered.
46
  *
 
 
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token
49
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Detect variable names forbidden to be used in closure `use` statements.
20
  *
21
+ * Variables bound to a closure via the `use` construct cannot use the same name
22
+ * as any superglobals, `$this`, or any parameter since PHP 7.1.
23
  *
24
  * PHP version 7.1
25
  *
26
+ * @link https://www.php.net/manual/en/migration71.incompatible.php#migration71.incompatible.lexical-names
27
+ * @link https://www.php.net/manual/en/functions.anonymous.php
28
+ *
29
+ * @since 7.1.4
30
  */
31
  class ForbiddenVariableNamesInClosureUseSniff extends Sniff
32
  {
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
37
+ * @since 7.1.4
38
+ *
39
  * @return array
40
  */
41
  public function register()
46
  /**
47
  * Processes this test, when one of its tokens is encountered.
48
  *
49
+ * @since 7.1.4
50
+ *
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token
53
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewClosure.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -16,21 +15,35 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewClosure.
 
 
 
 
 
 
20
  *
21
- * Closures are available since PHP 5.3
 
 
 
22
  *
23
  * PHP version 5.3
 
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim@cu.be>
 
 
28
  */
29
  class NewClosureSniff extends Sniff
30
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,11 +54,19 @@ class NewClosureSniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
 
 
 
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token
46
  * in the stack passed in $tokens.
47
  *
48
- * @return void
 
49
  */
50
  public function process(File $phpcsFile, $stackPtr)
51
  {
@@ -161,6 +182,8 @@ class NewClosureSniff extends Sniff
161
  /**
162
  * Check whether the closure is declared as static.
163
  *
 
 
164
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
165
  * @param int $stackPtr The position of the current token
166
  * in the stack passed in $tokens.
@@ -179,6 +202,8 @@ class NewClosureSniff extends Sniff
179
  /**
180
  * Check if the code within a closure uses the $this variable.
181
  *
 
 
182
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
183
  * @param int $startToken The position within the closure to continue searching from.
184
  * @param int $endToken The closure scope closer to stop searching at.
@@ -205,6 +230,8 @@ class NewClosureSniff extends Sniff
205
  /**
206
  * Check if the code within a closure uses "self/parent/static".
207
  *
 
 
208
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
209
  * @param int $startToken The position within the closure to continue searching from.
210
  * @param int $endToken The closure scope closer to stop searching at.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect closures and verify that the features used are supported.
19
+ *
20
+ * Version based checks:
21
+ * - Closures are available since PHP 5.3.
22
+ * - Closures can be declared as `static` since PHP 5.4.
23
+ * - Closures can use the `$this` variable within a class context since PHP 5.4.
24
+ * - Closures can use `self`/`parent`/`static` since PHP 5.4.
25
  *
26
+ * Version independent checks:
27
+ * - Static closures don't have access to the `$this` variable.
28
+ * - Closures declared outside of a class context don't have access to the `$this`
29
+ * variable unless bound to an object.
30
  *
31
  * PHP version 5.3
32
+ * PHP version 5.4
33
  *
34
+ * @link https://www.php.net/manual/en/functions.anonymous.php
35
+ * @link https://wiki.php.net/rfc/closures
36
+ * @link https://wiki.php.net/rfc/closures/object-extension
37
+ *
38
+ * @since 7.0.0
39
  */
40
  class NewClosureSniff extends Sniff
41
  {
42
  /**
43
  * Returns an array of tokens this test wants to listen for.
44
  *
45
+ * @since 7.0.0
46
+ *
47
  * @return array
48
  */
49
  public function register()
54
  /**
55
  * Processes this test, when one of its tokens is encountered.
56
  *
57
+ * @since 7.0.0
58
+ * @since 7.1.4 - Added check for closure being declared as static < 5.4.
59
+ * - Added check for use of `$this` variable in class context < 5.4.
60
+ * - Added check for use of `$this` variable in static closures (unsupported).
61
+ * - Added check for use of `$this` variable outside class context (unsupported).
62
+ * @since 8.2.0 Added check for use of `self`/`static`/`parent` < 5.4.
63
+ *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token
66
  * in the stack passed in $tokens.
67
  *
68
+ * @return int|void Integer stack pointer to skip forward or void to continue
69
+ * normal file processing.
70
  */
71
  public function process(File $phpcsFile, $stackPtr)
72
  {
182
  /**
183
  * Check whether the closure is declared as static.
184
  *
185
+ * @since 7.1.4
186
+ *
187
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
188
  * @param int $stackPtr The position of the current token
189
  * in the stack passed in $tokens.
202
  /**
203
  * Check if the code within a closure uses the $this variable.
204
  *
205
+ * @since 7.1.4
206
+ *
207
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
208
  * @param int $startToken The position within the closure to continue searching from.
209
  * @param int $endToken The closure scope closer to stop searching at.
230
  /**
231
  * Check if the code within a closure uses "self/parent/static".
232
  *
233
+ * @since 8.2.0
234
+ *
235
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
236
  * @param int $startToken The position within the closure to continue searching from.
237
  * @param int $endToken The closure scope closer to stop searching at.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewExceptionsFromToStringSniff.php CHANGED
@@ -12,14 +12,16 @@ namespace PHPCompatibility\Sniffs\FunctionDeclarations;
12
 
13
  use PHPCompatibility\Sniff;
14
  use PHP_CodeSniffer_File as File;
 
15
 
16
  /**
17
- * As of PHP 7.4, throwing exceptions from a __toString() method is allowed.
18
- *
19
- * @link https://wiki.php.net/rfc/tostring_exceptions
20
  *
21
  * PHP version 7.4
22
  *
 
 
 
23
  * @since 9.2.0
24
  */
25
  class NewExceptionsFromToStringSniff extends Sniff
@@ -29,15 +31,30 @@ class NewExceptionsFromToStringSniff extends Sniff
29
  * Valid scopes for the __toString() method to live in.
30
  *
31
  * @since 9.2.0
 
32
  *
33
  * @var array
34
  */
35
- public $ooScopeTokens = array(
36
  'T_CLASS' => true,
37
  'T_TRAIT' => true,
38
  'T_ANON_CLASS' => true,
39
  );
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  /**
42
  * Returns an array of tokens this test wants to listen for.
43
  *
@@ -47,6 +64,12 @@ class NewExceptionsFromToStringSniff extends Sniff
47
  */
48
  public function register()
49
  {
 
 
 
 
 
 
50
  return array(\T_FUNCTION);
51
  }
52
 
@@ -84,17 +107,65 @@ class NewExceptionsFromToStringSniff extends Sniff
84
  return;
85
  }
86
 
87
- $hasThrow = $phpcsFile->findNext(\T_THROW, ($tokens[$stackPtr]['scope_opener'] + 1), $tokens[$stackPtr]['scope_closer']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- if ($hasThrow === false) {
90
- // No exception is being thrown.
91
  return;
92
  }
93
 
94
- $phpcsFile->addError(
95
- 'Throwing exceptions from __toString() was not allowed prior to PHP 7.4',
96
- $hasThrow,
97
- 'Found'
98
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
  }
12
 
13
  use PHPCompatibility\Sniff;
14
  use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * As of PHP 7.4, throwing exceptions from a `__toString()` method is allowed.
 
 
19
  *
20
  * PHP version 7.4
21
  *
22
+ * @link https://wiki.php.net/rfc/tostring_exceptions
23
+ * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring
24
+ *
25
  * @since 9.2.0
26
  */
27
  class NewExceptionsFromToStringSniff extends Sniff
31
  * Valid scopes for the __toString() method to live in.
32
  *
33
  * @since 9.2.0
34
+ * @since 9.3.0 Visibility changed from `public` to `protected`.
35
  *
36
  * @var array
37
  */
38
+ protected $ooScopeTokens = array(
39
  'T_CLASS' => true,
40
  'T_TRAIT' => true,
41
  'T_ANON_CLASS' => true,
42
  );
43
 
44
+ /**
45
+ * Tokens which should be ignored when they preface a function declaration
46
+ * when trying to find the docblock (if any).
47
+ *
48
+ * Array will be added to in the register() method.
49
+ *
50
+ * @since 9.3.0
51
+ *
52
+ * @var array
53
+ */
54
+ private $docblockIgnoreTokens = array(
55
+ \T_WHITESPACE => \T_WHITESPACE,
56
+ );
57
+
58
  /**
59
  * Returns an array of tokens this test wants to listen for.
60
  *
64
  */
65
  public function register()
66
  {
67
+ // Enhance the array of tokens to ignore for finding the docblock.
68
+ $this->docblockIgnoreTokens += Tokens::$methodPrefixes;
69
+ if (isset(Tokens::$phpcsCommentTokens)) {
70
+ $this->docblockIgnoreTokens += Tokens::$phpcsCommentTokens;
71
+ }
72
+
73
  return array(\T_FUNCTION);
74
  }
75
 
107
  return;
108
  }
109
 
110
+ /*
111
+ * Examine the content of the function.
112
+ */
113
+ $error = 'Throwing exceptions from __toString() was not allowed prior to PHP 7.4';
114
+ $throwPtr = $tokens[$stackPtr]['scope_opener'];
115
+ $errorThrown = false;
116
+
117
+ do {
118
+ $throwPtr = $phpcsFile->findNext(\T_THROW, ($throwPtr + 1), $tokens[$stackPtr]['scope_closer']);
119
+ if ($throwPtr === false) {
120
+ break;
121
+ }
122
+
123
+ $conditions = $tokens[$throwPtr]['conditions'];
124
+ $conditions = array_reverse($conditions, true);
125
+ $inTryCatch = false;
126
+ foreach ($conditions as $ptr => $type) {
127
+ if ($type === \T_TRY) {
128
+ $inTryCatch = true;
129
+ break;
130
+ }
131
+
132
+ if ($ptr === $stackPtr) {
133
+ // Don't check the conditions outside the function scope.
134
+ break;
135
+ }
136
+ }
137
+
138
+ if ($inTryCatch === false) {
139
+ $phpcsFile->addError($error, $throwPtr, 'Found');
140
+ $errorThrown = true;
141
+ }
142
+ } while (true);
143
 
144
+ if ($errorThrown === true) {
145
+ // We've already thrown an error for this method, no need to examine the docblock.
146
  return;
147
  }
148
 
149
+ /*
150
+ * Check whether the function has a docblock and if so, whether it contains a @throws tag.
151
+ *
152
+ * {@internal This can be partially replaced by the findCommentAboveFunction()
153
+ * utility function in due time.}
154
+ */
155
+ $commentEnd = $phpcsFile->findPrevious($this->docblockIgnoreTokens, ($stackPtr - 1), null, true);
156
+ if ($commentEnd === false || $tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) {
157
+ return;
158
+ }
159
+
160
+ $commentStart = $tokens[$commentEnd]['comment_opener'];
161
+ foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
162
+ if ($tokens[$tag]['content'] !== '@throws') {
163
+ continue;
164
+ }
165
+
166
+ // Found a throws tag.
167
+ $phpcsFile->addError($error, $stackPtr, 'ThrowsTagFoundInDocblock');
168
+ break;
169
+ }
170
  }
171
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\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
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -17,15 +16,15 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewNullableTypes.
21
- *
22
- * Nullable type hints and return types are available since PHP 7.1.
23
  *
24
  * PHP version 7.1
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
29
  */
30
  class NewNullableTypesSniff extends Sniff
31
  {
@@ -34,7 +33,9 @@ class NewNullableTypesSniff extends Sniff
34
  *
35
  * {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2
36
  * as in that case we can't distinguish between parameter type hints and
37
- * return type hints for the error message.}}
 
 
38
  *
39
  * @return array
40
  */
@@ -56,6 +57,8 @@ class NewNullableTypesSniff extends Sniff
56
  /**
57
  * Processes this test, when one of its tokens is encountered.
58
  *
 
 
59
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
60
  * @param int $stackPtr The position of the current token
61
  * in the stack passed in $tokens.
@@ -89,6 +92,8 @@ class NewNullableTypesSniff extends Sniff
89
  /**
90
  * Process this test for function tokens.
91
  *
 
 
92
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
93
  * @param int $stackPtr The position of the current token
94
  * in the stack passed in $tokens.
@@ -117,6 +122,8 @@ class NewNullableTypesSniff extends Sniff
117
  /**
118
  * Process this test for return type tokens.
119
  *
 
 
120
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
121
  * @param int $stackPtr The position of the current token
122
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Nullable parameter type declarations and return types are available since PHP 7.1.
 
 
20
  *
21
  * PHP version 7.1
22
  *
23
+ * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.nullable-types
24
+ * @link https://wiki.php.net/rfc/nullable_types
25
+ * @link https://www.php.net/manual/en/functions.arguments.php#example-146
26
+ *
27
+ * @since 7.0.7
28
  */
29
  class NewNullableTypesSniff extends Sniff
30
  {
33
  *
34
  * {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2
35
  * as in that case we can't distinguish between parameter type hints and
36
+ * return type hints for the error message.}
37
+ *
38
+ * @since 7.0.7
39
  *
40
  * @return array
41
  */
57
  /**
58
  * Processes this test, when one of its tokens is encountered.
59
  *
60
+ * @since 7.0.7
61
+ *
62
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
63
  * @param int $stackPtr The position of the current token
64
  * in the stack passed in $tokens.
92
  /**
93
  * Process this test for function tokens.
94
  *
95
+ * @since 7.0.7
96
+ *
97
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
98
  * @param int $stackPtr The position of the current token
99
  * in the stack passed in $tokens.
122
  /**
123
  * Process this test for return type tokens.
124
  *
125
+ * @since 7.0.7
126
+ *
127
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
128
  * @param int $stackPtr The position of the current token
129
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewParamTypeDeclarationsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewParamTypeDeclarationsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -14,11 +15,33 @@ use PHPCompatibility\PHPCSHelper;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewParamTypeDeclarationsSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  */
23
  class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
24
  {
@@ -29,7 +52,10 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
29
  * The array lists : version number with false (not present) or true (present).
30
  * If's sufficient to list the first version where the keyword appears.
31
  *
32
- * @var array(string => array(string => int|string|null))
 
 
 
33
  */
34
  protected $newTypes = array(
35
  'array' => array(
@@ -80,6 +106,8 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
80
  *
81
  * The array lists : the invalid type hint => what was probably intended/alternative.
82
  *
 
 
83
  * @var array(string => string)
84
  */
85
  protected $invalidTypes = array(
@@ -92,6 +120,9 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
92
  /**
93
  * Returns an array of tokens this test wants to listen for.
94
  *
 
 
 
95
  * @return array
96
  */
97
  public function register()
@@ -106,6 +137,13 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
106
  /**
107
  * Processes this test, when one of its tokens is encountered.
108
  *
 
 
 
 
 
 
 
109
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
110
  * @param int $stackPtr The position of the current token in
111
  * the stack passed in $tokens.
@@ -173,6 +211,8 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
173
  /**
174
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
175
  *
 
 
176
  * @param array $itemInfo Base information about the item.
177
  *
178
  * @return array Version and other information about the item.
@@ -186,6 +226,8 @@ class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
186
  /**
187
  * Get the error message template for this sniff.
188
  *
 
 
189
  * @return string
190
  */
191
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect and verify the use of parameter type declarations in function declarations.
19
  *
20
+ * Parameter type declarations - class/interface names only - is available since PHP 5.0.
21
+ * - Since PHP 5.1, the `array` keyword can be used.
22
+ * - Since PHP 5.2, `self` and `parent` can be used. Previously, those were interpreted as
23
+ * class names.
24
+ * - Since PHP 5.4, the `callable` keyword.
25
+ * - Since PHP 7.0, scalar type declarations are available.
26
+ * - Since PHP 7.1, the `iterable` pseudo-type is available.
27
+ * - Since PHP 7.2, the generic `object` type is available.
28
+ *
29
+ * Additionally, this sniff does a cursory check for typical invalid type declarations,
30
+ * such as:
31
+ * - `boolean` (should be `bool`), `integer` (should be `int`) and `static`.
32
+ * - `self`/`parent` as type declaration used outside class context throws a fatal error since PHP 7.0.
33
+ *
34
+ * PHP version 5.0+
35
+ *
36
+ * @link https://www.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration
37
+ * @link https://wiki.php.net/rfc/callable
38
+ * @link https://wiki.php.net/rfc/scalar_type_hints_v5
39
+ * @link https://wiki.php.net/rfc/iterable
40
+ * @link https://wiki.php.net/rfc/object-typehint
41
+ *
42
+ * @since 7.0.0
43
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
44
+ * @since 9.0.0 Renamed from `NewScalarTypeDeclarationsSniff` to `NewParamTypeDeclarationsSniff`.
45
  */
46
  class NewParamTypeDeclarationsSniff extends AbstractNewFeatureSniff
47
  {
52
  * The array lists : version number with false (not present) or true (present).
53
  * If's sufficient to list the first version where the keyword appears.
54
  *
55
+ * @since 7.0.0
56
+ * @since 7.0.3 Now lists all param type declarations, not just the PHP 7+ scalar ones.
57
+ *
58
+ * @var array(string => array(string => bool))
59
  */
60
  protected $newTypes = array(
61
  'array' => array(
106
  *
107
  * The array lists : the invalid type hint => what was probably intended/alternative.
108
  *
109
+ * @since 7.0.3
110
+ *
111
  * @var array(string => string)
112
  */
113
  protected $invalidTypes = array(
120
  /**
121
  * Returns an array of tokens this test wants to listen for.
122
  *
123
+ * @since 7.0.0
124
+ * @since 7.1.3 Now also checks closures.
125
+ *
126
  * @return array
127
  */
128
  public function register()
137
  /**
138
  * Processes this test, when one of its tokens is encountered.
139
  *
140
+ * @since 7.0.0
141
+ * @since 7.0.3 - Added check for non-scalar type declarations.
142
+ * - Added check for invalid type declarations.
143
+ * - Added check for usage of `self` type declaration outside
144
+ * class scope.
145
+ * @since 8.2.0 Added check for `parent` type declaration outside class scope.
146
+ *
147
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
148
  * @param int $stackPtr The position of the current token in
149
  * the stack passed in $tokens.
211
  /**
212
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
213
  *
214
+ * @since 7.1.0
215
+ *
216
  * @param array $itemInfo Base information about the item.
217
  *
218
  * @return array Version and other information about the item.
226
  /**
227
  * Get the error message template for this sniff.
228
  *
229
+ * @since 7.1.0
230
+ *
231
  * @return string
232
  */
233
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NewReturnTypeDeclarationsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewReturnTypeDeclarationsSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -15,13 +14,24 @@ use PHPCompatibility\AbstractNewFeatureSniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NewReturnTypeDeclarationsSniff.
 
 
 
 
19
  *
20
- * PHP version 7.0
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
 
 
 
 
25
  */
26
  class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
27
  {
@@ -32,7 +42,9 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
32
  * The array lists : version number with false (not present) or true (present).
33
  * If's sufficient to list the first version where the keyword appears.
34
  *
35
- * @var array(string => array(string => int|string|null))
 
 
36
  */
37
  protected $newTypes = array(
38
  'int' => array(
@@ -91,6 +103,9 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
91
  /**
92
  * Returns an array of tokens this test wants to listen for.
93
  *
 
 
 
94
  * @return array
95
  */
96
  public function register()
@@ -111,6 +126,8 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
111
  /**
112
  * Processes this test, when one of its tokens is encountered.
113
  *
 
 
114
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
115
  * @param int $stackPtr The position of the current token in
116
  * the stack passed in $tokens.
@@ -151,6 +168,8 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
151
  /**
152
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
153
  *
 
 
154
  * @param array $itemInfo Base information about the item.
155
  *
156
  * @return array Version and other information about the item.
@@ -164,6 +183,8 @@ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
164
  /**
165
  * Get the error message template for this sniff.
166
  *
 
 
167
  * @return string
168
  */
169
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect and verify the use of return type declarations in function declarations.
18
+ *
19
+ * Return type declarations are available since PHP 7.0.
20
+ * - Since PHP 7.1, the `iterable` and `void` pseudo-types are available.
21
+ * - Since PHP 7.2, the generic `object` type is available.
22
  *
23
+ * PHP version 7.0+
24
  *
25
+ * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations
26
+ * @link https://www.php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration
27
+ * @link https://wiki.php.net/rfc/return_types
28
+ * @link https://wiki.php.net/rfc/iterable
29
+ * @link https://wiki.php.net/rfc/void_return_type
30
+ * @link https://wiki.php.net/rfc/object-typehint
31
+ *
32
+ * @since 7.0.0
33
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
34
+ * @since 7.1.2 Renamed from `NewScalarReturnTypeDeclarationsSniff` to `NewReturnTypeDeclarationsSniff`.
35
  */
36
  class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
37
  {
42
  * The array lists : version number with false (not present) or true (present).
43
  * If's sufficient to list the first version where the keyword appears.
44
  *
45
+ * @since 7.0.0
46
+ *
47
+ * @var array(string => array(string => bool))
48
  */
49
  protected $newTypes = array(
50
  'int' => array(
103
  /**
104
  * Returns an array of tokens this test wants to listen for.
105
  *
106
+ * @since 7.0.0
107
+ * @since 7.1.2 Now also checks based on the function and closure keywords.
108
+ *
109
  * @return array
110
  */
111
  public function register()
126
  /**
127
  * Processes this test, when one of its tokens is encountered.
128
  *
129
+ * @since 7.0.0
130
+ *
131
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
132
  * @param int $stackPtr The position of the current token in
133
  * the stack passed in $tokens.
168
  /**
169
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
170
  *
171
+ * @since 7.1.0
172
+ *
173
  * @param array $itemInfo Base information about the item.
174
  *
175
  * @return array Version and other information about the item.
183
  /**
184
  * Get the error message template for this sniff.
185
  *
186
+ * @since 7.1.0
187
+ *
188
  * @return string
189
  */
190
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NonStaticMagicMethodsSniff.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
- * @copyright 2012 Cu.be Solutions bvba
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
@@ -16,14 +14,17 @@ use PHPCompatibility\Sniff;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\FunctionDeclarations\NonStaticMagicMethodsSniff.
20
- *
21
  * Verifies the use of the correct visibility and static properties of magic methods.
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Wim Godden <wim.godden@cu.be>
26
- * @copyright 2012 Cu.be Solutions bvba
 
 
 
 
 
27
  */
28
  class NonStaticMagicMethodsSniff extends Sniff
29
  {
@@ -37,9 +38,23 @@ class NonStaticMagicMethodsSniff extends Sniff
37
  * When a method does not have a specific requirement for either visibility or static,
38
  * do *not* add the key.
39
  *
 
 
 
 
40
  * @var array(string)
41
  */
42
  protected $magicMethods = array(
 
 
 
 
 
 
 
 
 
 
43
  '__get' => array(
44
  'visibility' => 'public',
45
  'static' => false,
@@ -71,14 +86,35 @@ class NonStaticMagicMethodsSniff extends Sniff
71
  'visibility' => 'public',
72
  ),
73
  '__set_state' => array(
 
74
  'static' => true,
75
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  );
77
 
78
 
79
  /**
80
  * Returns an array of tokens this test wants to listen for.
81
  *
 
 
 
 
82
  * @return array
83
  */
84
  public function register()
@@ -100,6 +136,8 @@ class NonStaticMagicMethodsSniff extends Sniff
100
  /**
101
  * Processes this test, when one of its tokens is encountered.
102
  *
 
 
103
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
104
  * @param int $stackPtr The position of the current token in the
105
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionDeclarations;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
 
 
17
  * Verifies the use of the correct visibility and static properties of magic methods.
18
  *
19
+ * The requirements have always existed, but as of PHP 5.3, a warning will be thrown
20
+ * when magic methods have the wrong modifiers.
21
+ *
22
+ * PHP version 5.3
23
+ *
24
+ * @link https://www.php.net/manual/en/language.oop5.magic.php
25
+ *
26
+ * @since 5.5
27
+ * @since 5.6 Now extends the base `Sniff` class.
28
  */
29
  class NonStaticMagicMethodsSniff extends Sniff
30
  {
38
  * When a method does not have a specific requirement for either visibility or static,
39
  * do *not* add the key.
40
  *
41
+ * @since 5.5
42
+ * @since 5.6 The array format has changed to allow the sniff to also verify the
43
+ * use of the correct visibility for a magic method.
44
+ *
45
  * @var array(string)
46
  */
47
  protected $magicMethods = array(
48
+ '__construct' => array(
49
+ 'static' => false,
50
+ ),
51
+ '__destruct' => array(
52
+ 'visibility' => 'public',
53
+ 'static' => false,
54
+ ),
55
+ '__clone' => array(
56
+ 'static' => false,
57
+ ),
58
  '__get' => array(
59
  'visibility' => 'public',
60
  'static' => false,
86
  'visibility' => 'public',
87
  ),
88
  '__set_state' => array(
89
+ 'visibility' => 'public',
90
  'static' => true,
91
  ),
92
+ '__debuginfo' => array(
93
+ 'visibility' => 'public',
94
+ 'static' => false,
95
+ ),
96
+ '__invoke' => array(
97
+ 'visibility' => 'public',
98
+ 'static' => false,
99
+ ),
100
+ '__serialize' => array(
101
+ 'visibility' => 'public',
102
+ 'static' => false,
103
+ ),
104
+ '__unserialize' => array(
105
+ 'visibility' => 'public',
106
+ 'static' => false,
107
+ ),
108
  );
109
 
110
 
111
  /**
112
  * Returns an array of tokens this test wants to listen for.
113
  *
114
+ * @since 5.5
115
+ * @since 5.6 Now also checks traits.
116
+ * @since 7.1.4 Now also checks anonymous classes.
117
+ *
118
  * @return array
119
  */
120
  public function register()
136
  /**
137
  * Processes this test, when one of its tokens is encountered.
138
  *
139
+ * @since 5.5
140
+ *
141
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
142
  * @param int $stackPtr The position of the current token in the
143
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/NewMagicMethodsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\NewMagicMethodsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
@@ -13,13 +14,16 @@ use PHPCompatibility\AbstractNewFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\NewMagicMethodsSniff.
17
- *
18
  * Warns for non-magic behaviour of magic methods prior to becoming magic.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
23
  */
24
  class NewMagicMethodsSniff extends AbstractNewFeatureSniff
25
  {
@@ -31,9 +35,19 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
31
  * The array lists : version number with false (not magic) or true (magic).
32
  * If's sufficient to list the first version where the method became magic.
33
  *
34
- * @var array(string => array(string => int|string|null))
 
 
35
  */
36
  protected $newMagicMethods = array(
 
 
 
 
 
 
 
 
37
  '__get' => array(
38
  '4.4' => false,
39
  '5.0' => true,
@@ -73,12 +87,23 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
73
  '5.2' => true,
74
  'message' => 'The method %s() was not truly magical in PHP version %s and earlier. The associated magic functionality will only be called when directly combined with echo or print.',
75
  ),
 
 
 
 
 
 
 
 
 
76
  );
77
 
78
 
79
  /**
80
  * Returns an array of tokens this test wants to listen for.
81
  *
 
 
82
  * @return array
83
  */
84
  public function register()
@@ -90,6 +115,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
90
  /**
91
  * Processes this test, when one of its tokens is encountered.
92
  *
 
 
93
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
94
  * @param int $stackPtr The position of the current token in the
95
  * stack passed in $tokens.
@@ -120,6 +147,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
120
  /**
121
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
122
  *
 
 
123
  * @param array $itemInfo Base information about the item.
124
  *
125
  * @return array Version and other information about the item.
@@ -133,6 +162,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
133
  /**
134
  * Get an array of the non-PHP-version array keys used in a sub-array.
135
  *
 
 
136
  * @return array
137
  */
138
  protected function getNonVersionArrayKeys()
@@ -144,6 +175,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
144
  /**
145
  * Retrieve the relevant detail (version) information for use in an error message.
146
  *
 
 
147
  * @param array $itemArray Version and other information about the item.
148
  * @param array $itemInfo Base information about the item.
149
  *
@@ -166,6 +199,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
166
  /**
167
  * Get the error message template for this sniff.
168
  *
 
 
169
  * @return string
170
  */
171
  protected function getErrorMsgTemplate()
@@ -177,6 +212,8 @@ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
177
  /**
178
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
179
  *
 
 
180
  * @param string $error The error message which was created.
181
  * @param array $itemInfo Base information about the item this error message applies to.
182
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
 
 
17
  * Warns for non-magic behaviour of magic methods prior to becoming magic.
18
  *
19
+ * PHP version 5.0+
20
+ *
21
+ * @link https://www.php.net/manual/en/language.oop5.magic.php
22
+ * @link https://wiki.php.net/rfc/closures#additional_goodyinvoke
23
+ * @link https://wiki.php.net/rfc/debug-info
24
+ *
25
+ * @since 7.0.4
26
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class.
27
  */
28
  class NewMagicMethodsSniff extends AbstractNewFeatureSniff
29
  {
35
  * The array lists : version number with false (not magic) or true (magic).
36
  * If's sufficient to list the first version where the method became magic.
37
  *
38
+ * @since 7.0.4
39
+ *
40
+ * @var array(string => array(string => bool|string))
41
  */
42
  protected $newMagicMethods = array(
43
+ '__construct' => array(
44
+ '4.4' => false,
45
+ '5.0' => true,
46
+ ),
47
+ '__destruct' => array(
48
+ '4.4' => false,
49
+ '5.0' => true,
50
+ ),
51
  '__get' => array(
52
  '4.4' => false,
53
  '5.0' => true,
87
  '5.2' => true,
88
  'message' => 'The method %s() was not truly magical in PHP version %s and earlier. The associated magic functionality will only be called when directly combined with echo or print.',
89
  ),
90
+
91
+ '__serialize' => array(
92
+ '7.3' => false,
93
+ '7.4' => true,
94
+ ),
95
+ '__unserialize' => array(
96
+ '7.3' => false,
97
+ '7.4' => true,
98
+ ),
99
  );
100
 
101
 
102
  /**
103
  * Returns an array of tokens this test wants to listen for.
104
  *
105
+ * @since 7.0.4
106
+ *
107
  * @return array
108
  */
109
  public function register()
115
  /**
116
  * Processes this test, when one of its tokens is encountered.
117
  *
118
+ * @since 7.0.4
119
+ *
120
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
121
  * @param int $stackPtr The position of the current token in the
122
  * stack passed in $tokens.
147
  /**
148
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
149
  *
150
+ * @since 7.1.0
151
+ *
152
  * @param array $itemInfo Base information about the item.
153
  *
154
  * @return array Version and other information about the item.
162
  /**
163
  * Get an array of the non-PHP-version array keys used in a sub-array.
164
  *
165
+ * @since 7.1.0
166
+ *
167
  * @return array
168
  */
169
  protected function getNonVersionArrayKeys()
175
  /**
176
  * Retrieve the relevant detail (version) information for use in an error message.
177
  *
178
+ * @since 7.1.0
179
+ *
180
  * @param array $itemArray Version and other information about the item.
181
  * @param array $itemInfo Base information about the item.
182
  *
199
  /**
200
  * Get the error message template for this sniff.
201
  *
202
+ * @since 7.1.0
203
+ *
204
  * @return string
205
  */
206
  protected function getErrorMsgTemplate()
212
  /**
213
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
214
  *
215
+ * @since 7.1.0
216
+ *
217
  * @param string $error The error message which was created.
218
  * @param array $itemInfo Base information about the item this error message applies to.
219
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\RemovedMagicAutoloadSniff.
4
  *
5
- * PHP version 7.2
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
@@ -15,16 +14,25 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\RemovedMagicAutoloadSniff.
 
 
 
 
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
23
  */
24
  class RemovedMagicAutoloadSniff extends Sniff
25
  {
26
  /**
27
- * Scopes to look for when testing using validDirectScope
 
 
28
  *
29
  * @var array
30
  */
@@ -39,6 +47,8 @@ class RemovedMagicAutoloadSniff extends Sniff
39
  /**
40
  * Returns an array of tokens this test wants to listen for.
41
  *
 
 
42
  * @return array
43
  */
44
  public function register()
@@ -49,6 +59,8 @@ class RemovedMagicAutoloadSniff extends Sniff
49
  /**
50
  * Processes this test, when one of its tokens is encountered.
51
  *
 
 
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token in the
54
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect declaration of the magic `__autoload()` method.
18
+ *
19
+ * This method has been deprecated in PHP 7.2 in favour of `spl_autoload_register()`.
20
+ *
21
+ * PHP version 7.2
22
  *
23
+ * @link https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.__autoload-method
24
+ * @link https://wiki.php.net/rfc/deprecations_php_7_2#autoload
25
+ * @link https://www.php.net/manual/en/function.autoload.php
26
+ *
27
+ * @since 8.1.0
28
+ * @since 9.0.0 Renamed from `DeprecatedMagicAutoloadSniff` to `RemovedMagicAutoloadSniff`.
29
  */
30
  class RemovedMagicAutoloadSniff extends Sniff
31
  {
32
  /**
33
+ * Scopes to look for when testing using validDirectScope.
34
+ *
35
+ * @since 8.1.0
36
  *
37
  * @var array
38
  */
47
  /**
48
  * Returns an array of tokens this test wants to listen for.
49
  *
50
+ * @since 8.1.0
51
+ *
52
  * @return array
53
  */
54
  public function register()
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
62
+ * @since 8.1.0
63
+ *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the
66
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\RemovedNamespacedAssertSniff.
4
  *
5
- * PHP version 7.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
@@ -15,24 +14,30 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * Removed Namespaced Assert.
19
  *
20
  * As of PHP 7.3, a compile-time deprecation warning will be thrown when a function
21
  * called `assert()` is declared. In PHP 8 this will become a compile-error.
22
  *
23
  * Methods are unaffected.
24
- * Global, non-namespaced, assert() function declarations were always a fatal
25
  * "function already declared" error, so not the concern of this sniff.
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
30
  */
31
  class RemovedNamespacedAssertSniff extends Sniff
32
  {
33
  /**
34
  * Scopes in which an `assert` function can be declared without issue.
35
  *
 
 
36
  * @var array
37
  */
38
  private $scopes = array(
@@ -45,6 +50,8 @@ class RemovedNamespacedAssertSniff extends Sniff
45
  /**
46
  * Returns an array of tokens this test wants to listen for.
47
  *
 
 
48
  * @return array
49
  */
50
  public function register()
@@ -60,6 +67,8 @@ class RemovedNamespacedAssertSniff extends Sniff
60
  /**
61
  * Processes this test, when one of its tokens is encountered.
62
  *
 
 
63
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
  * @param int $stackPtr The position of the current token in the
65
  * stack passed in $tokens.
@@ -83,7 +92,7 @@ class RemovedNamespacedAssertSniff extends Sniff
83
  }
84
 
85
  if ($this->determineNamespace($phpcsFile, $stackPtr) === '') {
86
- // Not a namespaced function declaration. Parse error, but not our concern.
87
  return;
88
  }
89
 
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect declaration of a namespaced function called `assert()`.
18
  *
19
  * As of PHP 7.3, a compile-time deprecation warning will be thrown when a function
20
  * called `assert()` is declared. In PHP 8 this will become a compile-error.
21
  *
22
  * Methods are unaffected.
23
+ * Global, non-namespaced, `assert()` function declarations were always a fatal
24
  * "function already declared" error, so not the concern of this sniff.
25
  *
26
+ * PHP version 7.3
27
+ *
28
+ * @link https://www.php.net/manual/en/migration73.deprecated.php#migration73.deprecated.core.assert
29
+ * @link https://wiki.php.net/rfc/deprecations_php_7_3#defining_a_free-standing_assert_function
30
+ * @link https://www.php.net/manual/en/function.assert.php
31
+ *
32
+ * @since 9.0.0
33
  */
34
  class RemovedNamespacedAssertSniff extends Sniff
35
  {
36
  /**
37
  * Scopes in which an `assert` function can be declared without issue.
38
  *
39
+ * @since 9.0.0
40
+ *
41
  * @var array
42
  */
43
  private $scopes = array(
50
  /**
51
  * Returns an array of tokens this test wants to listen for.
52
  *
53
+ * @since 9.0.0
54
+ *
55
  * @return array
56
  */
57
  public function register()
67
  /**
68
  * Processes this test, when one of its tokens is encountered.
69
  *
70
+ * @since 9.0.0
71
+ *
72
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
73
  * @param int $stackPtr The position of the current token in the
74
  * stack passed in $tokens.
92
  }
93
 
94
  if ($this->determineNamespace($phpcsFile, $stackPtr) === '') {
95
+ // Not a namespaced function declaration. This may be a parse error, but not our concern.
96
  return;
97
  }
98
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedPHP4StyleConstructorsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\RemovedPHP4StyleConstructorsSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Koen Eelen <koen.eelen@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
@@ -16,13 +15,26 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\RemovedPHP4StyleConstructorsSniff.
 
 
 
 
 
 
 
 
20
  *
21
  * PHP version 7.0
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Koen Eelen <koen.eelen@cu.be>
 
 
 
 
 
26
  */
27
  class RemovedPHP4StyleConstructorsSniff extends Sniff
28
  {
@@ -30,19 +42,24 @@ class RemovedPHP4StyleConstructorsSniff extends Sniff
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
 
 
33
  * @return array
34
  */
35
  public function register()
36
  {
37
  return array(
38
  \T_CLASS,
39
- \T_INTERFACE,
40
  );
41
  }
42
 
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
 
 
 
 
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token in the
48
  * stack passed in $tokens.
@@ -92,7 +109,13 @@ class RemovedPHP4StyleConstructorsSniff extends Sniff
92
  $newConstructorFound = false;
93
  $oldConstructorFound = false;
94
  $oldConstructorPos = -1;
95
- while (($nextFunc = $phpcsFile->findNext(\T_FUNCTION, ($nextFunc + 1), $scopeCloser)) !== false) {
 
 
 
 
 
 
96
  $functionScopeCloser = $nextFunc;
97
  if (isset($tokens[$nextFunc]['scope_closer'])) {
98
  // Normal (non-interface, non-abstract) method.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect declarations of PHP 4 style constructors which are deprecated as of PHP 7.0.0.
19
+ *
20
+ * PHP 4 style constructors - methods that have the same name as the class they are defined in -
21
+ * are deprecated as of PHP 7.0.0, and will be removed in the future.
22
+ * PHP 7 will emit `E_DEPRECATED` if a PHP 4 constructor is the only constructor defined
23
+ * within a class. Classes that implement a `__construct()` method are unaffected.
24
+ *
25
+ * Note: Methods with the same name as the class they are defined in _within a namespace_
26
+ * are not recognized as constructors anyway and therefore outside the scope of this sniff.
27
  *
28
  * PHP version 7.0
29
  *
30
+ * @link https://www.php.net/manual/en/migration70.deprecated.php#migration70.deprecated.php4-constructors
31
+ * @link https://wiki.php.net/rfc/remove_php4_constructors
32
+ * @link https://www.php.net/manual/en/language.oop5.decon.php
33
+ *
34
+ * @since 7.0.0
35
+ * @since 7.0.8 This sniff now throws a warning instead of an error as the functionality is
36
+ * only deprecated (for now).
37
+ * @since 9.0.0 Renamed from `DeprecatedPHP4StyleConstructorsSniff` to `RemovedPHP4StyleConstructorsSniff`.
38
  */
39
  class RemovedPHP4StyleConstructorsSniff extends Sniff
40
  {
42
  /**
43
  * Returns an array of tokens this test wants to listen for.
44
  *
45
+ * @since 7.0.0
46
+ *
47
  * @return array
48
  */
49
  public function register()
50
  {
51
  return array(
52
  \T_CLASS,
 
53
  );
54
  }
55
 
56
  /**
57
  * Processes this test, when one of its tokens is encountered.
58
  *
59
+ * @since 7.0.0
60
+ * @since 7.0.8 The message is downgraded from error to warning as - for now - support
61
+ * for PHP4-style constructors is just deprecated, not yet removed.
62
+ *
63
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
  * @param int $stackPtr The position of the current token in the
65
  * stack passed in $tokens.
109
  $newConstructorFound = false;
110
  $oldConstructorFound = false;
111
  $oldConstructorPos = -1;
112
+ while (($nextFunc = $phpcsFile->findNext(array(\T_FUNCTION, \T_DOC_COMMENT_OPEN_TAG), ($nextFunc + 1), $scopeCloser)) !== false) {
113
+ // Skip over docblocks.
114
+ if ($tokens[$nextFunc]['code'] === \T_DOC_COMMENT_OPEN_TAG) {
115
+ $nextFunc = $tokens[$nextFunc]['comment_closer'];
116
+ continue;
117
+ }
118
+
119
  $functionScopeCloser = $nextFunc;
120
  if (isset($tokens[$nextFunc]['scope_closer'])) {
121
  // Normal (non-interface, non-abstract) method.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\ReservedFunctionNamesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
@@ -15,10 +16,10 @@ use PHP_CodeSniffer_Standards_AbstractScopeSniff as PHPCS_AbstractScopeSniff;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\FunctionNameRestrictions\ReservedFunctionNamesSniff.
19
- *
20
  * All function and method names starting with double underscore are reserved by PHP.
21
  *
 
 
22
  * {@internal Extends an upstream sniff to benefit from the properties contained therein.
23
  * The properties are lists of valid PHP magic function and method names, which
24
  * should be ignored for the purposes of this sniff.
@@ -28,17 +29,20 @@ use PHP_CodeSniffer_Tokens as Tokens;
28
  * the logic in this sniff is largely the same as used upstream.
29
  * Extending the upstream sniff instead of including it via the ruleset, however,
30
  * prevents hard to debug issues of errors not being reported from the upstream sniff
31
- * if this library is used in combination with other rulesets.}}
32
  *
33
- * @category PHP
34
- * @package PHPCompatibility
35
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
36
  */
37
  class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
38
  {
39
 
40
  /**
41
  * Overload the constructor to work round various PHPCS cross-version compatibility issues.
 
 
42
  */
43
  public function __construct()
44
  {
@@ -58,6 +62,8 @@ class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
58
  /**
59
  * Processes the tokens within the scope.
60
  *
 
 
61
  * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
62
  * @param int $stackPtr The position where this token was
63
  * found.
@@ -82,6 +88,15 @@ class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
82
  return;
83
  }
84
 
 
 
 
 
 
 
 
 
 
85
  $methodName = $phpcsFile->getDeclarationName($stackPtr);
86
  if ($methodName === null) {
87
  // Ignore closures.
@@ -114,6 +129,8 @@ class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
114
  /**
115
  * Processes the tokens outside the scope.
116
  *
 
 
117
  * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
118
  * @param int $stackPtr The position where this token was
119
  * found.
@@ -122,6 +139,15 @@ class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
122
  */
123
  protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
124
  {
 
 
 
 
 
 
 
 
 
125
  $functionName = $phpcsFile->getDeclarationName($stackPtr);
126
  if ($functionName === null) {
127
  // Ignore closures.
@@ -141,4 +167,39 @@ class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
141
  }
142
  }
143
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionNameRestrictions;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
 
 
19
  * All function and method names starting with double underscore are reserved by PHP.
20
  *
21
+ * PHP version All
22
+ *
23
  * {@internal Extends an upstream sniff to benefit from the properties contained therein.
24
  * The properties are lists of valid PHP magic function and method names, which
25
  * should be ignored for the purposes of this sniff.
29
  * the logic in this sniff is largely the same as used upstream.
30
  * Extending the upstream sniff instead of including it via the ruleset, however,
31
  * prevents hard to debug issues of errors not being reported from the upstream sniff
32
+ * if this library is used in combination with other rulesets.}
33
  *
34
+ * @link https://www.php.net/manual/en/language.oop5.magic.php
35
+ *
36
+ * @since 8.2.0 This was previously, since 7.0.3, checked by the upstream sniff.
37
+ * @since 9.3.2 The sniff will now ignore functions marked as `@deprecated` by design.
38
  */
39
  class ReservedFunctionNamesSniff extends PHPCS_CamelCapsFunctionNameSniff
40
  {
41
 
42
  /**
43
  * Overload the constructor to work round various PHPCS cross-version compatibility issues.
44
+ *
45
+ * @since 8.2.0
46
  */
47
  public function __construct()
48
  {
62
  /**
63
  * Processes the tokens within the scope.
64
  *
65
+ * @since 8.2.0
66
+ *
67
  * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
68
  * @param int $stackPtr The position where this token was
69
  * found.
88
  return;
89
  }
90
 
91
+ if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) {
92
+ /*
93
+ * Deprecated functions don't have to comply with the naming conventions,
94
+ * otherwise functions deprecated in favour of a function with a compliant
95
+ * name would still trigger an error.
96
+ */
97
+ return;
98
+ }
99
+
100
  $methodName = $phpcsFile->getDeclarationName($stackPtr);
101
  if ($methodName === null) {
102
  // Ignore closures.
129
  /**
130
  * Processes the tokens outside the scope.
131
  *
132
+ * @since 8.2.0
133
+ *
134
  * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
135
  * @param int $stackPtr The position where this token was
136
  * found.
139
  */
140
  protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
141
  {
142
+ if ($this->isFunctionDeprecated($phpcsFile, $stackPtr) === true) {
143
+ /*
144
+ * Deprecated functions don't have to comply with the naming conventions,
145
+ * otherwise functions deprecated in favour of a function with a compliant
146
+ * name would still trigger an error.
147
+ */
148
+ return;
149
+ }
150
+
151
  $functionName = $phpcsFile->getDeclarationName($stackPtr);
152
  if ($functionName === null) {
153
  // Ignore closures.
167
  }
168
  }
169
  }
170
+
171
+
172
+ /**
173
+ * Check whether a function has been marked as deprecated via a @deprecated tag
174
+ * in the function docblock.
175
+ *
176
+ * @since 9.3.2
177
+ *
178
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
179
+ * @param int $stackPtr The position of a T_FUNCTION
180
+ * token in the stack.
181
+ *
182
+ * @return bool
183
+ */
184
+ private function isFunctionDeprecated(File $phpcsFile, $stackPtr)
185
+ {
186
+ $tokens = $phpcsFile->getTokens();
187
+ $find = Tokens::$methodPrefixes;
188
+ $find[] = \T_WHITESPACE;
189
+
190
+ $commentEnd = $phpcsFile->findPrevious($find, ($stackPtr - 1), null, true);
191
+ if ($tokens[$commentEnd]['code'] !== \T_DOC_COMMENT_CLOSE_TAG) {
192
+ // Function doesn't have a doc comment or is using the wrong type of comment.
193
+ return false;
194
+ }
195
+
196
+ $commentStart = $tokens[$commentEnd]['comment_opener'];
197
+ foreach ($tokens[$commentStart]['comment_tags'] as $tag) {
198
+ if ($tokens[$tag]['content'] === '@deprecated') {
199
+ return true;
200
+ }
201
+ }
202
+
203
+ return false;
204
+ }
205
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php CHANGED
@@ -3,7 +3,7 @@
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
- * @copyright 2012-2018 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
@@ -20,11 +20,13 @@ use PHP_CodeSniffer_Tokens as Tokens;
20
  * instead of the original since PHP 7.0.
21
  *
22
  * `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces
23
- * will no longer report the original value that was passed to a parameter, but will
24
- * instead provide the current value (which might have been modified).
25
  *
26
  * PHP version 7.0
27
  *
 
 
28
  * @since 9.1.0
29
  */
30
  class ArgumentFunctionsReportCurrentValueSniff extends Sniff
@@ -34,6 +36,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
34
  * A list of functions that, when called, can behave differently in PHP 7
35
  * when dealing with parameters of the function they're called in.
36
  *
 
 
37
  * @var array
38
  */
39
  protected $changedFunctions = array(
@@ -46,6 +50,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
46
  /**
47
  * Tokens to look out for to allow us to skip past nested scoped structures.
48
  *
 
 
49
  * @var array
50
  */
51
  private $skipPastNested = array(
@@ -66,6 +72,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
66
  * Similarly, as constants won't have parentheses, those don't need to be checked
67
  * for either.
68
  *
 
 
69
  * @var array
70
  */
71
  private $noneFunctionCallIndicators = array(
@@ -76,6 +84,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
76
  /**
77
  * The tokens for variable incrementing/decrementing.
78
  *
 
 
79
  * @var array
80
  */
81
  private $plusPlusMinusMinus = array(
@@ -86,6 +96,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
86
  /**
87
  * Tokens to ignore when determining the start of a statement.
88
  *
 
 
89
  * @var array
90
  */
91
  private $ignoreForStartOfStatement = array(
@@ -98,6 +110,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
98
  /**
99
  * Returns an array of tokens this test wants to listen for.
100
  *
 
 
101
  * @return array
102
  */
103
  public function register()
@@ -111,6 +125,8 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
111
  /**
112
  * Processes this test, when one of its tokens is encountered.
113
  *
 
 
114
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
115
  * @param int $stackPtr The position of the current token
116
  * in the stack passed in $tokens.
@@ -222,7 +238,7 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
222
  * higher than the number of named parameters.
223
  *
224
  * {@internal Note: This does not take calculations into account!
225
- * Should be exceptionally rare and can - if needs be - be addressed at a later stage.}}
226
  */
227
  case 'func_get_arg':
228
  $number = $phpcsFile->findNext(\T_LNUMBER, $paramOne['start'], ($paramOne['end'] + 1));
@@ -244,7 +260,7 @@ class ArgumentFunctionsReportCurrentValueSniff extends Sniff
244
  * In that case, we can ignore it.
245
  *
246
  * {@internal Note: This does not take offset calculations into account!
247
- * Should be exceptionally rare and can - if needs be - be addressed at a later stage.}}
248
  */
249
  if ($prev !== false && $tokens[$prev]['code'] === \T_OPEN_PARENTHESIS) {
250
 
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
20
  * instead of the original since PHP 7.0.
21
  *
22
  * `func_get_arg()`, `func_get_args()`, `debug_backtrace()` and exception backtraces
23
+ * will no longer report the original parameter value as was passed to the function,
24
+ * but will instead provide the current value (which might have been modified).
25
  *
26
  * PHP version 7.0
27
  *
28
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameter-modified
29
+ *
30
  * @since 9.1.0
31
  */
32
  class ArgumentFunctionsReportCurrentValueSniff extends Sniff
36
  * A list of functions that, when called, can behave differently in PHP 7
37
  * when dealing with parameters of the function they're called in.
38
  *
39
+ * @since 9.1.0
40
+ *
41
  * @var array
42
  */
43
  protected $changedFunctions = array(
50
  /**
51
  * Tokens to look out for to allow us to skip past nested scoped structures.
52
  *
53
+ * @since 9.1.0
54
+ *
55
  * @var array
56
  */
57
  private $skipPastNested = array(
72
  * Similarly, as constants won't have parentheses, those don't need to be checked
73
  * for either.
74
  *
75
+ * @since 9.1.0
76
+ *
77
  * @var array
78
  */
79
  private $noneFunctionCallIndicators = array(
84
  /**
85
  * The tokens for variable incrementing/decrementing.
86
  *
87
+ * @since 9.1.0
88
+ *
89
  * @var array
90
  */
91
  private $plusPlusMinusMinus = array(
96
  /**
97
  * Tokens to ignore when determining the start of a statement.
98
  *
99
+ * @since 9.1.0
100
+ *
101
  * @var array
102
  */
103
  private $ignoreForStartOfStatement = array(
110
  /**
111
  * Returns an array of tokens this test wants to listen for.
112
  *
113
+ * @since 9.1.0
114
+ *
115
  * @return array
116
  */
117
  public function register()
125
  /**
126
  * Processes this test, when one of its tokens is encountered.
127
  *
128
+ * @since 9.1.0
129
+ *
130
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
131
  * @param int $stackPtr The position of the current token
132
  * in the stack passed in $tokens.
238
  * higher than the number of named parameters.
239
  *
240
  * {@internal Note: This does not take calculations into account!
241
+ * Should be exceptionally rare and can - if needs be - be addressed at a later stage.}
242
  */
243
  case 'func_get_arg':
244
  $number = $phpcsFile->findNext(\T_LNUMBER, $paramOne['start'], ($paramOne['end'] + 1));
260
  * In that case, we can ignore it.
261
  *
262
  * {@internal Note: This does not take offset calculations into account!
263
+ * Should be exceptionally rare and can - if needs be - be addressed at a later stage.}
264
  */
265
  if ($prev !== false && $tokens[$prev]['code'] === \T_OPEN_PARENTHESIS) {
266
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\ArgumentFunctionsUsageSniff.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -16,10 +15,10 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\FunctionUse\ArgumentFunctionsUsageSniff.
20
  *
 
21
  * - Prior to PHP 5.3, these functions could not be used as a function call parameter.
22
- *
23
  * - Calling these functions from the outermost scope of a file which has been included by
24
  * calling `include` or `require` from within a function in the calling file, worked
25
  * prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1.
@@ -28,9 +27,9 @@ use PHP_CodeSniffer_Tokens as Tokens;
28
  *
29
  * PHP version 5.3
30
  *
31
- * @category PHP
32
- * @package PHPCompatibility
33
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
34
  */
35
  class ArgumentFunctionsUsageSniff extends Sniff
36
  {
@@ -38,6 +37,8 @@ class ArgumentFunctionsUsageSniff extends Sniff
38
  /**
39
  * The target functions for this sniff.
40
  *
 
 
41
  * @var array
42
  */
43
  protected $targetFunctions = array(
@@ -50,6 +51,8 @@ class ArgumentFunctionsUsageSniff extends Sniff
50
  /**
51
  * Returns an array of tokens this test wants to listen for.
52
  *
 
 
53
  * @return array
54
  */
55
  public function register()
@@ -61,6 +64,8 @@ class ArgumentFunctionsUsageSniff extends Sniff
61
  /**
62
  * Processes this test, when one of its tokens is encountered.
63
  *
 
 
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the
66
  * stack passed in $tokens.
@@ -100,7 +105,7 @@ class ArgumentFunctionsUsageSniff extends Sniff
100
  $data = $tokens[$stackPtr]['content'];
101
 
102
  /*
103
- * Check for usage of the functions in the global scope.
104
  *
105
  * As PHPCS can not determine whether a file is included from within a function in
106
  * another file, so always throw a warning/error.
@@ -118,7 +123,7 @@ class ArgumentFunctionsUsageSniff extends Sniff
118
  }
119
 
120
  /*
121
- * Check for usage of the functions as a parameter in a function call.
122
  */
123
  if ($this->supportsBelow('5.2') === false) {
124
  return;
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect usage of `func_get_args()`, `func_get_arg()` and `func_num_args()` in invalid context.
19
  *
20
+ * Checks for:
21
  * - Prior to PHP 5.3, these functions could not be used as a function call parameter.
 
22
  * - Calling these functions from the outermost scope of a file which has been included by
23
  * calling `include` or `require` from within a function in the calling file, worked
24
  * prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1.
27
  *
28
  * PHP version 5.3
29
  *
30
+ * @link https://www.php.net/manual/en/migration53.incompatible.php
31
+ *
32
+ * @since 8.2.0
33
  */
34
  class ArgumentFunctionsUsageSniff extends Sniff
35
  {
37
  /**
38
  * The target functions for this sniff.
39
  *
40
+ * @since 8.2.0
41
+ *
42
  * @var array
43
  */
44
  protected $targetFunctions = array(
51
  /**
52
  * Returns an array of tokens this test wants to listen for.
53
  *
54
+ * @since 8.2.0
55
+ *
56
  * @return array
57
  */
58
  public function register()
64
  /**
65
  * Processes this test, when one of its tokens is encountered.
66
  *
67
+ * @since 8.2.0
68
+ *
69
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
70
  * @param int $stackPtr The position of the current token in the
71
  * stack passed in $tokens.
105
  $data = $tokens[$stackPtr]['content'];
106
 
107
  /*
108
+ * Check for use of the functions in the global scope.
109
  *
110
  * As PHPCS can not determine whether a file is included from within a function in
111
  * another file, so always throw a warning/error.
123
  }
124
 
125
  /*
126
+ * Check for use of the functions as a parameter in a function call.
127
  */
128
  if ($this->supportsBelow('5.2') === false) {
129
  return;
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\NewFunctionParametersSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -14,21 +15,27 @@ use PHP_CodeSniffer_File as File;
14
  use PHP_CodeSniffer_Tokens as Tokens;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\FunctionUse\newFunctionParametersSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
22
  */
23
  class NewFunctionParametersSniff extends AbstractNewFeatureSniff
24
  {
25
  /**
26
- * A list of new functions, not present in older versions.
27
  *
28
  * The array lists : version number with false (not present) or true (present).
29
  * The index is the location of the parameter in the parameter list, starting at 0 !
30
  * If's sufficient to list the first version where the function appears.
31
  *
 
 
 
32
  * @var array
33
  */
34
  protected $newFunctionParameters = array(
@@ -937,6 +944,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
937
  /**
938
  * Returns an array of tokens this test wants to listen for.
939
  *
 
 
940
  * @return array
941
  */
942
  public function register()
@@ -950,6 +959,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
950
  /**
951
  * Processes this test, when one of its tokens is encountered.
952
  *
 
 
953
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
954
  * @param int $stackPtr The position of the current token in
955
  * the stack passed in $tokens.
@@ -1005,6 +1016,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1005
  /**
1006
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1007
  *
 
 
1008
  * @param array $itemInfo Base information about the item.
1009
  *
1010
  * @return array Version and other information about the item.
@@ -1018,6 +1031,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1018
  /**
1019
  * Get an array of the non-PHP-version array keys used in a sub-array.
1020
  *
 
 
1021
  * @return array
1022
  */
1023
  protected function getNonVersionArrayKeys()
@@ -1029,6 +1044,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1029
  /**
1030
  * Retrieve the relevant detail (version) information for use in an error message.
1031
  *
 
 
1032
  * @param array $itemArray Version and other information about the item.
1033
  * @param array $itemInfo Base information about the item.
1034
  *
@@ -1046,6 +1063,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1046
  /**
1047
  * Get the item name to be used for the creation of the error code.
1048
  *
 
 
1049
  * @param array $itemInfo Base information about the item.
1050
  * @param array $errorInfo Detail information about an item.
1051
  *
@@ -1060,6 +1079,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1060
  /**
1061
  * Get the error message template for this sniff.
1062
  *
 
 
1063
  * @return string
1064
  */
1065
  protected function getErrorMsgTemplate()
@@ -1071,6 +1092,8 @@ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
1071
  /**
1072
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
1073
  *
 
 
1074
  * @param array $data The error data array which was created.
1075
  * @param array $itemInfo Base information about the item this error message applies to.
1076
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of new function parameters in calls to native PHP functions.
19
  *
20
+ * PHP version All
21
+ *
22
+ * @link https://www.php.net/manual/en/doc.changelog.php
23
+ *
24
+ * @since 7.0.0
25
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
26
  */
27
  class NewFunctionParametersSniff extends AbstractNewFeatureSniff
28
  {
29
  /**
30
+ * A list of functions which have new parameters, not present in older versions.
31
  *
32
  * The array lists : version number with false (not present) or true (present).
33
  * The index is the location of the parameter in the parameter list, starting at 0 !
34
  * If's sufficient to list the first version where the function appears.
35
  *
36
+ * @since 7.0.0
37
+ * @since 7.0.2 Visibility changed from `public` to `protected`.
38
+ *
39
  * @var array
40
  */
41
  protected $newFunctionParameters = array(
944
  /**
945
  * Returns an array of tokens this test wants to listen for.
946
  *
947
+ * @since 7.0.0
948
+ *
949
  * @return array
950
  */
951
  public function register()
959
  /**
960
  * Processes this test, when one of its tokens is encountered.
961
  *
962
+ * @since 7.0.0
963
+ *
964
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
965
  * @param int $stackPtr The position of the current token in
966
  * the stack passed in $tokens.
1016
  /**
1017
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1018
  *
1019
+ * @since 7.1.0
1020
+ *
1021
  * @param array $itemInfo Base information about the item.
1022
  *
1023
  * @return array Version and other information about the item.
1031
  /**
1032
  * Get an array of the non-PHP-version array keys used in a sub-array.
1033
  *
1034
+ * @since 7.1.0
1035
+ *
1036
  * @return array
1037
  */
1038
  protected function getNonVersionArrayKeys()
1044
  /**
1045
  * Retrieve the relevant detail (version) information for use in an error message.
1046
  *
1047
+ * @since 7.1.0
1048
+ *
1049
  * @param array $itemArray Version and other information about the item.
1050
  * @param array $itemInfo Base information about the item.
1051
  *
1063
  /**
1064
  * Get the item name to be used for the creation of the error code.
1065
  *
1066
+ * @since 7.1.0
1067
+ *
1068
  * @param array $itemInfo Base information about the item.
1069
  * @param array $errorInfo Detail information about an item.
1070
  *
1079
  /**
1080
  * Get the error message template for this sniff.
1081
  *
1082
+ * @since 7.1.0
1083
+ *
1084
  * @return string
1085
  */
1086
  protected function getErrorMsgTemplate()
1092
  /**
1093
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
1094
  *
1095
+ * @since 7.1.0
1096
+ *
1097
  * @param array $data The error data array which was created.
1098
  * @param array $itemInfo Base information about the item this error message applies to.
1099
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\NewFunctionsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -13,11 +14,14 @@ use PHPCompatibility\AbstractNewFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\FunctionUse\newFunctionsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
21
  */
22
  class NewFunctionsSniff extends AbstractNewFeatureSniff
23
  {
@@ -27,7 +31,14 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
27
  * The array lists : version number with false (not present) or true (present).
28
  * If's sufficient to list the first version where the function appears.
29
  *
30
- * @var array(string => array(string => int|string|null))
 
 
 
 
 
 
 
31
  */
32
  protected $newFunctions = array(
33
  'iterator_count' => array(
@@ -849,10 +860,6 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
849
  '5.4' => false,
850
  '5.5' => true,
851
  ),
852
- 'datefmt_get_calendar_object' => array(
853
- '5.4' => false,
854
- '5.5' => true,
855
- ),
856
  'intlcal_create_instance' => array(
857
  '5.4' => false,
858
  '5.5' => true,
@@ -1117,6 +1124,31 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1117
  '5.4' => false,
1118
  '5.5' => true,
1119
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1120
 
1121
  'gmp_root' => array(
1122
  '5.5' => false,
@@ -1746,12 +1778,12 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1746
  '7.1' => false,
1747
  '7.2' => true,
1748
  ),
1749
- // Introduced in 7.2.14 and 7.3.1 similtanously.
1750
  'oci_set_call_timeout' => array(
1751
  '7.2.13' => false,
1752
  '7.2.14' => true,
1753
  ),
1754
- // Introduced in 7.2.14 and 7.3.1 similtanously.
1755
  'oci_set_db_operation' => array(
1756
  '7.2.13' => false,
1757
  '7.2.14' => true,
@@ -1854,6 +1886,10 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1854
  '7.3' => false,
1855
  '7.4' => true,
1856
  ),
 
 
 
 
1857
  'mb_str_split' => array(
1858
  '7.3' => false,
1859
  '7.4' => true,
@@ -1884,6 +1920,8 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1884
  /**
1885
  * Returns an array of tokens this test wants to listen for.
1886
  *
 
 
1887
  * @return array
1888
  */
1889
  public function register()
@@ -1897,6 +1935,8 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1897
  /**
1898
  * Processes this test, when one of its tokens is encountered.
1899
  *
 
 
1900
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1901
  * @param int $stackPtr The position of the current token in
1902
  * the stack passed in $tokens.
@@ -1942,6 +1982,8 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1942
  /**
1943
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1944
  *
 
 
1945
  * @param array $itemInfo Base information about the item.
1946
  *
1947
  * @return array Version and other information about the item.
@@ -1955,6 +1997,8 @@ class NewFunctionsSniff extends AbstractNewFeatureSniff
1955
  /**
1956
  * Get the error message template for this sniff.
1957
  *
 
 
1958
  * @return string
1959
  */
1960
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect calls to new native PHP functions.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @since 5.5
22
+ * @since 5.6 Now extends the base `Sniff` class instead of the upstream
23
+ * `Generic.PHP.ForbiddenFunctions` sniff.
24
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
25
  */
26
  class NewFunctionsSniff extends AbstractNewFeatureSniff
27
  {
31
  * The array lists : version number with false (not present) or true (present).
32
  * If's sufficient to list the first version where the function appears.
33
  *
34
+ * @since 5.5
35
+ * @since 5.6 Visibility changed from `protected` to `public`.
36
+ * @since 7.0.2 Visibility changed back from `public` to `protected`.
37
+ * The earlier change was made to be in line with the upstream sniff,
38
+ * but that sniff is no longer being extended.
39
+ * @since 7.0.8 Renamed from `$forbiddenFunctions` to the more descriptive `$newFunctions`.
40
+ *
41
+ * @var array(string => array(string => bool))
42
  */
43
  protected $newFunctions = array(
44
  'iterator_count' => array(
860
  '5.4' => false,
861
  '5.5' => true,
862
  ),
 
 
 
 
863
  'intlcal_create_instance' => array(
864
  '5.4' => false,
865
  '5.5' => true,
1124
  '5.4' => false,
1125
  '5.5' => true,
1126
  ),
1127
+ 'opcache_compile_file' => array(
1128
+ '5.4' => false,
1129
+ '5.5' => true,
1130
+ ),
1131
+ 'opcache_get_configuration' => array(
1132
+ '5.4' => false,
1133
+ '5.5' => true,
1134
+ ),
1135
+ 'opcache_get_status' => array(
1136
+ '5.4' => false,
1137
+ '5.5' => true,
1138
+ ),
1139
+ 'opcache_invalidate' => array(
1140
+ '5.4' => false,
1141
+ '5.5' => true,
1142
+ ),
1143
+ 'opcache_reset' => array(
1144
+ '5.4' => false,
1145
+ '5.5' => true,
1146
+ ),
1147
+
1148
+ 'opcache_is_script_cached' => array(
1149
+ '5.5.10' => false,
1150
+ '5.5.11' => true,
1151
+ ),
1152
 
1153
  'gmp_root' => array(
1154
  '5.5' => false,
1778
  '7.1' => false,
1779
  '7.2' => true,
1780
  ),
1781
+ // Introduced in 7.2.14 and 7.3.1 simultanously.
1782
  'oci_set_call_timeout' => array(
1783
  '7.2.13' => false,
1784
  '7.2.14' => true,
1785
  ),
1786
+ // Introduced in 7.2.14 and 7.3.1 simultanously.
1787
  'oci_set_db_operation' => array(
1788
  '7.2.13' => false,
1789
  '7.2.14' => true,
1886
  '7.3' => false,
1887
  '7.4' => true,
1888
  ),
1889
+ 'imagecreatefromtga' => array(
1890
+ '7.3' => false,
1891
+ '7.4' => true,
1892
+ ),
1893
  'mb_str_split' => array(
1894
  '7.3' => false,
1895
  '7.4' => true,
1920
  /**
1921
  * Returns an array of tokens this test wants to listen for.
1922
  *
1923
+ * @since 5.6
1924
+ *
1925
  * @return array
1926
  */
1927
  public function register()
1935
  /**
1936
  * Processes this test, when one of its tokens is encountered.
1937
  *
1938
+ * @since 5.5
1939
+ *
1940
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1941
  * @param int $stackPtr The position of the current token in
1942
  * the stack passed in $tokens.
1982
  /**
1983
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1984
  *
1985
+ * @since 7.1.0
1986
+ *
1987
  * @param array $itemInfo Base information about the item.
1988
  *
1989
  * @return array Version and other information about the item.
1997
  /**
1998
  * Get the error message template for this sniff.
1999
  *
2000
+ * @since 7.1.0
2001
+ *
2002
  * @return string
2003
  */
2004
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\OptionalToRequiredFunctionParametersSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -13,11 +14,16 @@ use PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSnif
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\FunctionUse\OptionalToRequiredFunctionParametersSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
21
  */
22
  class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff
23
  {
@@ -30,6 +36,8 @@ class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFuncti
30
  * The index is the location of the parameter in the parameter list, starting at 0 !
31
  * If's sufficient to list the last version in which the parameter was not yet required.
32
  *
 
 
33
  * @var array
34
  */
35
  protected $functionParameters = array(
@@ -53,6 +61,8 @@ class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFuncti
53
  /**
54
  * Determine whether an error/warning should be thrown for an item based on collected information.
55
  *
 
 
56
  * @param array $errorInfo Detail information about an item.
57
  *
58
  * @return bool
@@ -68,6 +78,8 @@ class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFuncti
68
  /**
69
  * Retrieve the relevant detail (version) information for use in an error message.
70
  *
 
 
71
  * @param array $itemArray Version and other information about the item.
72
  * @param array $itemInfo Base information about the item.
73
  *
@@ -109,6 +121,8 @@ class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFuncti
109
  /**
110
  * Generates the error or warning for this item.
111
  *
 
 
112
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
113
  * @param int $stackPtr The position of the relevant token in
114
  * the stack.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect missing required function parameters in calls to native PHP functions.
18
  *
19
+ * Specifically when those function parameters used to be optional in older PHP versions.
20
+ *
21
+ * PHP version All
22
+ *
23
+ * @link https://www.php.net/manual/en/doc.changelog.php
24
+ *
25
+ * @since 8.1.0
26
+ * @since 9.0.0 Renamed from `OptionalRequiredFunctionParametersSniff` to `OptionalToRequiredFunctionParametersSniff`.
27
  */
28
  class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff
29
  {
36
  * The index is the location of the parameter in the parameter list, starting at 0 !
37
  * If's sufficient to list the last version in which the parameter was not yet required.
38
  *
39
+ * @since 8.1.0
40
+ *
41
  * @var array
42
  */
43
  protected $functionParameters = array(
61
  /**
62
  * Determine whether an error/warning should be thrown for an item based on collected information.
63
  *
64
+ * @since 8.1.0
65
+ *
66
  * @param array $errorInfo Detail information about an item.
67
  *
68
  * @return bool
78
  /**
79
  * Retrieve the relevant detail (version) information for use in an error message.
80
  *
81
+ * @since 8.1.0
82
+ *
83
  * @param array $itemArray Version and other information about the item.
84
  * @param array $itemInfo Base information about the item.
85
  *
121
  /**
122
  * Generates the error or warning for this item.
123
  *
124
+ * @since 8.1.0
125
+ *
126
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
127
  * @param int $stackPtr The position of the relevant token in
128
  * the stack.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\RemovedFunctionParametersSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -14,11 +15,14 @@ use PHP_CodeSniffer_File as File;
14
  use PHP_CodeSniffer_Tokens as Tokens;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\FunctionUse\RemovedFunctionParametersSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
22
  */
23
  class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
24
  {
@@ -29,9 +33,24 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
29
  * The index is the location of the parameter in the parameter list, starting at 0 !
30
  * If's sufficient to list the first version where the function parameter was deprecated/removed.
31
  *
 
 
 
 
 
 
 
 
32
  * @var array
33
  */
34
  protected $removedFunctionParameters = array(
 
 
 
 
 
 
 
35
  'define' => array(
36
  2 => array(
37
  'name' => 'case_insensitive',
@@ -70,6 +89,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
70
  /**
71
  * Returns an array of tokens this test wants to listen for.
72
  *
 
 
73
  * @return array
74
  */
75
  public function register()
@@ -83,6 +104,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
83
  /**
84
  * Processes this test, when one of its tokens is encountered.
85
  *
 
 
86
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
87
  * @param int $stackPtr The position of the current token in
88
  * the stack passed in $tokens.
@@ -113,7 +136,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
113
  return;
114
  }
115
 
116
- $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
 
117
  if ($parameterCount === 0) {
118
  return;
119
  }
@@ -124,6 +148,12 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
124
 
125
  foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) {
126
  if ($offset <= $parameterOffsetFound) {
 
 
 
 
 
 
127
  $itemInfo = array(
128
  'name' => $function,
129
  'nameLc' => $functionLc,
@@ -138,6 +168,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
138
  /**
139
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
140
  *
 
 
141
  * @param array $itemInfo Base information about the item.
142
  *
143
  * @return array Version and other information about the item.
@@ -151,17 +183,21 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
151
  /**
152
  * Get an array of the non-PHP-version array keys used in a sub-array.
153
  *
 
 
154
  * @return array
155
  */
156
  protected function getNonVersionArrayKeys()
157
  {
158
- return array('name');
159
  }
160
 
161
 
162
  /**
163
  * Retrieve the relevant detail (version) information for use in an error message.
164
  *
 
 
165
  * @param array $itemArray Version and other information about the item.
166
  * @param array $itemInfo Base information about the item.
167
  *
@@ -179,6 +215,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
179
  /**
180
  * Get the item name to be used for the creation of the error code.
181
  *
 
 
182
  * @param array $itemInfo Base information about the item.
183
  * @param array $errorInfo Detail information about an item.
184
  *
@@ -193,6 +231,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
193
  /**
194
  * Get the error message template for this sniff.
195
  *
 
 
196
  * @return string
197
  */
198
  protected function getErrorMsgTemplate()
@@ -204,6 +244,8 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
204
  /**
205
  * Filter the error data before it's passed to PHPCS.
206
  *
 
 
207
  * @param array $data The error data array which was created.
208
  * @param array $itemInfo Base information about the item this error message applies to.
209
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -216,4 +258,35 @@ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
216
  array_unshift($data, $errorInfo['paramName'], $itemInfo['name']);
217
  return $data;
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of deprecated/removed function parameters in calls to native PHP functions.
19
  *
20
+ * PHP version All
21
+ *
22
+ * @link https://www.php.net/manual/en/doc.changelog.php
23
+ *
24
+ * @since 7.0.0
25
+ * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
26
  */
27
  class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
28
  {
33
  * The index is the location of the parameter in the parameter list, starting at 0 !
34
  * If's sufficient to list the first version where the function parameter was deprecated/removed.
35
  *
36
+ * The optional `callback` key can be used to pass a method name which should be called for an
37
+ * additional check. The method will be passed the parameter info and should return true
38
+ * if the notice should be thrown or false otherwise.
39
+ *
40
+ * @since 7.0.0
41
+ * @since 7.0.2 Visibility changed from `public` to `protected`.
42
+ * @since 9.3.0 Optional `callback` key.
43
+ *
44
  * @var array
45
  */
46
  protected $removedFunctionParameters = array(
47
+ 'curl_version' => array(
48
+ 0 => array(
49
+ 'name' => 'age',
50
+ '7.4' => false,
51
+ 'callback' => 'curlVersionInvalidValue',
52
+ ),
53
+ ),
54
  'define' => array(
55
  2 => array(
56
  'name' => 'case_insensitive',
89
  /**
90
  * Returns an array of tokens this test wants to listen for.
91
  *
92
+ * @since 7.0.0
93
+ *
94
  * @return array
95
  */
96
  public function register()
104
  /**
105
  * Processes this test, when one of its tokens is encountered.
106
  *
107
+ * @since 7.0.0
108
+ *
109
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
110
  * @param int $stackPtr The position of the current token in
111
  * the stack passed in $tokens.
136
  return;
137
  }
138
 
139
+ $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
140
+ $parameterCount = \count($parameters);
141
  if ($parameterCount === 0) {
142
  return;
143
  }
148
 
149
  foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) {
150
  if ($offset <= $parameterOffsetFound) {
151
+ if (isset($parameterDetails['callback']) && method_exists($this, $parameterDetails['callback'])) {
152
+ if ($this->{$parameterDetails['callback']}($phpcsFile, $parameters[($offset + 1)]) === false) {
153
+ continue;
154
+ }
155
+ }
156
+
157
  $itemInfo = array(
158
  'name' => $function,
159
  'nameLc' => $functionLc,
168
  /**
169
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
170
  *
171
+ * @since 7.1.0
172
+ *
173
  * @param array $itemInfo Base information about the item.
174
  *
175
  * @return array Version and other information about the item.
183
  /**
184
  * Get an array of the non-PHP-version array keys used in a sub-array.
185
  *
186
+ * @since 7.1.0
187
+ *
188
  * @return array
189
  */
190
  protected function getNonVersionArrayKeys()
191
  {
192
+ return array('name', 'callback');
193
  }
194
 
195
 
196
  /**
197
  * Retrieve the relevant detail (version) information for use in an error message.
198
  *
199
+ * @since 7.1.0
200
+ *
201
  * @param array $itemArray Version and other information about the item.
202
  * @param array $itemInfo Base information about the item.
203
  *
215
  /**
216
  * Get the item name to be used for the creation of the error code.
217
  *
218
+ * @since 7.1.0
219
+ *
220
  * @param array $itemInfo Base information about the item.
221
  * @param array $errorInfo Detail information about an item.
222
  *
231
  /**
232
  * Get the error message template for this sniff.
233
  *
234
+ * @since 7.1.0
235
+ *
236
  * @return string
237
  */
238
  protected function getErrorMsgTemplate()
244
  /**
245
  * Filter the error data before it's passed to PHPCS.
246
  *
247
+ * @since 7.1.0
248
+ *
249
  * @param array $data The error data array which was created.
250
  * @param array $itemInfo Base information about the item this error message applies to.
251
  * @param array $errorInfo Detail information about an item this error message applies to.
258
  array_unshift($data, $errorInfo['paramName'], $itemInfo['name']);
259
  return $data;
260
  }
261
+
262
+ /**
263
+ * Check whether curl_version() was passed the default CURLVERSION_NOW.
264
+ *
265
+ * @since 9.3.0
266
+ *
267
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
268
+ * @param array $parameter Parameter info array.
269
+ *
270
+ * @return bool True if the value was not CURLVERSION_NOW, false otherwise.
271
+ */
272
+ protected function curlVersionInvalidValue(File $phpcsFile, array $parameter)
273
+ {
274
+ $tokens = $phpcsFile->getTokens();
275
+ $raw = '';
276
+ for ($i = $parameter['start']; $i <= $parameter['end']; $i++) {
277
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']])) {
278
+ continue;
279
+ }
280
+
281
+ $raw .= $tokens[$i]['content'];
282
+ }
283
+
284
+ if ($raw !== 'CURLVERSION_NOW'
285
+ && $raw !== (string) \CURLVERSION_NOW
286
+ ) {
287
+ return true;
288
+ }
289
+
290
+ return false;
291
+ }
292
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\RemovedFunctionsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -13,11 +14,17 @@ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\FunctionUse\RemovedFunctionsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
 
 
 
21
  */
22
  class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
23
  {
@@ -27,6 +34,13 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
27
  * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
28
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
29
  *
 
 
 
 
 
 
 
30
  * @var array(string => array(string => bool|string|null))
31
  */
32
  protected $removedFunctions = array(
@@ -728,6 +742,38 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
728
  'alternative' => null,
729
  ),
730
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
  'ibase_add_user' => array(
732
  '7.4' => true,
733
  'alternative' => null,
@@ -928,6 +974,18 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
928
  '7.4' => false,
929
  'alternative' => 'ldap_search()',
930
  ),
 
 
 
 
 
 
 
 
 
 
 
 
931
  'wddx_add_vars' => array(
932
  '7.4' => true,
933
  'alternative' => null,
@@ -958,6 +1016,8 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
958
  /**
959
  * Returns an array of tokens this test wants to listen for.
960
  *
 
 
961
  * @return array
962
  */
963
  public function register()
@@ -972,6 +1032,8 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
972
  /**
973
  * Processes this test, when one of its tokens is encountered.
974
  *
 
 
975
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
976
  * @param int $stackPtr The position of the current token in
977
  * the stack passed in $tokens.
@@ -1016,6 +1078,8 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
1016
  /**
1017
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1018
  *
 
 
1019
  * @param array $itemInfo Base information about the item.
1020
  *
1021
  * @return array Version and other information about the item.
@@ -1029,6 +1093,8 @@ class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
1029
  /**
1030
  * Get the error message template for this sniff.
1031
  *
 
 
1032
  * @return string
1033
  */
1034
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect calls to deprecated/removed native PHP functions.
18
  *
19
+ * Suggests alternative if available.
20
+ *
21
+ * PHP version All
22
+ *
23
+ * @since 5.5
24
+ * @since 5.6 Now extends the base `Sniff` class instead of the upstream
25
+ * `Generic.PHP.ForbiddenFunctions` sniff.
26
+ * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
27
+ * @since 9.0.0 Renamed from `DeprecatedFunctionsSniff` to `RemovedFunctionsSniff`.
28
  */
29
  class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
30
  {
34
  * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
35
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
36
  *
37
+ * @since 5.5
38
+ * @since 5.6 Visibility changed from `protected` to `public`.
39
+ * @since 7.0.2 Visibility changed back from `public` to `protected`.
40
+ * The earlier change was made to be in line with the upstream sniff,
41
+ * but that sniff is no longer being extended.
42
+ * @since 7.0.8 Property renamed from `$forbiddenFunctions` to `$removedFunctions`.
43
+ *
44
  * @var array(string => array(string => bool|string|null))
45
  */
46
  protected $removedFunctions = array(
742
  'alternative' => null,
743
  ),
744
 
745
+ 'convert_cyr_string' => array(
746
+ '7.4' => false,
747
+ 'alternative' => 'mb_convert_encoding(), iconv() or UConverter',
748
+ ),
749
+ 'ezmlm_hash' => array(
750
+ '7.4' => false,
751
+ 'alternative' => null,
752
+ ),
753
+ 'get_magic_quotes_gpc' => array(
754
+ '7.4' => false,
755
+ 'alternative' => null,
756
+ ),
757
+ 'get_magic_quotes_runtime' => array(
758
+ '7.4' => false,
759
+ 'alternative' => null,
760
+ ),
761
+ 'hebrevc' => array(
762
+ '7.4' => false,
763
+ 'alternative' => null,
764
+ ),
765
+ 'is_real' => array(
766
+ '7.4' => false,
767
+ 'alternative' => 'is_float()',
768
+ ),
769
+ 'money_format' => array(
770
+ '7.4' => false,
771
+ 'alternative' => 'NumberFormatter::formatCurrency()',
772
+ ),
773
+ 'restore_include_path' => array(
774
+ '7.4' => false,
775
+ 'alternative' => "ini_restore('include_path')",
776
+ ),
777
  'ibase_add_user' => array(
778
  '7.4' => true,
779
  'alternative' => null,
974
  '7.4' => false,
975
  'alternative' => 'ldap_search()',
976
  ),
977
+ 'recode_file' => array(
978
+ '7.4' => true,
979
+ 'alternative' => 'the iconv or mbstring extension',
980
+ ),
981
+ 'recode_string' => array(
982
+ '7.4' => true,
983
+ 'alternative' => 'the iconv or mbstring extension',
984
+ ),
985
+ 'recode' => array(
986
+ '7.4' => true,
987
+ 'alternative' => 'the iconv or mbstring extension',
988
+ ),
989
  'wddx_add_vars' => array(
990
  '7.4' => true,
991
  'alternative' => null,
1016
  /**
1017
  * Returns an array of tokens this test wants to listen for.
1018
  *
1019
+ * @since 5.6
1020
+ *
1021
  * @return array
1022
  */
1023
  public function register()
1032
  /**
1033
  * Processes this test, when one of its tokens is encountered.
1034
  *
1035
+ * @since 5.5
1036
+ *
1037
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1038
  * @param int $stackPtr The position of the current token in
1039
  * the stack passed in $tokens.
1078
  /**
1079
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
1080
  *
1081
+ * @since 7.1.0
1082
+ *
1083
  * @param array $itemInfo Base information about the item.
1084
  *
1085
  * @return array Version and other information about the item.
1093
  /**
1094
  * Get the error message template for this sniff.
1095
  *
1096
+ * @since 7.1.0
1097
+ *
1098
  * @return string
1099
  */
1100
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\FunctionUse;
@@ -14,11 +15,17 @@ use PHP_CodeSniffer_File as File;
14
  use PHP_CodeSniffer_Tokens as Tokens;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
 
22
  */
23
  class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff
24
  {
@@ -31,6 +38,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
31
  * The index is the location of the parameter in the parameter list, starting at 0 !
32
  * If's sufficient to list the last version in which the parameter was still required.
33
  *
 
 
34
  * @var array
35
  */
36
  protected $functionParameters = array(
@@ -152,6 +161,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
152
  /**
153
  * Returns an array of tokens this test wants to listen for.
154
  *
 
 
155
  * @return array
156
  */
157
  public function register()
@@ -165,6 +176,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
165
  /**
166
  * Processes this test, when one of its tokens is encountered.
167
  *
 
 
168
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
169
  * @param int $stackPtr The position of the current token in
170
  * the stack passed in $tokens.
@@ -180,6 +193,7 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
180
  \T_OBJECT_OPERATOR => true,
181
  \T_FUNCTION => true,
182
  \T_CONST => true,
 
183
  );
184
 
185
  $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
@@ -221,6 +235,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
221
  /**
222
  * Determine whether an error/warning should be thrown for an item based on collected information.
223
  *
 
 
224
  * @param array $errorInfo Detail information about an item.
225
  *
226
  * @return bool
@@ -234,6 +250,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
234
  /**
235
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
236
  *
 
 
237
  * @param array $itemInfo Base information about the item.
238
  *
239
  * @return array Version and other information about the item.
@@ -247,6 +265,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
247
  /**
248
  * Get an array of the non-PHP-version array keys used in a sub-array.
249
  *
 
 
250
  * @return array
251
  */
252
  protected function getNonVersionArrayKeys()
@@ -258,6 +278,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
258
  /**
259
  * Retrieve the relevant detail (version) information for use in an error message.
260
  *
 
 
261
  * @param array $itemArray Version and other information about the item.
262
  * @param array $itemInfo Base information about the item.
263
  *
@@ -289,6 +311,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
289
  /**
290
  * Get the error message template for this sniff.
291
  *
 
 
292
  * @return string
293
  */
294
  protected function getErrorMsgTemplate()
@@ -300,6 +324,8 @@ class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSn
300
  /**
301
  * Generates the error or warning for this item.
302
  *
 
 
303
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
304
  * @param int $stackPtr The position of the relevant token in
305
  * the stack.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\FunctionUse;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect missing required function parameters in calls to native PHP functions.
19
  *
20
+ * Specifically when those function parameters are no longer required in more recent PHP versions.
21
+ *
22
+ * PHP version All
23
+ *
24
+ * @link https://www.php.net/manual/en/doc.changelog.php
25
+ *
26
+ * @since 7.0.3
27
+ * @since 7.1.0 Now extends the `AbstractComplexVersionSniff` instead of the base `Sniff` class.
28
+ * @since 9.0.0 Renamed from `RequiredOptionalFunctionParametersSniff` to `RequiredToOptionalFunctionParametersSniff`.
29
  */
30
  class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff
31
  {
38
  * The index is the location of the parameter in the parameter list, starting at 0 !
39
  * If's sufficient to list the last version in which the parameter was still required.
40
  *
41
+ * @since 7.0.3
42
+ *
43
  * @var array
44
  */
45
  protected $functionParameters = array(
161
  /**
162
  * Returns an array of tokens this test wants to listen for.
163
  *
164
+ * @since 7.0.3
165
+ *
166
  * @return array
167
  */
168
  public function register()
176
  /**
177
  * Processes this test, when one of its tokens is encountered.
178
  *
179
+ * @since 7.0.3
180
+ *
181
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
182
  * @param int $stackPtr The position of the current token in
183
  * the stack passed in $tokens.
193
  \T_OBJECT_OPERATOR => true,
194
  \T_FUNCTION => true,
195
  \T_CONST => true,
196
+ \T_NEW => true,
197
  );
198
 
199
  $prevToken = $phpcsFile->findPrevious(\T_WHITESPACE, ($stackPtr - 1), null, true);
235
  /**
236
  * Determine whether an error/warning should be thrown for an item based on collected information.
237
  *
238
+ * @since 7.1.0
239
+ *
240
  * @param array $errorInfo Detail information about an item.
241
  *
242
  * @return bool
250
  /**
251
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
252
  *
253
+ * @since 7.1.0
254
+ *
255
  * @param array $itemInfo Base information about the item.
256
  *
257
  * @return array Version and other information about the item.
265
  /**
266
  * Get an array of the non-PHP-version array keys used in a sub-array.
267
  *
268
+ * @since 7.1.0
269
+ *
270
  * @return array
271
  */
272
  protected function getNonVersionArrayKeys()
278
  /**
279
  * Retrieve the relevant detail (version) information for use in an error message.
280
  *
281
+ * @since 7.1.0
282
+ *
283
  * @param array $itemArray Version and other information about the item.
284
  * @param array $itemInfo Base information about the item.
285
  *
311
  /**
312
  * Get the error message template for this sniff.
313
  *
314
+ * @since 7.1.0
315
+ *
316
  * @return string
317
  */
318
  protected function getErrorMsgTemplate()
324
  /**
325
  * Generates the error or warning for this item.
326
  *
327
+ * @since 7.1.0
328
+ *
329
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
330
  * @param int $stackPtr The position of the relevant token in
331
  * the stack.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Generators/NewGeneratorReturnSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Generators\NewGeneratorReturnSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Generators;
@@ -16,21 +15,23 @@ use PHPCompatibility\PHPCSHelper;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Generators\NewGeneratorReturnSniff.
20
- *
21
- * As of PHP 7.0, a return statement can be used within a generator for a final expression to be returned.
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
28
  */
29
  class NewGeneratorReturnSniff extends Sniff
30
  {
31
  /**
32
  * Scope conditions within which a yield can exist.
33
  *
 
 
34
  * @var array
35
  */
36
  private $validConditions = array(
@@ -42,6 +43,8 @@ class NewGeneratorReturnSniff extends Sniff
42
  /**
43
  * Returns an array of tokens this test wants to listen for.
44
  *
 
 
45
  * @return array
46
  */
47
  public function register()
@@ -79,6 +82,8 @@ class NewGeneratorReturnSniff extends Sniff
79
  /**
80
  * Processes this test, when one of its tokens is encountered.
81
  *
 
 
82
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
  * @param int $stackPtr The position of the current token in the
84
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Generators;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * As of PHP 7.0, a `return` statement can be used within a generator for a final expression to be returned.
 
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.generator-return-expressions
23
+ * @link https://wiki.php.net/rfc/generator-return-expressions
24
+ * @link https://www.php.net/manual/en/language.generators.syntax.php
25
+ *
26
+ * @since 8.2.0
27
  */
28
  class NewGeneratorReturnSniff extends Sniff
29
  {
30
  /**
31
  * Scope conditions within which a yield can exist.
32
  *
33
+ * @since 9.0.0
34
+ *
35
  * @var array
36
  */
37
  private $validConditions = array(
43
  /**
44
  * Returns an array of tokens this test wants to listen for.
45
  *
46
+ * @since 8.2.0
47
+ *
48
  * @return array
49
  */
50
  public function register()
82
  /**
83
  * Processes this test, when one of its tokens is encountered.
84
  *
85
+ * @since 8.2.0
86
+ *
87
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
88
  * @param int $stackPtr The position of the current token in the
89
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/NewIniDirectivesSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\IniDirectives\NewIniDirectivesSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2013 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\IniDirectives;
@@ -14,14 +14,17 @@ use PHPCompatibility\AbstractNewFeatureSniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\IniDirectives\NewIniDirectivesSniff.
18
  *
19
- * Discourages the use of new INI directives through ini_set() or ini_get().
20
  *
21
- * @category PHP
22
- * @package PHPCompatibility
23
- * @author Wim Godden <wim.godden@cu.be>
24
- * @copyright 2013 Cu.be Solutions bvba
 
 
 
25
  */
26
  class NewIniDirectivesSniff extends AbstractNewFeatureSniff
27
  {
@@ -31,6 +34,9 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
31
  * The array lists : version number with false (not present) or true (present).
32
  * If's sufficient to list the first version where the ini directive appears.
33
  *
 
 
 
34
  * @var array(string)
35
  */
36
  protected $newIniDirectives = array(
@@ -427,6 +433,130 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
427
  '5.4' => false,
428
  '5.5' => true,
429
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
 
431
  'session.use_strict_mode' => array(
432
  '5.5.1' => false,
@@ -454,6 +584,31 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
454
  '5.6' => false,
455
  '7.0' => true,
456
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
458
  'hard_timeout' => array(
459
  '7.0' => false,
@@ -502,11 +657,34 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
502
  '7.2' => false,
503
  '7.3' => true,
504
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  );
506
 
507
  /**
508
  * Returns an array of tokens this test wants to listen for.
509
  *
 
 
510
  * @return array
511
  */
512
  public function register()
@@ -517,6 +695,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
517
  /**
518
  * Processes this test, when one of its tokens is encountered.
519
  *
 
 
520
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
521
  * @param int $stackPtr The position of the current token in the
522
  * stack passed in $tokens.
@@ -566,6 +746,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
566
  /**
567
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
568
  *
 
 
569
  * @param array $itemInfo Base information about the item.
570
  *
571
  * @return array Version and other information about the item.
@@ -579,6 +761,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
579
  /**
580
  * Get an array of the non-PHP-version array keys used in a sub-array.
581
  *
 
 
582
  * @return array
583
  */
584
  protected function getNonVersionArrayKeys()
@@ -590,6 +774,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
590
  /**
591
  * Retrieve the relevant detail (version) information for use in an error message.
592
  *
 
 
593
  * @param array $itemArray Version and other information about the item.
594
  * @param array $itemInfo Base information about the item.
595
  *
@@ -616,6 +802,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
616
  /**
617
  * Get the error message template for this sniff.
618
  *
 
 
619
  * @return string
620
  */
621
  protected function getErrorMsgTemplate()
@@ -627,6 +815,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
627
  /**
628
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
629
  *
 
 
630
  * @param string $error The error message which was created.
631
  * @param array $itemInfo Base information about the item this error message applies to.
632
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -646,6 +836,8 @@ class NewIniDirectivesSniff extends AbstractNewFeatureSniff
646
  /**
647
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
648
  *
 
 
649
  * @param array $data The error data array which was created.
650
  * @param array $itemInfo Base information about the item this error message applies to.
651
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\IniDirectives;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect the use of new INI directives through `ini_set()` or `ini_get()`.
18
  *
19
+ * PHP version All
20
  *
21
+ * @link https://www.php.net/manual/en/ini.list.php
22
+ * @link https://www.php.net/manual/en/ini.core.php
23
+ *
24
+ * @since 5.5
25
+ * @since 7.0.7 When a new directive is used with `ini_set()`, the sniff will now throw an error
26
+ * instead of a warning.
27
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
28
  */
29
  class NewIniDirectivesSniff extends AbstractNewFeatureSniff
30
  {
34
  * The array lists : version number with false (not present) or true (present).
35
  * If's sufficient to list the first version where the ini directive appears.
36
  *
37
+ * @since 5.5
38
+ * @since 7.0.3 Support for 'alternative' has been added.
39
+ *
40
  * @var array(string)
41
  */
42
  protected $newIniDirectives = array(
433
  '5.4' => false,
434
  '5.5' => true,
435
  ),
436
+ 'opcache.enable' => array(
437
+ '5.4' => false,
438
+ '5.5' => true,
439
+ ),
440
+ 'opcache.enable_cli' => array(
441
+ '5.4' => false,
442
+ '5.5' => true,
443
+ ),
444
+ 'opcache.memory_consumption' => array(
445
+ '5.4' => false,
446
+ '5.5' => true,
447
+ ),
448
+ 'opcache.interned_strings_buffer' => array(
449
+ '5.4' => false,
450
+ '5.5' => true,
451
+ ),
452
+ 'opcache.max_accelerated_files' => array(
453
+ '5.4' => false,
454
+ '5.5' => true,
455
+ ),
456
+ 'opcache.max_wasted_percentage' => array(
457
+ '5.4' => false,
458
+ '5.5' => true,
459
+ ),
460
+ 'opcache.use_cwd' => array(
461
+ '5.4' => false,
462
+ '5.5' => true,
463
+ ),
464
+ 'opcache.validate_timestamps' => array(
465
+ '5.4' => false,
466
+ '5.5' => true,
467
+ ),
468
+ 'opcache.revalidate_freq' => array(
469
+ '5.4' => false,
470
+ '5.5' => true,
471
+ ),
472
+ 'opcache.revalidate_path' => array(
473
+ '5.4' => false,
474
+ '5.5' => true,
475
+ ),
476
+ 'opcache.save_comments' => array(
477
+ '5.4' => false,
478
+ '5.5' => true,
479
+ ),
480
+ 'opcache.load_comments' => array(
481
+ '5.4' => false,
482
+ '5.5' => true,
483
+ ),
484
+ 'opcache.fast_shutdown' => array(
485
+ '5.4' => false,
486
+ '5.5' => true,
487
+ ),
488
+ 'opcache.enable_file_override' => array(
489
+ '5.4' => false,
490
+ '5.5' => true,
491
+ ),
492
+ 'opcache.optimization_level' => array(
493
+ '5.4' => false,
494
+ '5.5' => true,
495
+ ),
496
+ 'opcache.inherited_hack' => array(
497
+ '5.4' => false,
498
+ '5.5' => true,
499
+ ),
500
+ 'opcache.dups_fix' => array(
501
+ '5.4' => false,
502
+ '5.5' => true,
503
+ ),
504
+ 'opcache.blacklist_filename' => array(
505
+ '5.4' => false,
506
+ '5.5' => true,
507
+ ),
508
+ 'opcache.max_file_size' => array(
509
+ '5.4' => false,
510
+ '5.5' => true,
511
+ ),
512
+ 'opcache.consistency_checks' => array(
513
+ '5.4' => false,
514
+ '5.5' => true,
515
+ ),
516
+ 'opcache.force_restart_timeout' => array(
517
+ '5.4' => false,
518
+ '5.5' => true,
519
+ ),
520
+ 'opcache.error_log' => array(
521
+ '5.4' => false,
522
+ '5.5' => true,
523
+ ),
524
+ 'opcache.log_verbosity_level' => array(
525
+ '5.4' => false,
526
+ '5.5' => true,
527
+ ),
528
+ 'opcache.preferred_memory_model' => array(
529
+ '5.4' => false,
530
+ '5.5' => true,
531
+ ),
532
+ 'opcache.protect_memory' => array(
533
+ '5.4' => false,
534
+ '5.5' => true,
535
+ ),
536
+ 'opcache.mmap_base' => array(
537
+ '5.4' => false,
538
+ '5.5' => true,
539
+ ),
540
+ 'opcache.restrict_api' => array(
541
+ '5.4' => false,
542
+ '5.5' => true,
543
+ ),
544
+ 'opcache.file_update_protection' => array(
545
+ '5.4' => false,
546
+ '5.5' => true,
547
+ ),
548
+ 'opcache.huge_code_pages' => array(
549
+ '5.4' => false,
550
+ '5.5' => true,
551
+ ),
552
+ 'opcache.lockfile_path' => array(
553
+ '5.4' => false,
554
+ '5.5' => true,
555
+ ),
556
+ 'opcache.opt_debug_level' => array(
557
+ '5.4' => false,
558
+ '5.5' => true,
559
+ ),
560
 
561
  'session.use_strict_mode' => array(
562
  '5.5.1' => false,
584
  '5.6' => false,
585
  '7.0' => true,
586
  ),
587
+ 'opcache.file_cache' => array(
588
+ '5.6' => false,
589
+ '7.0' => true,
590
+ ),
591
+ 'opcache.file_cache_only' => array(
592
+ '5.6' => false,
593
+ '7.0' => true,
594
+ ),
595
+ 'opcache.file_cache_consistency_checks' => array(
596
+ '5.6' => false,
597
+ '7.0' => true,
598
+ ),
599
+ 'opcache.file_cache_fallback' => array(
600
+ '5.6' => false,
601
+ '7.0' => true,
602
+ ), // Windows only.
603
+
604
+ 'opcache.validate_permission' => array(
605
+ '7.0.13' => false,
606
+ '7.0.14' => true,
607
+ ),
608
+ 'opcache.validate_root' => array(
609
+ '7.0.13' => false,
610
+ '7.0.14' => true,
611
+ ),
612
 
613
  'hard_timeout' => array(
614
  '7.0' => false,
657
  '7.2' => false,
658
  '7.3' => true,
659
  ),
660
+
661
+ 'ffi.enable' => array(
662
+ '7.3' => false,
663
+ '7.4' => true,
664
+ ),
665
+ 'ffi.preload' => array(
666
+ '7.3' => false,
667
+ '7.4' => true,
668
+ ),
669
+ 'opcache.cache_id' => array(
670
+ '7.3' => false,
671
+ '7.4' => true,
672
+ ),
673
+ 'opcache.preload' => array(
674
+ '7.3' => false,
675
+ '7.4' => true,
676
+ ),
677
+ 'zend.exception_ignore_args' => array(
678
+ '7.3' => false,
679
+ '7.4' => true,
680
+ ),
681
  );
682
 
683
  /**
684
  * Returns an array of tokens this test wants to listen for.
685
  *
686
+ * @since 5.5
687
+ *
688
  * @return array
689
  */
690
  public function register()
695
  /**
696
  * Processes this test, when one of its tokens is encountered.
697
  *
698
+ * @since 5.5
699
+ *
700
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
701
  * @param int $stackPtr The position of the current token in the
702
  * stack passed in $tokens.
746
  /**
747
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
748
  *
749
+ * @since 7.1.0
750
+ *
751
  * @param array $itemInfo Base information about the item.
752
  *
753
  * @return array Version and other information about the item.
761
  /**
762
  * Get an array of the non-PHP-version array keys used in a sub-array.
763
  *
764
+ * @since 7.1.0
765
+ *
766
  * @return array
767
  */
768
  protected function getNonVersionArrayKeys()
774
  /**
775
  * Retrieve the relevant detail (version) information for use in an error message.
776
  *
777
+ * @since 7.1.0
778
+ *
779
  * @param array $itemArray Version and other information about the item.
780
  * @param array $itemInfo Base information about the item.
781
  *
802
  /**
803
  * Get the error message template for this sniff.
804
  *
805
+ * @since 7.1.0
806
+ *
807
  * @return string
808
  */
809
  protected function getErrorMsgTemplate()
815
  /**
816
  * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
817
  *
818
+ * @since 7.1.0
819
+ *
820
  * @param string $error The error message which was created.
821
  * @param array $itemInfo Base information about the item this error message applies to.
822
  * @param array $errorInfo Detail information about an item this error message applies to.
836
  /**
837
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
838
  *
839
+ * @since 7.1.0
840
+ *
841
  * @param array $data The error data array which was created.
842
  * @param array $itemInfo Base information about the item this error message applies to.
843
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/IniDirectives/RemovedIniDirectivesSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\IniDirectives\RemovedIniDirectivesSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2012 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\IniDirectives;
@@ -14,23 +14,31 @@ use PHPCompatibility\AbstractRemovedFeatureSniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\IniDirectives\RemovedIniDirectivesSniff.
18
  *
19
- * Discourages the use of deprecated and removed INI directives through ini_set() or ini_get().
20
  *
21
- * @category PHP
22
- * @package PHPCompatibility
23
- * @author Wim Godden <wim.godden@cu.be>
24
- * @copyright 2012 Cu.be Solutions bvba
 
 
 
 
 
25
  */
26
  class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
27
  {
28
  /**
29
- * A list of deprecated INI directives.
30
  *
31
  * The array lists : version number with false (deprecated) and true (removed).
32
  * If's sufficient to list the first version where the ini directive was deprecated/removed.
33
  *
 
 
 
34
  * @var array(string)
35
  */
36
  protected $deprecatedIniDirectives = array(
@@ -204,6 +212,9 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
204
  'xsl.security_prefs' => array(
205
  '7.0' => true,
206
  ),
 
 
 
207
 
208
  'mcrypt.algorithms_dir' => array(
209
  '7.1' => false,
@@ -250,6 +261,9 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
250
  '7.3' => false, // Has been marked as deprecated in the manual from before this time. Now hard-deprecated.
251
  ),
252
 
 
 
 
253
  'ibase.allow_persistent' => array(
254
  '7.4' => true,
255
  ),
@@ -285,6 +299,8 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
285
  /**
286
  * Returns an array of tokens this test wants to listen for.
287
  *
 
 
288
  * @return array
289
  */
290
  public function register()
@@ -295,6 +311,8 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
295
  /**
296
  * Processes this test, when one of its tokens is encountered.
297
  *
 
 
298
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
299
  * @param int $stackPtr The position of the current token in the
300
  * stack passed in $tokens.
@@ -344,6 +362,8 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
344
  /**
345
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
346
  *
 
 
347
  * @param array $itemInfo Base information about the item.
348
  *
349
  * @return array Version and other information about the item.
@@ -357,6 +377,8 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
357
  /**
358
  * Retrieve the relevant detail (version) information for use in an error message.
359
  *
 
 
360
  * @param array $itemArray Version and other information about the item.
361
  * @param array $itemInfo Base information about the item.
362
  *
@@ -378,6 +400,8 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
378
  /**
379
  * Get the error message template for this sniff.
380
  *
 
 
381
  * @return string
382
  */
383
  protected function getErrorMsgTemplate()
@@ -389,10 +413,12 @@ class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
389
  /**
390
  * Get the error message template for suggesting an alternative for a specific sniff.
391
  *
 
 
392
  * @return string
393
  */
394
  protected function getAlternativeOptionTemplate()
395
  {
396
- return str_replace("%s", "'%s'", parent::getAlternativeOptionTemplate());
397
  }
398
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\IniDirectives;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect the use of deprecated and removed INI directives through `ini_set()` or `ini_get()`.
18
  *
19
+ * PHP version All
20
  *
21
+ * @link https://www.php.net/manual/en/ini.list.php
22
+ * @link https://www.php.net/manual/en/ini.core.php
23
+ *
24
+ * @since 5.5
25
+ * @since 7.0.0 This sniff now throws a warning (deprecated) or an error (removed) depending
26
+ * on the `testVersion` set. Previously it would always throw a warning.
27
+ * @since 7.0.1 The sniff will now only throw warnings for `ini_get()`.
28
+ * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
29
+ * @since 9.0.0 Renamed from `DeprecatedIniDirectivesSniff` to `RemovedIniDirectivesSniff`.
30
  */
31
  class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff
32
  {
33
  /**
34
+ * A list of deprecated/removed INI directives.
35
  *
36
  * The array lists : version number with false (deprecated) and true (removed).
37
  * If's sufficient to list the first version where the ini directive was deprecated/removed.
38
  *
39
+ * @since 5.5
40
+ * @since 7.0.3 Support for 'alternative' has been added.
41
+ *
42
  * @var array(string)
43
  */
44
  protected $deprecatedIniDirectives = array(
212
  'xsl.security_prefs' => array(
213
  '7.0' => true,
214
  ),
215
+ 'opcache.load_comments' => array(
216
+ '7.0' => true,
217
+ ),
218
 
219
  'mcrypt.algorithms_dir' => array(
220
  '7.1' => false,
261
  '7.3' => false, // Has been marked as deprecated in the manual from before this time. Now hard-deprecated.
262
  ),
263
 
264
+ 'allow_url_include' => array(
265
+ '7.4' => false,
266
+ ),
267
  'ibase.allow_persistent' => array(
268
  '7.4' => true,
269
  ),
299
  /**
300
  * Returns an array of tokens this test wants to listen for.
301
  *
302
+ * @since 5.5
303
+ *
304
  * @return array
305
  */
306
  public function register()
311
  /**
312
  * Processes this test, when one of its tokens is encountered.
313
  *
314
+ * @since 5.5
315
+ *
316
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
317
  * @param int $stackPtr The position of the current token in the
318
  * stack passed in $tokens.
362
  /**
363
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
364
  *
365
+ * @since 7.1.0
366
+ *
367
  * @param array $itemInfo Base information about the item.
368
  *
369
  * @return array Version and other information about the item.
377
  /**
378
  * Retrieve the relevant detail (version) information for use in an error message.
379
  *
380
+ * @since 7.1.0
381
+ *
382
  * @param array $itemArray Version and other information about the item.
383
  * @param array $itemInfo Base information about the item.
384
  *
400
  /**
401
  * Get the error message template for this sniff.
402
  *
403
+ * @since 7.1.0
404
+ *
405
  * @return string
406
  */
407
  protected function getErrorMsgTemplate()
413
  /**
414
  * Get the error message template for suggesting an alternative for a specific sniff.
415
  *
416
+ * @since 7.1.0
417
+ *
418
  * @return string
419
  */
420
  protected function getAlternativeOptionTemplate()
421
  {
422
+ return str_replace('%s', "'%s'", parent::getAlternativeOptionTemplate());
423
  }
424
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingConstSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantArraysUsingConstSniff.
4
  *
5
- * PHP version 5.6
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\InitialValue;
@@ -15,15 +14,16 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantArraysUsingConstSniff.
19
- *
20
- * Constant arrays using the const keyword in PHP 5.6
21
  *
22
  * PHP version 5.6
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
27
  */
28
  class NewConstantArraysUsingConstSniff extends Sniff
29
  {
@@ -31,6 +31,8 @@ class NewConstantArraysUsingConstSniff extends Sniff
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,6 +43,8 @@ class NewConstantArraysUsingConstSniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token in the
46
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\InitialValue;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect declaration of constants using the `const` keyword with a (constant) array value
18
+ * as supported since PHP 5.6.
 
19
  *
20
  * PHP version 5.6
21
  *
22
+ * @link https://wiki.php.net/rfc/const_scalar_exprs
23
+ * @link https://www.php.net/manual/en/language.constants.syntax.php
24
+ *
25
+ * @since 7.1.4
26
+ * @since 9.0.0 Renamed from `ConstantArraysUsingConstSniff` to `NewConstantArraysUsingConstSniff`.
27
  */
28
  class NewConstantArraysUsingConstSniff extends Sniff
29
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
34
+ * @since 7.1.4
35
+ *
36
  * @return array
37
  */
38
  public function register()
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
46
+ * @since 7.1.4
47
+ *
48
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
49
  * @param int $stackPtr The position of the current token in the
50
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantArraysUsingDefineSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\InitialValue;
@@ -15,15 +14,16 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantArraysUsingDefineSniff.
19
- *
20
- * Constant arrays using define in PHP 7.0
21
  *
22
  * PHP version 7.0
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Wim Godden <wim@cu.be>
 
 
27
  */
28
  class NewConstantArraysUsingDefineSniff extends Sniff
29
  {
@@ -31,6 +31,8 @@ class NewConstantArraysUsingDefineSniff extends Sniff
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,6 +43,8 @@ class NewConstantArraysUsingDefineSniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token in the
46
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\InitialValue;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect declaration of constants using `define()` with a (constant) array value
18
+ * as supported since PHP 7.0.
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.define-array
23
+ * @link https://www.php.net/manual/en/language.constants.syntax.php
24
+ *
25
+ * @since 7.0.0
26
+ * @since 9.0.0 Renamed from `ConstantArraysUsingDefineSniff` to `NewConstantArraysUsingDefineSniff`.
27
  */
28
  class NewConstantArraysUsingDefineSniff extends Sniff
29
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
34
+ * @since 7.0.0
35
+ *
36
  * @return array
37
  */
38
  public function register()
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
46
+ * @since 7.0.0
47
+ *
48
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
49
  * @param int $stackPtr The position of the current token in the
50
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantScalarExpressionsSniff.
4
  *
5
- * PHP version 5.6
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\InitialValue;
@@ -17,18 +16,19 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\InitialValue\NewConstantScalarExpressionsSniff.
21
  *
22
  * Since PHP 5.6, it is now possible to provide a scalar expression involving
23
  * numeric and string literals and/or constants in contexts where PHP previously
24
  * expected a static value, such as constant and property declarations and
25
- * default function arguments.
26
  *
27
  * PHP version 5.6
28
  *
29
- * @category PHP
30
- * @package PHPCompatibility
31
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
32
  */
33
  class NewConstantScalarExpressionsSniff extends Sniff
34
  {
@@ -36,6 +36,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
36
  /**
37
  * Error message.
38
  *
 
 
39
  * @var string
40
  */
41
  const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.';
@@ -43,6 +45,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
43
  /**
44
  * Partial error phrases to be used in combination with the error message constant.
45
  *
 
 
46
  * @var array
47
  */
48
  protected $errorPhrases = array(
@@ -57,6 +61,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
57
  *
58
  * This list will be enriched in the setProperties() method.
59
  *
 
 
60
  * @var array
61
  */
62
  protected $safeOperands = array(
@@ -89,6 +95,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
89
  /**
90
  * Returns an array of tokens this test wants to listen for.
91
  *
 
 
92
  * @return array
93
  */
94
  public function register()
@@ -109,6 +117,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
109
  /**
110
  * Make some adjustments to the $safeOperands property.
111
  *
 
 
112
  * @return void
113
  */
114
  public function setProperties()
@@ -121,6 +131,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
121
  /**
122
  * Do a version check to determine if this sniff needs to run at all.
123
  *
 
 
124
  * @return bool
125
  */
126
  protected function bowOutEarly()
@@ -132,6 +144,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
132
  /**
133
  * Processes this test, when one of its tokens is encountered.
134
  *
 
 
135
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
136
  * @param int $stackPtr The position of the current token in the
137
  * stack passed in $tokens.
@@ -296,6 +310,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
296
  /**
297
  * Is a value declared and is the value declared valid pre-PHP 5.6 ?
298
  *
 
 
299
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
300
  * @param int $stackPtr The position of the current token in the
301
  * stack passed in $tokens.
@@ -320,13 +336,15 @@ class NewConstantScalarExpressionsSniff extends Sniff
320
  /**
321
  * Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ?
322
  *
 
 
323
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
324
  * @param array $tokens The token stack of the current file.
325
  * @param int $start The stackPtr from which to start examining.
326
  * @param int $end The end of the value definition (inclusive),
327
  * i.e. this token will be examined as part of
328
  * the snippet.
329
- * @param bool $nestedArrays Optional. Array nesting level when examining
330
  * the content of an array.
331
  *
332
  * @return bool
@@ -464,6 +482,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
464
  /**
465
  * Throw an error if a scalar expression is found.
466
  *
 
 
467
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
468
  * @param int $stackPtr The position of the token to link the error to.
469
  * @param string $type Type of usage found.
@@ -499,6 +519,8 @@ class NewConstantScalarExpressionsSniff extends Sniff
499
  * Checks whether a certain part of a declaration needs to be skipped over or
500
  * if it is the real end of the declaration.
501
  *
 
 
502
  * @param array $tokens Token stack of the current file.
503
  * @param int $endPtr The token to examine as a candidate end pointer.
504
  * @param int $targetLevel Target nesting level.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\InitialValue;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Detect constant scalar expressions being used to set an initial value.
20
  *
21
  * Since PHP 5.6, it is now possible to provide a scalar expression involving
22
  * numeric and string literals and/or constants in contexts where PHP previously
23
  * expected a static value, such as constant and property declarations and
24
+ * default values for function parameters.
25
  *
26
  * PHP version 5.6
27
  *
28
+ * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs
29
+ * @link https://wiki.php.net/rfc/const_scalar_exprs
30
+ *
31
+ * @since 8.2.0
32
  */
33
  class NewConstantScalarExpressionsSniff extends Sniff
34
  {
36
  /**
37
  * Error message.
38
  *
39
+ * @since 8.2.0
40
+ *
41
  * @var string
42
  */
43
  const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.';
45
  /**
46
  * Partial error phrases to be used in combination with the error message constant.
47
  *
48
+ * @since 8.2.0
49
+ *
50
  * @var array
51
  */
52
  protected $errorPhrases = array(
61
  *
62
  * This list will be enriched in the setProperties() method.
63
  *
64
+ * @since 8.2.0
65
+ *
66
  * @var array
67
  */
68
  protected $safeOperands = array(
95
  /**
96
  * Returns an array of tokens this test wants to listen for.
97
  *
98
+ * @since 8.2.0
99
+ *
100
  * @return array
101
  */
102
  public function register()
117
  /**
118
  * Make some adjustments to the $safeOperands property.
119
  *
120
+ * @since 8.2.0
121
+ *
122
  * @return void
123
  */
124
  public function setProperties()
131
  /**
132
  * Do a version check to determine if this sniff needs to run at all.
133
  *
134
+ * @since 8.2.0
135
+ *
136
  * @return bool
137
  */
138
  protected function bowOutEarly()
144
  /**
145
  * Processes this test, when one of its tokens is encountered.
146
  *
147
+ * @since 8.2.0
148
+ *
149
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
150
  * @param int $stackPtr The position of the current token in the
151
  * stack passed in $tokens.
310
  /**
311
  * Is a value declared and is the value declared valid pre-PHP 5.6 ?
312
  *
313
+ * @since 8.2.0
314
+ *
315
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
316
  * @param int $stackPtr The position of the current token in the
317
  * stack passed in $tokens.
336
  /**
337
  * Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ?
338
  *
339
+ * @since 8.2.0
340
+ *
341
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
342
  * @param array $tokens The token stack of the current file.
343
  * @param int $start The stackPtr from which to start examining.
344
  * @param int $end The end of the value definition (inclusive),
345
  * i.e. this token will be examined as part of
346
  * the snippet.
347
+ * @param int $nestedArrays Optional. Array nesting level when examining
348
  * the content of an array.
349
  *
350
  * @return bool
482
  /**
483
  * Throw an error if a scalar expression is found.
484
  *
485
+ * @since 8.2.0
486
+ *
487
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
488
  * @param int $stackPtr The position of the token to link the error to.
489
  * @param string $type Type of usage found.
519
  * Checks whether a certain part of a declaration needs to be skipped over or
520
  * if it is the real end of the declaration.
521
  *
522
+ * @since 8.2.0
523
+ *
524
  * @param array $tokens Token stack of the current file.
525
  * @param int $endPtr The token to examine as a candidate end pointer.
526
  * @param int $targetLevel Target nesting level.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\InitialValue\NewHeredocSniff.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\InitialValue;
@@ -16,7 +15,7 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\InitialValue\NewHeredocSniff.
20
  *
21
  * As of PHP 5.3.0, it's possible to initialize static variables, class properties
22
  * and constants declared using the `const` keyword, using the Heredoc syntax.
@@ -28,9 +27,12 @@ use PHP_CodeSniffer_Tokens as Tokens;
28
  *
29
  * PHP version 5.3
30
  *
31
- * @category PHP
32
- * @package PHPCompatibility
33
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
34
  */
35
  class NewHeredocSniff extends NewConstantScalarExpressionsSniff
36
  {
@@ -38,6 +40,8 @@ class NewHeredocSniff extends NewConstantScalarExpressionsSniff
38
  /**
39
  * Error message.
40
  *
 
 
41
  * @var string
42
  */
43
  const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier';
@@ -45,6 +49,8 @@ class NewHeredocSniff extends NewConstantScalarExpressionsSniff
45
  /**
46
  * Partial error phrases to be used in combination with the error message constant.
47
  *
 
 
48
  * @var array
49
  */
50
  protected $errorPhrases = array(
@@ -58,6 +64,8 @@ class NewHeredocSniff extends NewConstantScalarExpressionsSniff
58
  /**
59
  * Do a version check to determine if this sniff needs to run at all.
60
  *
 
 
61
  * @return bool
62
  */
63
  protected function bowOutEarly()
@@ -69,6 +77,8 @@ class NewHeredocSniff extends NewConstantScalarExpressionsSniff
69
  /**
70
  * Is a value declared and does the declared value not contain an heredoc ?
71
  *
 
 
72
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
73
  * @param int $stackPtr The position of the current token in the
74
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\InitialValue;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect a heredoc being used to set an initial value.
19
  *
20
  * As of PHP 5.3.0, it's possible to initialize static variables, class properties
21
  * and constants declared using the `const` keyword, using the Heredoc syntax.
27
  *
28
  * PHP version 5.3
29
  *
30
+ * @link https://www.php.net/manual/en/migration53.new-features.php
31
+ * @link https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
32
+ *
33
+ * @since 7.1.4
34
+ * @since 8.2.0 Now extends the NewConstantScalarExpressionsSniff instead of the base Sniff class.
35
+ * @since 9.0.0 Renamed from `NewHeredocInitializeSniff` to `NewHeredocSniff`.
36
  */
37
  class NewHeredocSniff extends NewConstantScalarExpressionsSniff
38
  {
40
  /**
41
  * Error message.
42
  *
43
+ * @since 8.2.0
44
+ *
45
  * @var string
46
  */
47
  const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier';
49
  /**
50
  * Partial error phrases to be used in combination with the error message constant.
51
  *
52
+ * @since 8.2.0
53
+ *
54
  * @var array
55
  */
56
  protected $errorPhrases = array(
64
  /**
65
  * Do a version check to determine if this sniff needs to run at all.
66
  *
67
+ * @since 8.2.0
68
+ *
69
  * @return bool
70
  */
71
  protected function bowOutEarly()
77
  /**
78
  * Is a value declared and does the declared value not contain an heredoc ?
79
  *
80
+ * @since 8.2.0
81
+ *
82
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
  * @param int $stackPtr The position of the current token in the
84
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/InternalInterfacesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Interfaces\InternalInterfacesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Interfaces;
@@ -14,11 +15,15 @@ use PHPCompatibility\PHPCSHelper;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\Interfaces\InternalInterfacesSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
22
  */
23
  class InternalInterfacesSniff extends Sniff
24
  {
@@ -28,6 +33,8 @@ class InternalInterfacesSniff extends Sniff
28
  *
29
  * The array lists : the error message to use.
30
  *
 
 
31
  * @var array(string => string)
32
  */
33
  protected $internalInterfaces = array(
@@ -40,6 +47,8 @@ class InternalInterfacesSniff extends Sniff
40
  /**
41
  * Returns an array of tokens this test wants to listen for.
42
  *
 
 
43
  * @return array
44
  */
45
  public function register()
@@ -60,6 +69,8 @@ class InternalInterfacesSniff extends Sniff
60
  /**
61
  * Processes this test, when one of its tokens is encountered.
62
  *
 
 
63
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
  * @param int $stackPtr The position of the current token in
65
  * the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Interfaces;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect classes which implement PHP native interfaces intended only for PHP internal use.
19
  *
20
+ * PHP version 5.0+
21
+ *
22
+ * @link https://www.php.net/manual/en/class.traversable.php
23
+ * @link https://www.php.net/manual/en/class.throwable.php
24
+ * @link https://www.php.net/manual/en/class.datetimeinterface.php
25
+ *
26
+ * @since 7.0.3
27
  */
28
  class InternalInterfacesSniff extends Sniff
29
  {
33
  *
34
  * The array lists : the error message to use.
35
  *
36
+ * @since 7.0.3
37
+ *
38
  * @var array(string => string)
39
  */
40
  protected $internalInterfaces = array(
47
  /**
48
  * Returns an array of tokens this test wants to listen for.
49
  *
50
+ * @since 7.0.3
51
+ *
52
  * @return array
53
  */
54
  public function register()
69
  /**
70
  * Processes this test, when one of its tokens is encountered.
71
  *
72
+ * @since 7.0.3
73
+ *
74
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
75
  * @param int $stackPtr The position of the current token in
76
  * the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Interfaces\NewInterfacesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Interfaces;
@@ -14,11 +15,14 @@ use PHPCompatibility\PHPCSHelper;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\Interfaces\NewInterfacesSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
22
  */
23
  class NewInterfacesSniff extends AbstractNewFeatureSniff
24
  {
@@ -29,7 +33,9 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
29
  * The array lists : version number with false (not present) or true (present).
30
  * If's sufficient to list the first version where the interface appears.
31
  *
32
- * @var array(string => array(string => int|string|null))
 
 
33
  */
34
  protected $newInterfaces = array(
35
  'Traversable' => array(
@@ -102,18 +108,22 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
102
  /**
103
  * A list of methods which cannot be used in combination with particular interfaces.
104
  *
 
 
105
  * @var array(string => array(string => string))
106
  */
107
  protected $unsupportedMethods = array(
108
  'Serializable' => array(
109
- '__sleep' => 'http://php.net/serializable',
110
- '__wakeup' => 'http://php.net/serializable',
111
  ),
112
  );
113
 
114
  /**
115
  * Returns an array of tokens this test wants to listen for.
116
  *
 
 
117
  * @return array
118
  */
119
  public function register()
@@ -143,6 +153,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
143
  /**
144
  * Processes this test, when one of its tokens is encountered.
145
  *
 
 
146
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
147
  * @param int $stackPtr The position of the current token in
148
  * the stack passed in $tokens.
@@ -188,6 +200,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
188
  * - Detect classes implementing the new interfaces.
189
  * - Detect classes implementing the new interfaces with unsupported functions.
190
  *
 
 
191
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
192
  * @param int $stackPtr The position of the current token in
193
  * the stack passed in $tokens.
@@ -253,6 +267,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
253
  *
254
  * - Detect new interfaces when used as a type hint.
255
  *
 
 
256
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
257
  * @param int $stackPtr The position of the current token in
258
  * the stack passed in $tokens.
@@ -286,6 +302,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
286
  *
287
  * - Detect new interfaces when used as a return type declaration.
288
  *
 
 
289
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
290
  * @param int $stackPtr The position of the current token in
291
  * the stack passed in $tokens.
@@ -294,7 +312,11 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
294
  */
295
  private function processReturnTypeToken(File $phpcsFile, $stackPtr)
296
  {
297
- $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
 
 
 
 
298
  $returnTypeHint = ltrim($returnTypeHint, '\\');
299
  $returnTypeHintLc = strtolower($returnTypeHint);
300
 
@@ -314,6 +336,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
314
  /**
315
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
316
  *
 
 
317
  * @param array $itemInfo Base information about the item.
318
  *
319
  * @return array Version and other information about the item.
@@ -327,6 +351,8 @@ class NewInterfacesSniff extends AbstractNewFeatureSniff
327
  /**
328
  * Get the error message template for this sniff.
329
  *
 
 
330
  * @return string
331
  */
332
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Interfaces;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect use of new PHP native interfaces and unsupported interface methods.
19
  *
20
+ * PHP version 5.0+
21
+ *
22
+ * @since 7.0.3
23
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
24
+ * @since 7.1.4 Now also detects new interfaces when used as parameter type declarations.
25
+ * @since 8.2.0 Now also detects new interfaces when used as return type declarations.
26
  */
27
  class NewInterfacesSniff extends AbstractNewFeatureSniff
28
  {
33
  * The array lists : version number with false (not present) or true (present).
34
  * If's sufficient to list the first version where the interface appears.
35
  *
36
+ * @since 7.0.3
37
+ *
38
+ * @var array(string => array(string => bool))
39
  */
40
  protected $newInterfaces = array(
41
  'Traversable' => array(
108
  /**
109
  * A list of methods which cannot be used in combination with particular interfaces.
110
  *
111
+ * @since 7.0.3
112
+ *
113
  * @var array(string => array(string => string))
114
  */
115
  protected $unsupportedMethods = array(
116
  'Serializable' => array(
117
+ '__sleep' => 'https://www.php.net/serializable',
118
+ '__wakeup' => 'https://www.php.net/serializable',
119
  ),
120
  );
121
 
122
  /**
123
  * Returns an array of tokens this test wants to listen for.
124
  *
125
+ * @since 7.0.3
126
+ *
127
  * @return array
128
  */
129
  public function register()
153
  /**
154
  * Processes this test, when one of its tokens is encountered.
155
  *
156
+ * @since 7.0.3
157
+ *
158
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
159
  * @param int $stackPtr The position of the current token in
160
  * the stack passed in $tokens.
200
  * - Detect classes implementing the new interfaces.
201
  * - Detect classes implementing the new interfaces with unsupported functions.
202
  *
203
+ * @since 7.1.4 Split off from the `process()` method.
204
+ *
205
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
206
  * @param int $stackPtr The position of the current token in
207
  * the stack passed in $tokens.
267
  *
268
  * - Detect new interfaces when used as a type hint.
269
  *
270
+ * @since 7.1.4
271
+ *
272
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
273
  * @param int $stackPtr The position of the current token in
274
  * the stack passed in $tokens.
302
  *
303
  * - Detect new interfaces when used as a return type declaration.
304
  *
305
+ * @since 8.2.0
306
+ *
307
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
308
  * @param int $stackPtr The position of the current token in
309
  * the stack passed in $tokens.
312
  */
313
  private function processReturnTypeToken(File $phpcsFile, $stackPtr)
314
  {
315
+ $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
316
+ if (empty($returnTypeHint)) {
317
+ return;
318
+ }
319
+
320
  $returnTypeHint = ltrim($returnTypeHint, '\\');
321
  $returnTypeHintLc = strtolower($returnTypeHint);
322
 
336
  /**
337
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
338
  *
339
+ * @since 7.1.0
340
+ *
341
  * @param array $itemInfo Base information about the item.
342
  *
343
  * @return array Version and other information about the item.
351
  /**
352
  * Get the error message template for this sniff.
353
  *
354
+ * @since 7.1.0
355
+ *
356
  * @return string
357
  */
358
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Keywords\CaseSensitiveKeywordsSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Keywords;
@@ -15,16 +14,16 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Keywords\CaseSensitiveKeywordsSniff.
19
  *
20
- * Prior to PHP 5.5, cases existed where the self, parent, and static keywords
21
  * were treated in a case sensitive fashion.
22
  *
23
  * PHP version 5.5
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
  */
29
  class CaseSensitiveKeywordsSniff extends Sniff
30
  {
@@ -32,6 +31,8 @@ class CaseSensitiveKeywordsSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -46,6 +47,8 @@ class CaseSensitiveKeywordsSniff extends Sniff
46
  /**
47
  * Processes this test, when one of its tokens is encountered.
48
  *
 
 
49
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
50
  * @param int $stackPtr The position of the current token in the
51
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect usage of `self`, `parent` and `static` and verify they are lowercase.
18
  *
19
+ * Prior to PHP 5.5, cases existed where the `self`, `parent`, and `static` keywords
20
  * were treated in a case sensitive fashion.
21
  *
22
  * PHP version 5.5
23
  *
24
+ * @link https://www.php.net/manual/en/migration55.incompatible.php#migration55.incompatible.self-parent-static
25
+ *
26
+ * @since 7.1.4
27
  */
28
  class CaseSensitiveKeywordsSniff extends Sniff
29
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
34
+ * @since 7.1.4
35
+ *
36
  * @return array
37
  */
38
  public function register()
47
  /**
48
  * Processes this test, when one of its tokens is encountered.
49
  *
50
+ * @since 7.1.4
51
+ *
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token in the
54
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsDeclaredSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesAsDeclaredClassSniff.
4
  *
5
- * PHP version 7.0+
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Keywords;
@@ -16,18 +15,18 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesAsDeclaredClassSniff.
20
  *
21
- * Prohibits the use of some reserved keywords to name a class, interface, trait or namespace.
22
  * Emits errors for reserved words and warnings for soft-reserved words.
23
  *
24
- * @see http://php.net/manual/en/reserved.other-reserved-words.php
25
- *
26
  * PHP version 7.0+
27
  *
28
- * @category PHP
29
- * @package PHPCompatibility
30
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
31
  */
32
  class ForbiddenNamesAsDeclaredSniff extends Sniff
33
  {
@@ -35,6 +34,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
35
  /**
36
  * List of tokens which can not be used as class, interface, trait names or as part of a namespace.
37
  *
 
 
38
  * @var array
39
  */
40
  protected $forbiddenTokens = array(
@@ -46,6 +47,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
46
  /**
47
  * T_STRING keywords to recognize as forbidden names.
48
  *
 
 
49
  * @var array
50
  */
51
  protected $forbiddenNames = array(
@@ -67,6 +70,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
67
  * Using any of these keywords to name a class, interface, trait or namespace
68
  * is highly discouraged since they may be used in future versions of PHP.
69
  *
 
 
70
  * @var array
71
  */
72
  protected $softReservedNames = array(
@@ -83,6 +88,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
83
  * word.
84
  * Set from the `register()` method.
85
  *
 
 
86
  * @var array
87
  */
88
  private $allForbiddenNames = array();
@@ -91,6 +98,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
91
  /**
92
  * Returns an array of tokens this test wants to listen for.
93
  *
 
 
94
  * @return array
95
  */
96
  public function register()
@@ -113,6 +122,8 @@ class ForbiddenNamesAsDeclaredSniff extends Sniff
113
  /**
114
  * Processes this test, when one of its tokens is encountered.
115
  *
 
 
116
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
117
  * @param int $stackPtr The position of the current token in the
118
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detects the use of some reserved keywords to name a class, interface, trait or namespace.
19
  *
 
20
  * Emits errors for reserved words and warnings for soft-reserved words.
21
  *
 
 
22
  * PHP version 7.0+
23
  *
24
+ * @link https://www.php.net/manual/en/reserved.other-reserved-words.php
25
+ * @link https://wiki.php.net/rfc/reserve_more_types_in_php_7
26
+ *
27
+ * @since 7.0.8
28
+ * @since 7.1.4 This sniff now throws a warning (soft reserved) or an error (reserved) depending
29
+ * on the `testVersion` set. Previously it would always throw an error.
30
  */
31
  class ForbiddenNamesAsDeclaredSniff extends Sniff
32
  {
34
  /**
35
  * List of tokens which can not be used as class, interface, trait names or as part of a namespace.
36
  *
37
+ * @since 7.0.8
38
+ *
39
  * @var array
40
  */
41
  protected $forbiddenTokens = array(
47
  /**
48
  * T_STRING keywords to recognize as forbidden names.
49
  *
50
+ * @since 7.0.8
51
+ *
52
  * @var array
53
  */
54
  protected $forbiddenNames = array(
70
  * Using any of these keywords to name a class, interface, trait or namespace
71
  * is highly discouraged since they may be used in future versions of PHP.
72
  *
73
+ * @since 7.0.8
74
+ *
75
  * @var array
76
  */
77
  protected $softReservedNames = array(
88
  * word.
89
  * Set from the `register()` method.
90
  *
91
+ * @since 7.0.8
92
+ *
93
  * @var array
94
  */
95
  private $allForbiddenNames = array();
98
  /**
99
  * Returns an array of tokens this test wants to listen for.
100
  *
101
+ * @since 7.0.8
102
+ *
103
  * @return array
104
  */
105
  public function register()
122
  /**
123
  * Processes this test, when one of its tokens is encountered.
124
  *
125
+ * @since 7.0.8
126
+ *
127
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
128
  * @param int $stackPtr The position of the current token in the
129
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesAsInvokedFunctionsSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Jansen Price <jansen.price@gmail.com>
8
- * @copyright 2012 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
@@ -15,14 +15,13 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesAsInvokedFunctionsSniff.
19
- *
20
  * Prohibits the use of reserved keywords invoked as functions.
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Jansen Price <jansen.price@gmail.com>
25
- * @copyright 2012 Cu.be Solutions bvba
 
26
  */
27
  class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
28
  {
@@ -30,6 +29,8 @@ class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
30
  /**
31
  * List of tokens to register.
32
  *
 
 
33
  * @var array
34
  */
35
  protected $targetedTokens = array(
@@ -59,6 +60,8 @@ class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
59
  * as its own token and for PHPCS versions which change the token to
60
  * T_STRING when used in a method call.
61
  *
 
 
62
  * @var array
63
  */
64
  protected $targetedStringTokens = array(
@@ -83,6 +86,8 @@ class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
83
  /**
84
  * Returns an array of tokens this test wants to listen for.
85
  *
 
 
86
  * @return array
87
  */
88
  public function register()
@@ -96,6 +101,8 @@ class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
96
  /**
97
  * Processes this test, when one of its tokens is encountered.
98
  *
 
 
99
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
100
  * @param int $stackPtr The position of the current token in the
101
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
 
 
18
  * Prohibits the use of reserved keywords invoked as functions.
19
  *
20
+ * PHP version All
21
+ *
22
+ * @link https://www.php.net/manual/en/reserved.keywords.php
23
+ *
24
+ * @since 5.5
25
  */
26
  class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
27
  {
29
  /**
30
  * List of tokens to register.
31
  *
32
+ * @since 5.5
33
+ *
34
  * @var array
35
  */
36
  protected $targetedTokens = array(
60
  * as its own token and for PHPCS versions which change the token to
61
  * T_STRING when used in a method call.
62
  *
63
+ * @since 5.5
64
+ *
65
  * @var array
66
  */
67
  protected $targetedStringTokens = array(
86
  /**
87
  * Returns an array of tokens this test wants to listen for.
88
  *
89
+ * @since 5.5
90
+ *
91
  * @return array
92
  */
93
  public function register()
101
  /**
102
  * Processes this test, when one of its tokens is encountered.
103
  *
104
+ * @since 5.5
105
+ *
106
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
107
  * @param int $stackPtr The position of the current token in the
108
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2012 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
@@ -15,14 +15,13 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Keywords\ForbiddenNamesSniff.
19
  *
20
- * Prohibits the use of reserved keywords as class, function, namespace or constant names.
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Wim Godden <wim.godden@cu.be>
25
- * @copyright 2012 Cu.be Solutions bvba
26
  */
27
  class ForbiddenNamesSniff extends Sniff
28
  {
@@ -31,6 +30,8 @@ class ForbiddenNamesSniff extends Sniff
31
  * A list of keywords that can not be used as function, class and namespace name or constant name.
32
  * Mentions since which version it's not allowed.
33
  *
 
 
34
  * @var array(string => string)
35
  */
36
  protected $invalidNames = array(
@@ -48,15 +49,20 @@ class ForbiddenNamesSniff extends Sniff
48
  'continue' => 'all',
49
  'declare' => 'all',
50
  'default' => 'all',
 
51
  'do' => 'all',
 
52
  'else' => 'all',
53
  'elseif' => 'all',
 
54
  'enddeclare' => 'all',
55
  'endfor' => 'all',
56
  'endforeach' => 'all',
57
  'endif' => 'all',
58
  'endswitch' => 'all',
59
  'endwhile' => 'all',
 
 
60
  'extends' => 'all',
61
  'final' => '5.0',
62
  'finally' => '5.5',
@@ -67,24 +73,34 @@ class ForbiddenNamesSniff extends Sniff
67
  'goto' => '5.3',
68
  'if' => 'all',
69
  'implements' => '5.0',
70
- 'interface' => '5.0',
 
71
  'instanceof' => '5.0',
72
  'insteadof' => '5.4',
 
 
 
73
  'namespace' => '5.3',
74
  'new' => 'all',
75
  'or' => 'all',
 
76
  'private' => '5.0',
77
  'protected' => '5.0',
78
  'public' => '5.0',
 
 
 
79
  'static' => 'all',
80
  'switch' => 'all',
81
  'throw' => '5.0',
82
  'trait' => '5.4',
83
  'try' => '5.0',
 
84
  'use' => 'all',
85
  'var' => 'all',
86
  'while' => 'all',
87
  'xor' => 'all',
 
88
  '__class__' => 'all',
89
  '__dir__' => '5.3',
90
  '__file__' => 'all',
@@ -96,6 +112,8 @@ class ForbiddenNamesSniff extends Sniff
96
  /**
97
  * A list of keywords that can follow use statements.
98
  *
 
 
99
  * @var array(string => string)
100
  */
101
  protected $validUseNames = array(
@@ -106,6 +124,8 @@ class ForbiddenNamesSniff extends Sniff
106
  /**
107
  * Scope modifiers and other keywords allowed in trait use statements.
108
  *
 
 
109
  * @var array
110
  */
111
  private $allowedModifiers = array();
@@ -113,6 +133,8 @@ class ForbiddenNamesSniff extends Sniff
113
  /**
114
  * Targeted tokens.
115
  *
 
 
116
  * @var array
117
  */
118
  protected $targetedTokens = array(
@@ -131,6 +153,8 @@ class ForbiddenNamesSniff extends Sniff
131
  /**
132
  * Returns an array of tokens this test wants to listen for.
133
  *
 
 
134
  * @return array
135
  */
136
  public function register()
@@ -150,6 +174,8 @@ class ForbiddenNamesSniff extends Sniff
150
  /**
151
  * Processes this test, when one of its tokens is encountered.
152
  *
 
 
153
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
154
  * @param int $stackPtr The position of the current token in the
155
  * stack passed in $tokens.
@@ -173,6 +199,8 @@ class ForbiddenNamesSniff extends Sniff
173
  /**
174
  * Processes this test, when one of its tokens is encountered.
175
  *
 
 
176
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
177
  * @param int $stackPtr The position of the current token in the
178
  * stack passed in $tokens.
@@ -231,6 +259,23 @@ class ForbiddenNamesSniff extends Sniff
231
  $nextNonEmpty = $maybeUseNext;
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  /*
235
  * Deal with functions declared to return by reference.
236
  */
@@ -251,7 +296,7 @@ class ForbiddenNamesSniff extends Sniff
251
  */
252
  elseif ($tokens[$stackPtr]['type'] === 'T_NAMESPACE') {
253
  if ($tokens[$stackPtr + 1]['code'] === \T_NS_SEPARATOR) {
254
- // Not a namespace declaration, but use of, i.e. namespace\someFunction();
255
  return;
256
  }
257
 
@@ -311,6 +356,8 @@ class ForbiddenNamesSniff extends Sniff
311
  /**
312
  * Processes this test, when one of its tokens is encountered.
313
  *
 
 
314
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
315
  * @param int $stackPtr The position of the current token in the
316
  * stack passed in $tokens.
@@ -360,6 +407,8 @@ class ForbiddenNamesSniff extends Sniff
360
  /**
361
  * Add the error message.
362
  *
 
 
363
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
364
  * @param int $stackPtr The position of the current token in the
365
  * stack passed in $tokens.
@@ -380,6 +429,8 @@ class ForbiddenNamesSniff extends Sniff
380
  * Check if the current token code is for a token which can be considered
381
  * the end of a (partial) use statement.
382
  *
 
 
383
  * @param int $token The current token information.
384
  *
385
  * @return bool
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detects the use of reserved keywords as class, function, namespace or constant names.
19
  *
20
+ * PHP version All
21
  *
22
+ * @link https://www.php.net/manual/en/reserved.keywords.php
23
+ *
24
+ * @since 5.5
 
25
  */
26
  class ForbiddenNamesSniff extends Sniff
27
  {
30
  * A list of keywords that can not be used as function, class and namespace name or constant name.
31
  * Mentions since which version it's not allowed.
32
  *
33
+ * @since 5.5
34
+ *
35
  * @var array(string => string)
36
  */
37
  protected $invalidNames = array(
49
  'continue' => 'all',
50
  'declare' => 'all',
51
  'default' => 'all',
52
+ 'die' => 'all',
53
  'do' => 'all',
54
+ 'echo' => 'all',
55
  'else' => 'all',
56
  'elseif' => 'all',
57
+ 'empty' => 'all',
58
  'enddeclare' => 'all',
59
  'endfor' => 'all',
60
  'endforeach' => 'all',
61
  'endif' => 'all',
62
  'endswitch' => 'all',
63
  'endwhile' => 'all',
64
+ 'eval' => 'all',
65
+ 'exit' => 'all',
66
  'extends' => 'all',
67
  'final' => '5.0',
68
  'finally' => '5.5',
73
  'goto' => '5.3',
74
  'if' => 'all',
75
  'implements' => '5.0',
76
+ 'include' => 'all',
77
+ 'include_once' => 'all',
78
  'instanceof' => '5.0',
79
  'insteadof' => '5.4',
80
+ 'interface' => '5.0',
81
+ 'isset' => 'all',
82
+ 'list' => 'all',
83
  'namespace' => '5.3',
84
  'new' => 'all',
85
  'or' => 'all',
86
+ 'print' => 'all',
87
  'private' => '5.0',
88
  'protected' => '5.0',
89
  'public' => '5.0',
90
+ 'require' => 'all',
91
+ 'require_once' => 'all',
92
+ 'return' => 'all',
93
  'static' => 'all',
94
  'switch' => 'all',
95
  'throw' => '5.0',
96
  'trait' => '5.4',
97
  'try' => '5.0',
98
+ 'unset' => 'all',
99
  'use' => 'all',
100
  'var' => 'all',
101
  'while' => 'all',
102
  'xor' => 'all',
103
+ 'yield' => '5.5',
104
  '__class__' => 'all',
105
  '__dir__' => '5.3',
106
  '__file__' => 'all',
112
  /**
113
  * A list of keywords that can follow use statements.
114
  *
115
+ * @since 7.0.1
116
+ *
117
  * @var array(string => string)
118
  */
119
  protected $validUseNames = array(
124
  /**
125
  * Scope modifiers and other keywords allowed in trait use statements.
126
  *
127
+ * @since 7.1.4
128
+ *
129
  * @var array
130
  */
131
  private $allowedModifiers = array();
133
  /**
134
  * Targeted tokens.
135
  *
136
+ * @since 5.5
137
+ *
138
  * @var array
139
  */
140
  protected $targetedTokens = array(
153
  /**
154
  * Returns an array of tokens this test wants to listen for.
155
  *
156
+ * @since 5.5
157
+ *
158
  * @return array
159
  */
160
  public function register()
174
  /**
175
  * Processes this test, when one of its tokens is encountered.
176
  *
177
+ * @since 5.5
178
+ *
179
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
180
  * @param int $stackPtr The position of the current token in the
181
  * stack passed in $tokens.
199
  /**
200
  * Processes this test, when one of its tokens is encountered.
201
  *
202
+ * @since 5.5
203
+ *
204
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
205
  * @param int $stackPtr The position of the current token in the
206
  * stack passed in $tokens.
259
  $nextNonEmpty = $maybeUseNext;
260
  }
261
 
262
+ /*
263
+ * Deal with foreach ( ... as list() ).
264
+ */
265
+ elseif ($tokens[$stackPtr]['type'] === 'T_AS'
266
+ && isset($tokens[$stackPtr]['nested_parenthesis']) === true
267
+ && $tokens[$nextNonEmpty]['code'] === \T_LIST
268
+ ) {
269
+ $parentheses = array_reverse($tokens[$stackPtr]['nested_parenthesis'], true);
270
+ foreach ($parentheses as $open => $close) {
271
+ if (isset($tokens[$open]['parenthesis_owner'])
272
+ && $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH
273
+ ) {
274
+ return;
275
+ }
276
+ }
277
+ }
278
+
279
  /*
280
  * Deal with functions declared to return by reference.
281
  */
296
  */
297
  elseif ($tokens[$stackPtr]['type'] === 'T_NAMESPACE') {
298
  if ($tokens[$stackPtr + 1]['code'] === \T_NS_SEPARATOR) {
299
+ // Not a namespace declaration, but use of, i.e. `namespace\someFunction();`.
300
  return;
301
  }
302
 
356
  /**
357
  * Processes this test, when one of its tokens is encountered.
358
  *
359
+ * @since 5.5
360
+ *
361
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
362
  * @param int $stackPtr The position of the current token in the
363
  * stack passed in $tokens.
407
  /**
408
  * Add the error message.
409
  *
410
+ * @since 7.1.0
411
+ *
412
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
413
  * @param int $stackPtr The position of the current token in the
414
  * stack passed in $tokens.
429
  * Check if the current token code is for a token which can be considered
430
  * the end of a (partial) use statement.
431
  *
432
+ * @since 7.0.8
433
+ *
434
  * @param int $token The current token information.
435
  *
436
  * @return bool
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Keywords\NewKeywordsSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2013 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
@@ -15,12 +15,18 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Keywords\NewKeywordsSniff.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Wim Godden <wim.godden@cu.be>
23
- * @copyright 2013 Cu.be Solutions bvba
 
 
 
 
 
 
24
  */
25
  class NewKeywordsSniff extends AbstractNewFeatureSniff
26
  {
@@ -38,7 +44,10 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
38
  * The callback function should return `true` if the condition is met and the
39
  * error should *not* be thrown.
40
  *
41
- * @var array(string => array(string => int|string|null))
 
 
 
42
  */
43
  protected $newKeywords = array(
44
  'T_HALT_COMPILER' => array(
@@ -149,6 +158,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
149
  *
150
  * Will be set up from the register() method.
151
  *
 
 
152
  * @var array(string => string)
153
  */
154
  protected $translateContentToToken = array();
@@ -157,6 +168,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
157
  /**
158
  * Returns an array of tokens this test wants to listen for.
159
  *
 
 
160
  * @return array
161
  */
162
  public function register()
@@ -188,6 +201,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
188
  /**
189
  * Processes this test, when one of its tokens is encountered.
190
  *
 
 
191
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
192
  * @param int $stackPtr The position of the current token in
193
  * the stack passed in $tokens.
@@ -288,6 +303,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
288
  /**
289
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
290
  *
 
 
291
  * @param array $itemInfo Base information about the item.
292
  *
293
  * @return array Version and other information about the item.
@@ -301,6 +318,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
301
  /**
302
  * Get an array of the non-PHP-version array keys used in a sub-array.
303
  *
 
 
304
  * @return array
305
  */
306
  protected function getNonVersionArrayKeys()
@@ -316,6 +335,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
316
  /**
317
  * Retrieve the relevant detail (version) information for use in an error message.
318
  *
 
 
319
  * @param array $itemArray Version and other information about the item.
320
  * @param array $itemInfo Base information about the item.
321
  *
@@ -333,6 +354,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
333
  /**
334
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
335
  *
 
 
336
  * @param array $data The error data array which was created.
337
  * @param array $itemInfo Base information about the item this error message applies to.
338
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -352,6 +375,8 @@ class NewKeywordsSniff extends AbstractNewFeatureSniff
352
  * A double quoted identifier will have the opening quote on position 3
353
  * in the string: `<<<"ID"`.
354
  *
 
 
355
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
356
  * @param int $stackPtr The position of the current token in
357
  * the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Keywords;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of new PHP keywords.
19
  *
20
+ * PHP version All
21
+ *
22
+ * @link https://wiki.php.net/rfc/heredoc-with-double-quotes
23
+ * @link https://wiki.php.net/rfc/horizontalreuse (traits)
24
+ * @link https://wiki.php.net/rfc/generators
25
+ * @link https://wiki.php.net/rfc/finally
26
+ * @link https://wiki.php.net/rfc/generator-delegation
27
+ *
28
+ * @since 5.5
29
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
30
  */
31
  class NewKeywordsSniff extends AbstractNewFeatureSniff
32
  {
44
  * The callback function should return `true` if the condition is met and the
45
  * error should *not* be thrown.
46
  *
47
+ * @since 5.5
48
+ * @since 7.0.3 Support for 'condition' has been added.
49
+ *
50
+ * @var array(string => array(string => bool|string))
51
  */
52
  protected $newKeywords = array(
53
  'T_HALT_COMPILER' => array(
158
  *
159
  * Will be set up from the register() method.
160
  *
161
+ * @since 7.0.5
162
+ *
163
  * @var array(string => string)
164
  */
165
  protected $translateContentToToken = array();
168
  /**
169
  * Returns an array of tokens this test wants to listen for.
170
  *
171
+ * @since 5.5
172
+ *
173
  * @return array
174
  */
175
  public function register()
201
  /**
202
  * Processes this test, when one of its tokens is encountered.
203
  *
204
+ * @since 5.5
205
+ *
206
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
207
  * @param int $stackPtr The position of the current token in
208
  * the stack passed in $tokens.
303
  /**
304
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
305
  *
306
+ * @since 7.1.0
307
+ *
308
  * @param array $itemInfo Base information about the item.
309
  *
310
  * @return array Version and other information about the item.
318
  /**
319
  * Get an array of the non-PHP-version array keys used in a sub-array.
320
  *
321
+ * @since 7.1.0
322
+ *
323
  * @return array
324
  */
325
  protected function getNonVersionArrayKeys()
335
  /**
336
  * Retrieve the relevant detail (version) information for use in an error message.
337
  *
338
+ * @since 7.1.0
339
+ *
340
  * @param array $itemArray Version and other information about the item.
341
  * @param array $itemInfo Base information about the item.
342
  *
354
  /**
355
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
356
  *
357
+ * @since 7.1.0
358
+ *
359
  * @param array $data The error data array which was created.
360
  * @param array $itemInfo Base information about the item this error message applies to.
361
  * @param array $errorInfo Detail information about an item this error message applies to.
375
  * A double quoted identifier will have the opening quote on position 3
376
  * in the string: `<<<"ID"`.
377
  *
378
+ * @since 8.0.0
379
+ *
380
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
381
  * @param int $stackPtr The position of the current token in
382
  * the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\LanguageConstructs\NewEmptyNonVariableSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\LanguageConstructs;
@@ -16,15 +15,19 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\LanguageConstructs\NewEmptyNonVariableSniff.
20
- *
21
  * Verify that nothing but variables are passed to empty().
22
  *
 
 
23
  * PHP version 5.5
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
28
  */
29
  class NewEmptyNonVariableSniff extends Sniff
30
  {
@@ -32,6 +35,8 @@ class NewEmptyNonVariableSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -42,6 +47,8 @@ class NewEmptyNonVariableSniff extends Sniff
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
 
 
45
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
46
  * @param int $stackPtr The position of the current token in the
47
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\LanguageConstructs;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
 
 
18
  * Verify that nothing but variables are passed to empty().
19
  *
20
+ * Prior to PHP 5.5, `empty()` only supported variables; anything else resulted in a parse error.
21
+ *
22
  * PHP version 5.5
23
  *
24
+ * @link https://wiki.php.net/rfc/empty_isset_exprs
25
+ * @link https://www.php.net/manual/en/function.empty.php
26
+ *
27
+ * @since 7.0.4
28
+ * @since 9.0.0 The "is the parameter a variable" determination has been abstracted out
29
+ * and moved to a separate method `Sniff::isVariable()`.
30
+ * @since 9.0.0 Renamed from `EmptyNonVariableSniff` to `NewEmptyNonVariableSniff`.
31
  */
32
  class NewEmptyNonVariableSniff extends Sniff
33
  {
35
  /**
36
  * Returns an array of tokens this test wants to listen for.
37
  *
38
+ * @since 7.0.4
39
+ *
40
  * @return array
41
  */
42
  public function register()
47
  /**
48
  * Processes this test, when one of its tokens is encountered.
49
  *
50
+ * @since 7.0.4
51
+ *
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token in the
54
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/LanguageConstructs/NewLanguageConstructsSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\LanguageConstructs\NewLanguageConstructsSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2013 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\LanguageConstructs;
@@ -14,12 +14,17 @@ use PHPCompatibility\AbstractNewFeatureSniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\LanguageConstructs\NewLanguageConstructsSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
22
- * @copyright 2013 Cu.be Solutions bvba
 
 
 
 
 
23
  */
24
  class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
25
  {
@@ -30,7 +35,9 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
30
  * The array lists : version number with false (not present) or true (present).
31
  * If's sufficient to list the first version where the keyword appears.
32
  *
33
- * @var array(string => array(string => int|string|null))
 
 
34
  */
35
  protected $newConstructs = array(
36
  'T_NS_SEPARATOR' => array(
@@ -49,6 +56,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
49
  /**
50
  * Returns an array of tokens this test wants to listen for.
51
  *
 
 
52
  * @return array
53
  */
54
  public function register()
@@ -64,6 +73,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
64
  /**
65
  * Processes this test, when one of its tokens is encountered.
66
  *
 
 
67
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
68
  * @param int $stackPtr The position of the current token in
69
  * the stack passed in $tokens.
@@ -85,6 +96,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
85
  /**
86
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
87
  *
 
 
88
  * @param array $itemInfo Base information about the item.
89
  *
90
  * @return array Version and other information about the item.
@@ -98,6 +111,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
98
  /**
99
  * Get an array of the non-PHP-version array keys used in a sub-array.
100
  *
 
 
101
  * @return array
102
  */
103
  protected function getNonVersionArrayKeys()
@@ -109,6 +124,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
109
  /**
110
  * Retrieve the relevant detail (version) information for use in an error message.
111
  *
 
 
112
  * @param array $itemArray Version and other information about the item.
113
  * @param array $itemInfo Base information about the item.
114
  *
@@ -126,6 +143,8 @@ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
126
  /**
127
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
128
  *
 
 
129
  * @param array $data The error data array which was created.
130
  * @param array $itemInfo Base information about the item this error message applies to.
131
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\LanguageConstructs;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of new PHP language constructs.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @link https://wiki.php.net/rfc/namespaceseparator
22
+ * @link https://wiki.php.net/rfc/variadics
23
+ * @link https://wiki.php.net/rfc/argument_unpacking
24
+ *
25
+ * @since 5.6
26
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
27
+ * @since 9.0.0 Detection for new operator tokens has been moved to the `NewOperators` sniff.
28
  */
29
  class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
30
  {
35
  * The array lists : version number with false (not present) or true (present).
36
  * If's sufficient to list the first version where the keyword appears.
37
  *
38
+ * @since 5.6
39
+ *
40
+ * @var array(string => array(string => bool|string))
41
  */
42
  protected $newConstructs = array(
43
  'T_NS_SEPARATOR' => array(
56
  /**
57
  * Returns an array of tokens this test wants to listen for.
58
  *
59
+ * @since 5.6
60
+ *
61
  * @return array
62
  */
63
  public function register()
73
  /**
74
  * Processes this test, when one of its tokens is encountered.
75
  *
76
+ * @since 5.6
77
+ *
78
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
79
  * @param int $stackPtr The position of the current token in
80
  * the stack passed in $tokens.
96
  /**
97
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
98
  *
99
+ * @since 7.1.0
100
+ *
101
  * @param array $itemInfo Base information about the item.
102
  *
103
  * @return array Version and other information about the item.
111
  /**
112
  * Get an array of the non-PHP-version array keys used in a sub-array.
113
  *
114
+ * @since 7.1.0
115
+ *
116
  * @return array
117
  */
118
  protected function getNonVersionArrayKeys()
124
  /**
125
  * Retrieve the relevant detail (version) information for use in an error message.
126
  *
127
+ * @since 7.1.0
128
+ *
129
  * @param array $itemArray Version and other information about the item.
130
  * @param array $itemInfo Base information about the item.
131
  *
143
  /**
144
  * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
145
  *
146
+ * @since 7.1.0
147
+ *
148
  * @param array $data The error data array which was created.
149
  * @param array $itemInfo Base information about the item this error message applies to.
150
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/AssignmentOrderSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Lists\AssignmentOrderSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Lists;
@@ -16,16 +15,18 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * List assignment order.
20
  *
21
- * The list() construct no longer assigns variables in reverse order.
22
  * This affects all list constructs where non-unique variables are used.
23
  *
24
  * PHP version 7.0
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
29
  */
30
  class AssignmentOrderSniff extends Sniff
31
  {
@@ -33,6 +34,8 @@ class AssignmentOrderSniff extends Sniff
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
 
 
36
  * @return array
37
  */
38
  public function register()
@@ -47,6 +50,8 @@ class AssignmentOrderSniff extends Sniff
47
  /**
48
  * Processes this test, when one of its tokens is encountered.
49
  *
 
 
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $stackPtr The position of the current token in the
52
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Lists;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect code affected by the changed list assignment order in PHP 7.0+.
19
  *
20
+ * The `list()` construct no longer assigns variables in reverse order.
21
  * This affects all list constructs where non-unique variables are used.
22
  *
23
  * PHP version 7.0
24
  *
25
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.list.order
26
+ * @link https://wiki.php.net/rfc/abstract_syntax_tree#changes_to_list
27
+ * @link https://www.php.net/manual/en/function.list.php
28
+ *
29
+ * @since 9.0.0
30
  */
31
  class AssignmentOrderSniff extends Sniff
32
  {
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
37
+ * @since 9.0.0
38
+ *
39
  * @return array
40
  */
41
  public function register()
50
  /**
51
  * Processes this test, when one of its tokens is encountered.
52
  *
53
+ * @since 9.0.0
54
+ *
55
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
56
  * @param int $stackPtr The position of the current token in the
57
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/ForbiddenEmptyListAssignmentSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Lists\ForbiddenEmptyListAssignmentSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Lists;
@@ -16,15 +15,15 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Lists\ForbiddenEmptyListAssignmentSniff.
20
- *
21
- * Empty list() assignments have been removed in PHP 7.0
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim@cu.be>
 
 
28
  */
29
  class ForbiddenEmptyListAssignmentSniff extends Sniff
30
  {
@@ -32,6 +31,8 @@ class ForbiddenEmptyListAssignmentSniff extends Sniff
32
  /**
33
  * List of tokens to disregard when determining whether the list() is empty.
34
  *
 
 
35
  * @var array
36
  */
37
  protected $ignoreTokens = array();
@@ -39,6 +40,8 @@ class ForbiddenEmptyListAssignmentSniff extends Sniff
39
  /**
40
  * Returns an array of tokens this test wants to listen for.
41
  *
 
 
42
  * @return array
43
  */
44
  public function register()
@@ -59,6 +62,8 @@ class ForbiddenEmptyListAssignmentSniff extends Sniff
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
 
 
62
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
63
  * @param int $stackPtr The position of the current token in the
64
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Lists;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Support for empty `list()` expressions has been removed in PHP 7.0.
 
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.list.empty
23
+ * @link https://wiki.php.net/rfc/abstract_syntax_tree#changes_to_list
24
+ * @link https://www.php.net/manual/en/function.list.php
25
+ *
26
+ * @since 7.0.0
27
  */
28
  class ForbiddenEmptyListAssignmentSniff extends Sniff
29
  {
31
  /**
32
  * List of tokens to disregard when determining whether the list() is empty.
33
  *
34
+ * @since 7.0.3
35
+ *
36
  * @var array
37
  */
38
  protected $ignoreTokens = array();
40
  /**
41
  * Returns an array of tokens this test wants to listen for.
42
  *
43
+ * @since 7.0.0
44
+ *
45
  * @return array
46
  */
47
  public function register()
62
  /**
63
  * Processes this test, when one of its tokens is encountered.
64
  *
65
+ * @since 7.0.0
66
+ *
67
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
68
  * @param int $stackPtr The position of the current token in the
69
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewKeyedListSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Lists\NewKeyedListSniff.
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
  namespace PHPCompatibility\Sniffs\Lists;
@@ -16,21 +15,22 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Lists\NewKeyedListSniff.
20
- *
21
- * "You can now specify keys in list(), or its new shorthand [] syntax. "
22
  *
23
  * PHP version 7.1
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
28
  */
29
  class NewKeyedListSniff extends Sniff
30
  {
31
  /**
32
  * Tokens which represent the start of a list construct.
33
  *
 
 
34
  * @var array
35
  */
36
  protected $sniffTargets = array(
@@ -41,6 +41,8 @@ class NewKeyedListSniff extends Sniff
41
  /**
42
  * The token(s) within the list construct which is being targeted.
43
  *
 
 
44
  * @var array
45
  */
46
  protected $targetsInList = array(
@@ -53,6 +55,8 @@ class NewKeyedListSniff extends Sniff
53
  *
54
  * Set by the setUpAllTargets() method which is called from within register().
55
  *
 
 
56
  * @var array
57
  */
58
  protected $allTargets;
@@ -61,6 +65,8 @@ class NewKeyedListSniff extends Sniff
61
  /**
62
  * Returns an array of tokens this test wants to listen for.
63
  *
 
 
64
  * @return array
65
  */
66
  public function register()
@@ -73,7 +79,9 @@ class NewKeyedListSniff extends Sniff
73
  /**
74
  * Prepare the $allTargets array only once.
75
  *
76
- * @return array
 
 
77
  */
78
  public function setUpAllTargets()
79
  {
@@ -83,6 +91,8 @@ class NewKeyedListSniff extends Sniff
83
  /**
84
  * Do a version check to determine if this sniff needs to run at all.
85
  *
 
 
86
  * @return bool
87
  */
88
  protected function bowOutEarly()
@@ -93,6 +103,8 @@ class NewKeyedListSniff extends Sniff
93
  /**
94
  * Processes this test, when one of its tokens is encountered.
95
  *
 
 
96
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
97
  * @param int $stackPtr The position of the current token in the
98
  * stack passed in $tokens.
@@ -146,6 +158,8 @@ class NewKeyedListSniff extends Sniff
146
  /**
147
  * Examine the contents of a list construct to determine whether an error needs to be thrown.
148
  *
 
 
149
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
150
  * @param int $opener The position of the list open token.
151
  * @param int $closer The position of the list close token.
@@ -170,6 +184,8 @@ class NewKeyedListSniff extends Sniff
170
  *
171
  * Skips past nested list constructs, so these can be examined based on their own token.
172
  *
 
 
173
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
174
  * @param int $start The position of the list open token or a token
175
  * within the list to start (resume) the examination from.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Lists;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Since PHP 7.1, you can specify keys in `list()`, or its new shorthand `[]` syntax.
 
 
19
  *
20
  * PHP version 7.1
21
  *
22
+ * @link https://wiki.php.net/rfc/list_keys
23
+ * @link https://www.php.net/manual/en/function.list.php
24
+ *
25
+ * @since 9.0.0
26
  */
27
  class NewKeyedListSniff extends Sniff
28
  {
29
  /**
30
  * Tokens which represent the start of a list construct.
31
  *
32
+ * @since 9.0.0
33
+ *
34
  * @var array
35
  */
36
  protected $sniffTargets = array(
41
  /**
42
  * The token(s) within the list construct which is being targeted.
43
  *
44
+ * @since 9.0.0
45
+ *
46
  * @var array
47
  */
48
  protected $targetsInList = array(
55
  *
56
  * Set by the setUpAllTargets() method which is called from within register().
57
  *
58
+ * @since 9.0.0
59
+ *
60
  * @var array
61
  */
62
  protected $allTargets;
65
  /**
66
  * Returns an array of tokens this test wants to listen for.
67
  *
68
+ * @since 9.0.0
69
+ *
70
  * @return array
71
  */
72
  public function register()
79
  /**
80
  * Prepare the $allTargets array only once.
81
  *
82
+ * @since 9.0.0
83
+ *
84
+ * @return void
85
  */
86
  public function setUpAllTargets()
87
  {
91
  /**
92
  * Do a version check to determine if this sniff needs to run at all.
93
  *
94
+ * @since 9.0.0
95
+ *
96
  * @return bool
97
  */
98
  protected function bowOutEarly()
103
  /**
104
  * Processes this test, when one of its tokens is encountered.
105
  *
106
+ * @since 9.0.0
107
+ *
108
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
109
  * @param int $stackPtr The position of the current token in the
110
  * stack passed in $tokens.
158
  /**
159
  * Examine the contents of a list construct to determine whether an error needs to be thrown.
160
  *
161
+ * @since 9.0.0
162
+ *
163
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
164
  * @param int $opener The position of the list open token.
165
  * @param int $closer The position of the list close token.
184
  *
185
  * Skips past nested list constructs, so these can be examined based on their own token.
186
  *
187
+ * @since 9.0.0
188
+ *
189
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
190
  * @param int $start The position of the list open token or a token
191
  * within the list to start (resume) the examination from.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewListReferenceAssignmentSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Lists\NewListReferenceAssignmentSniff.
4
  *
5
- * PHP version 7.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Lists;
@@ -19,15 +18,19 @@ use PHP_CodeSniffer_File as File;
19
  *
20
  * PHP version 7.3
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
25
  */
26
  class NewListReferenceAssignmentSniff extends NewKeyedListSniff
27
  {
28
  /**
29
  * The token(s) within the list construct which is being targeted.
30
  *
 
 
31
  * @var array
32
  */
33
  protected $targetsInList = array(
@@ -37,6 +40,8 @@ class NewListReferenceAssignmentSniff extends NewKeyedListSniff
37
  /**
38
  * Do a version check to determine if this sniff needs to run at all.
39
  *
 
 
40
  * @return bool
41
  */
42
  protected function bowOutEarly()
@@ -47,6 +52,8 @@ class NewListReferenceAssignmentSniff extends NewKeyedListSniff
47
  /**
48
  * Examine the contents of a list construct to determine whether an error needs to be thrown.
49
  *
 
 
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $opener The position of the list open token.
52
  * @param int $closer The position of the list close token.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Lists;
18
  *
19
  * PHP version 7.3
20
  *
21
+ * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.destruct-reference
22
+ * @link https://wiki.php.net/rfc/list_reference_assignment
23
+ * @link https://www.php.net/manual/en/function.list.php
24
+ *
25
+ * @since 9.0.0
26
  */
27
  class NewListReferenceAssignmentSniff extends NewKeyedListSniff
28
  {
29
  /**
30
  * The token(s) within the list construct which is being targeted.
31
  *
32
+ * @since 9.0.0
33
+ *
34
  * @var array
35
  */
36
  protected $targetsInList = array(
40
  /**
41
  * Do a version check to determine if this sniff needs to run at all.
42
  *
43
+ * @since 9.0.0
44
+ *
45
  * @return bool
46
  */
47
  protected function bowOutEarly()
52
  /**
53
  * Examine the contents of a list construct to determine whether an error needs to be thrown.
54
  *
55
+ * @since 9.0.0
56
+ *
57
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
58
  * @param int $opener The position of the list open token.
59
  * @param int $closer The position of the list close token.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Lists/NewShortListSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Lists\NewShortListSniff.
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
  namespace PHPCompatibility\Sniffs\Lists;
@@ -15,17 +14,18 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Lists\NewShortListSniff.
19
  *
20
- * "The shorthand array syntax ([]) may now be used to destructure arrays for
21
- * assignments (including within foreach), as an alternative to the existing
22
- * list() syntax, which is still supported."
23
  *
24
  * PHP version 7.1
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
29
  */
30
  class NewShortListSniff extends Sniff
31
  {
@@ -33,6 +33,8 @@ class NewShortListSniff extends Sniff
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
 
 
36
  * @return array
37
  */
38
  public function register()
@@ -43,6 +45,8 @@ class NewShortListSniff extends Sniff
43
  /**
44
  * Processes this test, when one of its tokens is encountered.
45
  *
 
 
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token in the
48
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Lists;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect short list syntax for symmetric array destructuring.
18
  *
19
+ * "The shorthand array syntax (`[]`) may now be used to destructure arrays for
20
+ * assignments (including within `foreach`), as an alternative to the existing
21
+ * `list()` syntax, which is still supported."
22
  *
23
  * PHP version 7.1
24
  *
25
+ * @link https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.symmetric-array-destructuring
26
+ * @link https://wiki.php.net/rfc/short_list_syntax
27
+ *
28
+ * @since 9.0.0
29
  */
30
  class NewShortListSniff extends Sniff
31
  {
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
36
+ * @since 9.0.0
37
+ *
38
  * @return array
39
  */
40
  public function register()
45
  /**
46
  * Processes this test, when one of its tokens is encountered.
47
  *
48
+ * @since 9.0.0
49
+ *
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $stackPtr The position of the current token in the
52
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/ForbiddenToStringParametersSniff.php CHANGED
@@ -15,14 +15,15 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * As of PHP 5.3, the __toString() magic method can no longer be passed arguments.
19
  *
20
- * Sister-sniff to PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters.
21
- *
22
- * @link https://www.php.net/manual/en/migration53.incompatible.php
23
  *
24
  * PHP version 5.3
25
  *
 
 
 
26
  * @since 9.2.0
27
  */
28
  class ForbiddenToStringParametersSniff extends Sniff
@@ -76,7 +77,7 @@ class ForbiddenToStringParametersSniff extends Sniff
76
  }
77
 
78
  if (strtolower($tokens[$nextNonEmpty]['content']) !== '__tostring') {
79
- // Not a call to the __clone() method.
80
  return;
81
  }
82
 
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * As of PHP 5.3, the `__toString()` magic method can no longer be passed arguments.
19
  *
20
+ * Sister-sniff to `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters`.
 
 
21
  *
22
  * PHP version 5.3
23
  *
24
+ * @link https://www.php.net/manual/en/migration53.incompatible.php
25
+ * @link https://www.php.net/manual/en/language.oop5.magic.php#object.tostring
26
+ *
27
  * @since 9.2.0
28
  */
29
  class ForbiddenToStringParametersSniff extends Sniff
77
  }
78
 
79
  if (strtolower($tokens[$nextNonEmpty]['content']) !== '__tostring') {
80
+ // Not a call to the __toString() method.
81
  return;
82
  }
83
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/MethodUse/NewDirectCallsToCloneSniff.php CHANGED
@@ -3,7 +3,7 @@
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
- * @copyright 2012-2018 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
@@ -15,21 +15,35 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * Detect direct calls to the __clone() magic method which is allowed since PHP 7.0.
19
  *
20
- * "Doing calls like $obj->__clone() is now allowed. This was the only magic method
21
  * that had a compile-time check preventing some calls to it, which doesn't make sense.
22
  * If we allow all other magic methods to be called, there's no reason to forbid this one."
23
  *
24
  * PHP version 7.0
25
  *
26
  * @link https://wiki.php.net/rfc/abstract_syntax_tree#directly_calling_clone_is_allowed
 
27
  *
28
  * @since 9.1.0
29
  */
30
  class NewDirectCallsToCloneSniff extends Sniff
31
  {
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
@@ -88,6 +102,12 @@ class NewDirectCallsToCloneSniff extends Sniff
88
  return;
89
  }
90
 
 
 
 
 
 
 
91
  $phpcsFile->addError(
92
  'Direct calls to the __clone() magic method are not allowed in PHP 5.6 or earlier.',
93
  $nextNonEmpty,
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect direct calls to the `__clone()` magic method, which is allowed since PHP 7.0.
19
  *
20
+ * "Doing calls like `$obj->__clone()` is now allowed. This was the only magic method
21
  * that had a compile-time check preventing some calls to it, which doesn't make sense.
22
  * If we allow all other magic methods to be called, there's no reason to forbid this one."
23
  *
24
  * PHP version 7.0
25
  *
26
  * @link https://wiki.php.net/rfc/abstract_syntax_tree#directly_calling_clone_is_allowed
27
+ * @link https://www.php.net/manual/en/language.oop5.cloning.php
28
  *
29
  * @since 9.1.0
30
  */
31
  class NewDirectCallsToCloneSniff extends Sniff
32
  {
33
 
34
+ /**
35
+ * Tokens which indicate class internal use.
36
+ *
37
+ * @since 9.3.2
38
+ *
39
+ * @var array
40
+ */
41
+ protected $classInternal = array(
42
+ \T_PARENT => true,
43
+ \T_SELF => true,
44
+ \T_STATIC => true,
45
+ );
46
+
47
  /**
48
  * Returns an array of tokens this test wants to listen for.
49
  *
102
  return;
103
  }
104
 
105
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
106
+ if ($prevNonEmpty === false || isset($this->classInternal[$tokens[$prevNonEmpty]['code']])) {
107
+ // Class internal call to __clone().
108
+ return;
109
+ }
110
+
111
  $phpcsFile->addError(
112
  'Direct calls to the __clone() magic method are not allowed in PHP 5.6 or earlier.',
113
  $nextNonEmpty,
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/NewPHPOpenTagEOFSniff.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\Miscellaneous;
12
+
13
+ use PHPCompatibility\Sniff;
14
+ use PHP_CodeSniffer_File as File;
15
+
16
+ /**
17
+ * PHP 7.4 now supports stand-alone PHP tags at the end of a file (without new line).
18
+ *
19
+ * > `<?php` at the end of the file (without trailing newline) will now be
20
+ * > interpreted as an opening PHP tag. Previously it was interpreted either as
21
+ * > `<? php` and resulted in a syntax error (with short_open_tag=1) or was
22
+ * > interpreted as a literal `<?php` string (with short_open_tag=0).
23
+ *
24
+ * {@internal Due to an issue with the Tokenizer, this sniff will not work correctly
25
+ * on PHP 5.3 in combination with PHPCS < 2.6.0 when short_open_tag is `On`.
26
+ * As this is causing "Undefined offset" notices, there is nothing we can
27
+ * do to work-around this.}
28
+ *
29
+ * PHP version 7.4
30
+ *
31
+ * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.php-tag
32
+ * @link https://github.com/php/php-src/blob/30de357fa14480468132bbc22a272aeb91789ba8/UPGRADING#L37-L40
33
+ *
34
+ * @since 9.3.0
35
+ */
36
+ class NewPHPOpenTagEOFSniff extends Sniff
37
+ {
38
+
39
+ /**
40
+ * Whether or not short open tags is enabled on the install running the sniffs.
41
+ *
42
+ * @since 9.3.0
43
+ *
44
+ * @var bool
45
+ */
46
+ protected $shortOpenTags;
47
+
48
+
49
+ /**
50
+ * Returns an array of tokens this test wants to listen for.
51
+ *
52
+ * @since 9.3.0
53
+ *
54
+ * @return array
55
+ */
56
+ public function register()
57
+ {
58
+ $targets = array(
59
+ \T_OPEN_TAG_WITH_ECHO,
60
+ );
61
+
62
+ $this->shortOpenTags = (bool) ini_get('short_open_tag');
63
+ if ($this->shortOpenTags === false) {
64
+ $targets[] = \T_INLINE_HTML;
65
+ } else {
66
+ $targets[] = \T_STRING;
67
+ }
68
+
69
+ if (version_compare(\PHP_VERSION_ID, '70399', '>')) {
70
+ $targets[] = \T_OPEN_TAG;
71
+ }
72
+
73
+ return $targets;
74
+ }
75
+
76
+
77
+ /**
78
+ * Processes this test, when one of its tokens is encountered.
79
+ *
80
+ * @since 9.3.0
81
+ *
82
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
+ * @param int $stackPtr The position of the current token
84
+ * in the stack passed in $tokens.
85
+ *
86
+ * @return void
87
+ */
88
+ public function process(File $phpcsFile, $stackPtr)
89
+ {
90
+ if ($this->supportsBelow('7.3') === false) {
91
+ return;
92
+ }
93
+
94
+ if ($stackPtr !== ($phpcsFile->numTokens - 1)) {
95
+ // We're only interested in the last token in the file.
96
+ return;
97
+ }
98
+
99
+ $tokens = $phpcsFile->getTokens();
100
+ $contents = $tokens[$stackPtr]['content'];
101
+ $error = false;
102
+
103
+ switch ($tokens[$stackPtr]['code']) {
104
+ case \T_INLINE_HTML:
105
+ // PHP < 7.4 with short open tags off.
106
+ if ($contents === '<?php') {
107
+ $error = true;
108
+ } elseif ($contents === '<?=') {
109
+ // Also cover short open echo tags in PHP 5.3 with short open tags off.
110
+ $error = true;
111
+ }
112
+ break;
113
+
114
+ case \T_STRING:
115
+ // PHP < 7.4 with short open tags on.
116
+ if ($contents === 'php'
117
+ && $tokens[($stackPtr - 1)]['code'] === \T_OPEN_TAG
118
+ && $tokens[($stackPtr - 1)]['content'] === '<?'
119
+ ) {
120
+ $error = true;
121
+ }
122
+ break;
123
+
124
+ case \T_OPEN_TAG_WITH_ECHO:
125
+ // PHP 5.4+.
126
+ if (rtrim($contents) === '<?=') {
127
+ $error = true;
128
+ }
129
+ break;
130
+
131
+ case \T_OPEN_TAG:
132
+ // PHP 7.4+.
133
+ if ($contents === '<?php') {
134
+ $error = true;
135
+ }
136
+ break;
137
+ }
138
+
139
+ if ($error === true) {
140
+ $phpcsFile->addError(
141
+ 'A PHP open tag at the end of a file, without trailing newline, was not supported in PHP 7.3 or earlier and would result in a syntax error or be interpreted as a literal string',
142
+ $stackPtr,
143
+ 'Found'
144
+ );
145
+ }
146
+ }
147
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/RemovedAlternativePHPTagsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Miscellaneous\RemovedAlternativePHPTags.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Miscellaneous;
@@ -15,18 +14,17 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Miscellaneous\RemovedAlternativePHPTags.
19
  *
20
- * Check for usage of alternative PHP tags - removed in PHP 7.0.
 
21
  *
22
  * PHP version 7.0
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
27
  *
28
- * Based on `Generic_Sniffs_PHP_DisallowAlternativePHPTags` by Juliette Reinders Folmer
29
- * which was merged into PHPCS 2.7.0.
30
  */
31
  class RemovedAlternativePHPTagsSniff extends Sniff
32
  {
@@ -34,6 +32,8 @@ class RemovedAlternativePHPTagsSniff extends Sniff
34
  /**
35
  * Whether ASP tags are enabled or not.
36
  *
 
 
37
  * @var bool
38
  */
39
  private $aspTags = false;
@@ -41,6 +41,8 @@ class RemovedAlternativePHPTagsSniff extends Sniff
41
  /**
42
  * Returns an array of tokens this test wants to listen for.
43
  *
 
 
44
  * @return array
45
  */
46
  public function register()
@@ -61,6 +63,8 @@ class RemovedAlternativePHPTagsSniff extends Sniff
61
  /**
62
  * Processes this test, when one of its tokens is encountered.
63
  *
 
 
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token
66
  * in the stack passed in $tokens.
@@ -123,7 +127,7 @@ class RemovedAlternativePHPTagsSniff extends Sniff
123
  return;
124
  }
125
 
126
- // If we're still here, we can't be sure if what we find was really intended as ASP open tags.
127
  if ($openTag['code'] === \T_INLINE_HTML && $this->aspTags === false) {
128
  if (strpos($content, '<%') !== false) {
129
  $error = 'Possible use of ASP style opening tags detected. ASP style opening tags have been removed in PHP 7.0. Found: %s';
@@ -139,6 +143,8 @@ class RemovedAlternativePHPTagsSniff extends Sniff
139
  /**
140
  * Get a snippet from a HTML token.
141
  *
 
 
142
  * @param string $content The content of the HTML token.
143
  * @param string $startAt Partial string to use as a starting point for the snippet.
144
  * @param int $length The target length of the snippet to get. Defaults to 25.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Miscellaneous;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Check for use of alternative PHP tags, support for which was removed in PHP 7.0.
18
  *
19
+ * {@internal Based on `Generic.PHP.DisallowAlternativePHPTags` by Juliette Reinders Folmer
20
+ * (with permission) which was merged into PHPCS 2.7.0.}
21
  *
22
  * PHP version 7.0
23
  *
24
+ * @link https://wiki.php.net/rfc/remove_alternative_php_tags
25
+ * @link https://www.php.net/manual/en/language.basic-syntax.phptags.php
 
26
  *
27
+ * @since 7.0.4
 
28
  */
29
  class RemovedAlternativePHPTagsSniff extends Sniff
30
  {
32
  /**
33
  * Whether ASP tags are enabled or not.
34
  *
35
+ * @since 7.0.4
36
+ *
37
  * @var bool
38
  */
39
  private $aspTags = false;
41
  /**
42
  * Returns an array of tokens this test wants to listen for.
43
  *
44
+ * @since 7.0.4
45
+ *
46
  * @return array
47
  */
48
  public function register()
63
  /**
64
  * Processes this test, when one of its tokens is encountered.
65
  *
66
+ * @since 7.0.4
67
+ *
68
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
69
  * @param int $stackPtr The position of the current token
70
  * in the stack passed in $tokens.
127
  return;
128
  }
129
 
130
+ // If we're still here, we can't be sure if what we found was really intended as ASP open tags.
131
  if ($openTag['code'] === \T_INLINE_HTML && $this->aspTags === false) {
132
  if (strpos($content, '<%') !== false) {
133
  $error = 'Possible use of ASP style opening tags detected. ASP style opening tags have been removed in PHP 7.0. Found: %s';
143
  /**
144
  * Get a snippet from a HTML token.
145
  *
146
+ * @since 7.0.4
147
+ *
148
  * @param string $content The content of the HTML token.
149
  * @param string $startAt Partial string to use as a starting point for the snippet.
150
  * @param int $length The target length of the snippet to get. Defaults to 25.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Miscellaneous/ValidIntegersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Miscellaneous\ValidIntegersSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Miscellaneous;
@@ -13,11 +14,24 @@ use PHPCompatibility\Sniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\Miscellaneous\ValidIntegersSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  */
22
  class ValidIntegersSniff extends Sniff
23
  {
@@ -25,6 +39,8 @@ class ValidIntegersSniff extends Sniff
25
  /**
26
  * Whether PHPCS is run on a PHP < 5.4.
27
  *
 
 
28
  * @var bool
29
  */
30
  protected $isLowPHPVersion = false;
@@ -32,6 +48,8 @@ class ValidIntegersSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -48,6 +66,8 @@ class ValidIntegersSniff extends Sniff
48
  /**
49
  * Processes this test, when one of its tokens is encountered.
50
  *
 
 
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token in
53
  * the stack.
@@ -108,7 +128,9 @@ class ValidIntegersSniff extends Sniff
108
 
109
 
110
  /**
111
- * Could the current token an potentially be a binary integer ?
 
 
112
  *
113
  * @param array $tokens Token stack.
114
  * @param int $stackPtr The current position in the token stack.
@@ -124,18 +146,20 @@ class ValidIntegersSniff extends Sniff
124
  }
125
 
126
  if ($this->isLowPHPVersion === false) {
127
- return (preg_match('`^0b[0-1]+$`D', $token['content']) === 1);
128
  }
129
  // Pre-5.4, binary strings are tokenized as T_LNUMBER (0) + T_STRING ("b01010101").
130
  // At this point, we don't yet care whether it's a valid binary int, that's a separate check.
131
  else {
132
- return($token['content'] === '0' && $tokens[$stackPtr + 1]['code'] === \T_STRING && preg_match('`^b[0-9]+$`D', $tokens[$stackPtr + 1]['content']) === 1);
133
  }
134
  }
135
 
136
  /**
137
  * Is the current token an invalid binary integer ?
138
  *
 
 
139
  * @param array $tokens Token stack.
140
  * @param int $stackPtr The current position in the token stack.
141
  *
@@ -151,13 +175,15 @@ class ValidIntegersSniff extends Sniff
151
  // If it's an invalid binary int, the token will be split into two T_LNUMBER tokens.
152
  return ($tokens[$stackPtr + 1]['code'] === \T_LNUMBER);
153
  } else {
154
- return (preg_match('`^b[0-1]+$`D', $tokens[$stackPtr + 1]['content']) === 0);
155
  }
156
  }
157
 
158
  /**
159
  * Retrieve the content of the tokens which together look like a binary integer.
160
  *
 
 
161
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
162
  * @param array $tokens Token stack.
163
  * @param int $stackPtr The position of the current token in
@@ -183,6 +209,8 @@ class ValidIntegersSniff extends Sniff
183
  /**
184
  * Is the current token an invalid octal integer ?
185
  *
 
 
186
  * @param array $tokens Token stack.
187
  * @param int $stackPtr The current position in the token stack.
188
  *
@@ -202,6 +230,8 @@ class ValidIntegersSniff extends Sniff
202
  /**
203
  * Is the current token a hexidecimal numeric string ?
204
  *
 
 
205
  * @param array $tokens Token stack.
206
  * @param int $stackPtr The current position in the token stack.
207
  *
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Miscellaneous;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Check for valid integer types and values.
18
  *
19
+ * Checks:
20
+ * - PHP 5.4 introduced binary integers.
21
+ * - PHP 7.0 removed tolerance for invalid octals. These were truncated prior to PHP 7
22
+ * and give a parse error since PHP 7.
23
+ * - PHP 7.0 removed support for recognizing hexadecimal numeric strings as numeric.
24
+ * Type juggling and recognition was inconsistent prior to PHP 7. As of PHP 7, they
25
+ * are no longer treated as numeric.
26
+ *
27
+ * PHP version 5.4+
28
+ *
29
+ * @link https://wiki.php.net/rfc/binnotation4ints
30
+ * @link https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
31
+ * @link https://www.php.net/manual/en/language.types.integer.php
32
+ *
33
+ * @since 7.0.3
34
+ * @since 7.0.8 This sniff now throws a warning instead of an error for invalid binary integers.
35
  */
36
  class ValidIntegersSniff extends Sniff
37
  {
39
  /**
40
  * Whether PHPCS is run on a PHP < 5.4.
41
  *
42
+ * @since 7.0.3
43
+ *
44
  * @var bool
45
  */
46
  protected $isLowPHPVersion = false;
48
  /**
49
  * Returns an array of tokens this test wants to listen for.
50
  *
51
+ * @since 7.0.3
52
+ *
53
  * @return array
54
  */
55
  public function register()
66
  /**
67
  * Processes this test, when one of its tokens is encountered.
68
  *
69
+ * @since 7.0.3
70
+ *
71
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
72
  * @param int $stackPtr The position of the current token in
73
  * the stack.
128
 
129
 
130
  /**
131
+ * Could the current token potentially be a binary integer ?
132
+ *
133
+ * @since 7.0.3
134
  *
135
  * @param array $tokens Token stack.
136
  * @param int $stackPtr The current position in the token stack.
146
  }
147
 
148
  if ($this->isLowPHPVersion === false) {
149
+ return (preg_match('`^0b[0-1]+$`iD', $token['content']) === 1);
150
  }
151
  // Pre-5.4, binary strings are tokenized as T_LNUMBER (0) + T_STRING ("b01010101").
152
  // At this point, we don't yet care whether it's a valid binary int, that's a separate check.
153
  else {
154
+ return($token['content'] === '0' && $tokens[$stackPtr + 1]['code'] === \T_STRING && preg_match('`^b[0-9]+$`iD', $tokens[$stackPtr + 1]['content']) === 1);
155
  }
156
  }
157
 
158
  /**
159
  * Is the current token an invalid binary integer ?
160
  *
161
+ * @since 7.0.3
162
+ *
163
  * @param array $tokens Token stack.
164
  * @param int $stackPtr The current position in the token stack.
165
  *
175
  // If it's an invalid binary int, the token will be split into two T_LNUMBER tokens.
176
  return ($tokens[$stackPtr + 1]['code'] === \T_LNUMBER);
177
  } else {
178
+ return (preg_match('`^b[0-1]+$`iD', $tokens[$stackPtr + 1]['content']) === 0);
179
  }
180
  }
181
 
182
  /**
183
  * Retrieve the content of the tokens which together look like a binary integer.
184
  *
185
+ * @since 7.0.3
186
+ *
187
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
188
  * @param array $tokens Token stack.
189
  * @param int $stackPtr The position of the current token in
209
  /**
210
  * Is the current token an invalid octal integer ?
211
  *
212
+ * @since 7.0.3
213
+ *
214
  * @param array $tokens Token stack.
215
  * @param int $stackPtr The current position in the token stack.
216
  *
230
  /**
231
  * Is the current token a hexidecimal numeric string ?
232
  *
233
+ * @since 7.0.3
234
+ *
235
  * @param array $tokens Token stack.
236
  * @param int $stackPtr The current position in the token stack.
237
  *
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ChangedConcatOperatorPrecedenceSniff.php CHANGED
@@ -15,14 +15,14 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * The operator precedence of concatenation will be lowered in PHP 8.0.
19
  *
20
  * In PHP < 8.0 the operator precedence of `.`, `+` and `-` are the same.
21
  * As of PHP 8.0, the operator precedence of the concatenation operator will be
22
- * lowered to be right below the '«' and '»' operators.
23
  *
24
  * As of PHP 7.4, a deprecation warning will be thrown upon encountering an
25
- * unparenthesized expression containing an '.' before a '+' or '-'.
26
  *
27
  * PHP version 7.4
28
  * PHP version 8.0
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect code affected by the change in operator precedence of concatenation in PHP 8.0.
19
  *
20
  * In PHP < 8.0 the operator precedence of `.`, `+` and `-` are the same.
21
  * As of PHP 8.0, the operator precedence of the concatenation operator will be
22
+ * lowered to be right below the `<<` and `>>` operators.
23
  *
24
  * As of PHP 7.4, a deprecation warning will be thrown upon encountering an
25
+ * unparenthesized expression containing an `.` before a `+` or `-`.
26
  *
27
  * PHP version 7.4
28
  * PHP version 8.0
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Operators\ForbiddenNegativeBitshift.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Operators;
@@ -17,15 +16,14 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\Operators\ForbiddenNegativeBitshift.
21
- *
22
- * Bitwise shifts by negative number will throw an ArithmeticError in PHP 7.0.
23
  *
24
  * PHP version 7.0
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Wim Godden <wim@cu.be>
 
29
  */
30
  class ForbiddenNegativeBitshiftSniff extends Sniff
31
  {
@@ -34,7 +32,9 @@ class ForbiddenNegativeBitshiftSniff extends Sniff
34
  *
35
  * {@internal The PHPCS `findEndOfStatement()` method is not completely consistent
36
  * in how it returns the statement end. This is just a simple way to bypass
37
- * the inconsistency for our purposes.}}
 
 
38
  *
39
  * @var array
40
  */
@@ -48,6 +48,9 @@ class ForbiddenNegativeBitshiftSniff extends Sniff
48
  /**
49
  * Returns an array of tokens this test wants to listen for.
50
  *
 
 
 
51
  * @return array
52
  */
53
  public function register()
@@ -63,6 +66,8 @@ class ForbiddenNegativeBitshiftSniff extends Sniff
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
68
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Operators;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Bitwise shifts by negative number will throw an ArithmeticError since PHP 7.0.
 
 
20
  *
21
  * PHP version 7.0
22
  *
23
+ * @link https://wiki.php.net/rfc/integer_semantics
24
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.integers.negative-bitshift
25
+ *
26
+ * @since 7.0.0
27
  */
28
  class ForbiddenNegativeBitshiftSniff extends Sniff
29
  {
32
  *
33
  * {@internal The PHPCS `findEndOfStatement()` method is not completely consistent
34
  * in how it returns the statement end. This is just a simple way to bypass
35
+ * the inconsistency for our purposes.}
36
+ *
37
+ * @since 8.2.0
38
  *
39
  * @var array
40
  */
48
  /**
49
  * Returns an array of tokens this test wants to listen for.
50
  *
51
+ * @since 7.0.0
52
+ * @since 8.2.0 Now registers all bitshift tokens, not just bitshift right (`T_SR`).
53
+ *
54
  * @return array
55
  */
56
  public function register()
66
  /**
67
  * Processes this test, when one of its tokens is encountered.
68
  *
69
+ * @since 7.0.0
70
+ *
71
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
72
  * @param int $stackPtr The position of the current token
73
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Operators\NewOperatorsSniff.
4
  *
5
- * @category PHP
6
  * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
8
- * @copyright 2013 Cu.be Solutions bvba
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Operators;
@@ -14,12 +14,17 @@ use PHPCompatibility\AbstractNewFeatureSniff;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\Operators\NewOperatorsSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Wim Godden <wim.godden@cu.be>
22
- * @copyright 2013 Cu.be Solutions bvba
 
 
 
 
 
23
  */
24
  class NewOperatorsSniff extends AbstractNewFeatureSniff
25
  {
@@ -28,9 +33,11 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
28
  * A list of new operators, not present in older versions.
29
  *
30
  * The array lists : version number with false (not present) or true (present).
31
- * If's sufficient to list the first version where the keyword appears.
 
 
32
  *
33
- * @var array(string => array(string => int|string|null))
34
  */
35
  protected $newOperators = array(
36
  'T_POW' => array(
@@ -53,10 +60,6 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
53
  '7.0' => true,
54
  'description' => 'null coalescing operator (??)',
55
  ), // Identified in PHP < 7.0 icw PHPCS < 2.6.2 as T_INLINE_THEN + T_INLINE_THEN.
56
- /*
57
- * Was slated for 7.2, but still not implemented. PHPCS however does already tokenize it.
58
- * @link https://wiki.php.net/rfc/null_coalesce_equal_operator
59
- */
60
  'T_COALESCE_EQUAL' => array(
61
  '7.3' => false,
62
  '7.4' => true,
@@ -70,6 +73,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
70
  *
71
  * The array lists an alternative token to listen for.
72
  *
 
 
73
  * @var array(string => int)
74
  */
75
  protected $newOperatorsPHPCSCompat = array(
@@ -93,7 +98,9 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
93
  * PHP and PHPCS versions.
94
  *
95
  * {@internal 'before' was chosen rather than 'after' as that allowed for a 1-on-1
96
- * translation list with the current tokens.}}
 
 
97
  *
98
  * @var array(string => array(string => string))
99
  */
@@ -123,6 +130,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
123
  /**
124
  * Returns an array of tokens this test wants to listen for.
125
  *
 
 
126
  * @return array
127
  */
128
  public function register()
@@ -142,6 +151,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
142
  /**
143
  * Processes this test, when one of its tokens is encountered.
144
  *
 
 
145
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
146
  * @param int $stackPtr The position of the current token in
147
  * the stack passed in $tokens.
@@ -186,6 +197,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
186
  /**
187
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
188
  *
 
 
189
  * @param array $itemInfo Base information about the item.
190
  *
191
  * @return array Version and other information about the item.
@@ -199,6 +212,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
199
  /**
200
  * Get an array of the non-PHP-version array keys used in a sub-array.
201
  *
 
 
202
  * @return array
203
  */
204
  protected function getNonVersionArrayKeys()
@@ -210,6 +225,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
210
  /**
211
  * Retrieve the relevant detail (version) information for use in an error message.
212
  *
 
 
213
  * @param array $itemArray Version and other information about the item.
214
  * @param array $itemInfo Base information about the item.
215
  *
@@ -225,7 +242,9 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
225
 
226
 
227
  /**
228
- * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
 
 
229
  *
230
  * @param array $data The error data array which was created.
231
  * @param array $itemInfo Base information about the item this error message applies to.
@@ -243,6 +262,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
243
  /**
244
  * Callback function to determine whether a T_EQUAL token is really a T_COALESCE_EQUAL token.
245
  *
 
 
246
  * @param array $tokens The token stack.
247
  * @param int $stackPtr The current position in the token stack.
248
  *
@@ -251,7 +272,7 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
251
  private function isTCoalesceEqual($tokens, $stackPtr)
252
  {
253
  if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) {
254
- // Function called for wrong token or token has no predecesor.
255
  return false;
256
  }
257
 
@@ -270,6 +291,8 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
270
  /**
271
  * Callback function to determine whether a T_INLINE_THEN token is really a T_COALESCE token.
272
  *
 
 
273
  * @param array $tokens The token stack.
274
  * @param int $stackPtr The current position in the token stack.
275
  *
@@ -278,7 +301,7 @@ class NewOperatorsSniff extends AbstractNewFeatureSniff
278
  private function isTCoalesce($tokens, $stackPtr)
279
  {
280
  if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) {
281
- // Function called for wrong token or token has no predecesor.
282
  return false;
283
  }
284
 
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Operators;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of new PHP operators.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @link https://wiki.php.net/rfc/pow-operator
22
+ * @link https://wiki.php.net/rfc/combined-comparison-operator
23
+ * @link https://wiki.php.net/rfc/isset_ternary
24
+ * @link https://wiki.php.net/rfc/null_coalesce_equal_operator
25
+ *
26
+ * @since 9.0.0 Detection of new operators was originally included in the
27
+ * `NewLanguageConstruct` sniff (since 5.6).
28
  */
29
  class NewOperatorsSniff extends AbstractNewFeatureSniff
30
  {
33
  * A list of new operators, not present in older versions.
34
  *
35
  * The array lists : version number with false (not present) or true (present).
36
+ * If's sufficient to list the first version where the operator appears.
37
+ *
38
+ * @since 5.6
39
  *
40
+ * @var array(string => array(string => bool|string))
41
  */
42
  protected $newOperators = array(
43
  'T_POW' => array(
60
  '7.0' => true,
61
  'description' => 'null coalescing operator (??)',
62
  ), // Identified in PHP < 7.0 icw PHPCS < 2.6.2 as T_INLINE_THEN + T_INLINE_THEN.
 
 
 
 
63
  'T_COALESCE_EQUAL' => array(
64
  '7.3' => false,
65
  '7.4' => true,
73
  *
74
  * The array lists an alternative token to listen for.
75
  *
76
+ * @since 7.0.3
77
+ *
78
  * @var array(string => int)
79
  */
80
  protected $newOperatorsPHPCSCompat = array(
98
  * PHP and PHPCS versions.
99
  *
100
  * {@internal 'before' was chosen rather than 'after' as that allowed for a 1-on-1
101
+ * translation list with the current tokens.}
102
+ *
103
+ * @since 7.0.3
104
  *
105
  * @var array(string => array(string => string))
106
  */
130
  /**
131
  * Returns an array of tokens this test wants to listen for.
132
  *
133
+ * @since 5.6
134
+ *
135
  * @return array
136
  */
137
  public function register()
151
  /**
152
  * Processes this test, when one of its tokens is encountered.
153
  *
154
+ * @since 5.6
155
+ *
156
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
157
  * @param int $stackPtr The position of the current token in
158
  * the stack passed in $tokens.
197
  /**
198
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
199
  *
200
+ * @since 7.1.0
201
+ *
202
  * @param array $itemInfo Base information about the item.
203
  *
204
  * @return array Version and other information about the item.
212
  /**
213
  * Get an array of the non-PHP-version array keys used in a sub-array.
214
  *
215
+ * @since 7.1.0
216
+ *
217
  * @return array
218
  */
219
  protected function getNonVersionArrayKeys()
225
  /**
226
  * Retrieve the relevant detail (version) information for use in an error message.
227
  *
228
+ * @since 7.1.0
229
+ *
230
  * @param array $itemArray Version and other information about the item.
231
  * @param array $itemInfo Base information about the item.
232
  *
242
 
243
 
244
  /**
245
+ * Filter the error data before it's passed to PHPCS.
246
+ *
247
+ * @since 7.1.0
248
  *
249
  * @param array $data The error data array which was created.
250
  * @param array $itemInfo Base information about the item this error message applies to.
262
  /**
263
  * Callback function to determine whether a T_EQUAL token is really a T_COALESCE_EQUAL token.
264
  *
265
+ * @since 7.1.2
266
+ *
267
  * @param array $tokens The token stack.
268
  * @param int $stackPtr The current position in the token stack.
269
  *
272
  private function isTCoalesceEqual($tokens, $stackPtr)
273
  {
274
  if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) {
275
+ // Function called for wrong token or token has no predecessor.
276
  return false;
277
  }
278
 
291
  /**
292
  * Callback function to determine whether a T_INLINE_THEN token is really a T_COALESCE token.
293
  *
294
+ * @since 7.1.2
295
+ *
296
  * @param array $tokens The token stack.
297
  * @param int $stackPtr The current position in the token stack.
298
  *
301
  private function isTCoalesce($tokens, $stackPtr)
302
  {
303
  if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) {
304
+ // Function called for wrong token or token has no predecessor.
305
  return false;
306
  }
307
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/NewShortTernarySniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Operators\NewShortTernarySniff.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Ben Selby <bselby@plus.net>
10
- * @copyright 2012 Ben Selby
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\Operators;
@@ -16,17 +14,19 @@ use PHPCompatibility\Sniff;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Operators\NewShortTernarySniff.
20
  *
21
  * Performs checks on ternary operators, specifically that the middle expression
22
  * is not omitted for versions that don't support this.
23
  *
24
  * PHP version 5.3
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Ben Selby <bselby@plus.net>
29
- * @copyright 2012 Ben Selby
 
 
30
  */
31
  class NewShortTernarySniff extends Sniff
32
  {
@@ -34,6 +34,8 @@ class NewShortTernarySniff extends Sniff
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
 
 
37
  * @return array
38
  */
39
  public function register()
@@ -44,6 +46,8 @@ class NewShortTernarySniff extends Sniff
44
  /**
45
  * Processes this test, when one of its tokens is encountered.
46
  *
 
 
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token in the
49
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Operators;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect usage of the short ternary (elvis) operator as introduced in PHP 5.3.
18
  *
19
  * Performs checks on ternary operators, specifically that the middle expression
20
  * is not omitted for versions that don't support this.
21
  *
22
  * PHP version 5.3
23
  *
24
+ * @link https://www.php.net/manual/en/migration53.new-features.php
25
+ * @link https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
26
+ *
27
+ * @since 7.0.0
28
+ * @since 7.0.8 This sniff now throws an error instead of a warning.
29
+ * @since 9.0.0 Renamed from `TernaryOperatorsSniff` to `NewShortTernarySniff`.
30
  */
31
  class NewShortTernarySniff extends Sniff
32
  {
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
37
+ * @since 7.0.0
38
+ *
39
  * @return array
40
  */
41
  public function register()
46
  /**
47
  * Processes this test, when one of its tokens is encountered.
48
  *
49
+ * @since 7.0.0
50
+ *
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token in the
53
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Operators/RemovedTernaryAssociativitySniff.php CHANGED
@@ -19,12 +19,13 @@ use PHP_CodeSniffer_Tokens as Tokens;
19
  * The left-associativity of the ternary operator is deprecated in PHP 7.4 and
20
  * removed in PHP 8.0.
21
  *
22
- * @link https://wiki.php.net/rfc/ternary_associativity
23
- * @link https://github.com/php/php-src/pull/4017
24
- *
25
  * PHP version 7.4
26
  * PHP version 8.0
27
  *
 
 
 
 
28
  * @since 9.2.0
29
  */
30
  class RemovedTernaryAssociativitySniff extends Sniff
19
  * The left-associativity of the ternary operator is deprecated in PHP 7.4 and
20
  * removed in PHP 8.0.
21
  *
 
 
 
22
  * PHP version 7.4
23
  * PHP version 8.0
24
  *
25
+ * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.nested-ternary
26
+ * @link https://wiki.php.net/rfc/ternary_associativity
27
+ * @link https://github.com/php/php-src/pull/4017
28
+ *
29
  * @since 9.2.0
30
  */
31
  class RemovedTernaryAssociativitySniff extends Sniff
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\ForbiddenGetClassNullSniff.
4
  *
5
- * PHP version 7.2
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -15,16 +14,15 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ParameterValues\ForbiddenGetClassNullSniff.
19
- *
20
- * Detect: Passing `null` to get_class() is no longer allowed as of PHP 7.2.
21
- * This will now result in an E_WARNING being thrown.
22
  *
23
  * PHP version 7.2
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
28
  */
29
  class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff
30
  {
@@ -32,6 +30,8 @@ class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff
32
  /**
33
  * Functions to check for.
34
  *
 
 
35
  * @var array
36
  */
37
  protected $targetFunctions = array(
@@ -42,6 +42,8 @@ class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff
42
  /**
43
  * Do a version check to determine if this sniff needs to run at all.
44
  *
 
 
45
  * @return bool
46
  */
47
  protected function bowOutEarly()
@@ -53,6 +55,8 @@ class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff
53
  /**
54
  * Process the parameters of a matched function.
55
  *
 
 
56
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
57
  * @param int $stackPtr The position of the current token in the stack.
58
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect: Passing `null` to `get_class()` is no longer allowed as of PHP 7.2.
18
+ * This will now result in an `E_WARNING` being thrown.
 
 
19
  *
20
  * PHP version 7.2
21
  *
22
+ * @link https://wiki.php.net/rfc/get_class_disallow_null_parameter
23
+ * @link https://www.php.net/manual/en/function.get-class.php#refsect1-function.get-class-changelog
24
+ *
25
+ * @since 9.0.0
26
  */
27
  class ForbiddenGetClassNullSniff extends AbstractFunctionCallParameterSniff
28
  {
30
  /**
31
  * Functions to check for.
32
  *
33
+ * @since 9.0.0
34
+ *
35
  * @var array
36
  */
37
  protected $targetFunctions = array(
42
  /**
43
  * Do a version check to determine if this sniff needs to run at all.
44
  *
45
+ * @since 9.0.0
46
+ *
47
  * @return bool
48
  */
49
  protected function bowOutEarly()
55
  /**
56
  * Process the parameters of a matched function.
57
  *
58
+ * @since 9.0.0
59
+ *
60
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
61
  * @param int $stackPtr The position of the current token in the stack.
62
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/ForbiddenStripTagsSelfClosingXHTMLSniff.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+
16
+ /**
17
+ * Since PHP 5.3.4, `strip_tags()` ignores self-closing XHTML tags in allowable_tags
18
+ *
19
+ * PHP version 5.3.4
20
+ *
21
+ * @link https://www.php.net/manual/en/function.strip-tags.php#refsect1-function.strip-tags-changelog
22
+ *
23
+ * @since 9.3.0
24
+ */
25
+ class ForbiddenStripTagsSelfClosingXHTMLSniff extends AbstractFunctionCallParameterSniff
26
+ {
27
+
28
+ /**
29
+ * Functions to check for.
30
+ *
31
+ * @since 9.3.0
32
+ *
33
+ * @var array
34
+ */
35
+ protected $targetFunctions = array(
36
+ 'strip_tags' => true,
37
+ );
38
+
39
+ /**
40
+ * Text string tokens to examine.
41
+ *
42
+ * @since 9.3.0
43
+ *
44
+ * @var array
45
+ */
46
+ private $textStringTokens = array(
47
+ \T_CONSTANT_ENCAPSED_STRING => true,
48
+ \T_DOUBLE_QUOTED_STRING => true,
49
+ \T_INLINE_HTML => true,
50
+ \T_HEREDOC => true,
51
+ \T_NOWDOC => true,
52
+ );
53
+
54
+
55
+ /**
56
+ * Do a version check to determine if this sniff needs to run at all.
57
+ *
58
+ * @since 9.3.0
59
+ *
60
+ * @return bool
61
+ */
62
+ protected function bowOutEarly()
63
+ {
64
+ return ($this->supportsAbove('5.4') === false);
65
+ }
66
+
67
+
68
+ /**
69
+ * Process the parameters of a matched function.
70
+ *
71
+ * @since 9.3.0
72
+ *
73
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
74
+ * @param int $stackPtr The position of the current token in the stack.
75
+ * @param string $functionName The token content (function name) which was matched.
76
+ * @param array $parameters Array with information about the parameters.
77
+ *
78
+ * @return int|void Integer stack pointer to skip forward or void to continue
79
+ * normal file processing.
80
+ */
81
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
82
+ {
83
+ if (isset($parameters[2]) === false) {
84
+ return;
85
+ }
86
+
87
+ $tokens = $phpcsFile->getTokens();
88
+ $targetParam = $parameters[2];
89
+ for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) {
90
+ if ($tokens[$i]['code'] === \T_STRING
91
+ || $tokens[$i]['code'] === \T_VARIABLE
92
+ ) {
93
+ // Variable, constant, function call. Ignore as undetermined.
94
+ return;
95
+ }
96
+
97
+ if (isset($this->textStringTokens[$tokens[$i]['code']]) === true
98
+ && strpos($tokens[$i]['content'], '/>') !== false
99
+ ) {
100
+
101
+ $phpcsFile->addError(
102
+ 'Self-closing XHTML tags are ignored. Only non-self-closing tags should be used in the strip_tags() $allowable_tags parameter since PHP 5.3.4. Found: %s',
103
+ $i,
104
+ 'Found',
105
+ array($targetParam['raw'])
106
+ );
107
+
108
+ // Only throw one error per function call.
109
+ return;
110
+ }
111
+ }
112
+ }
113
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewArrayReduceInitialTypeSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewArrayReduceInitialTypeSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -13,13 +14,14 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\ParameterValues\NewArrayReduceInitialTypeSniff.
17
  *
18
- * Detect: In PHP 5.2 and lower, the $initial parameter had to be an integer.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
23
  */
24
  class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
25
  {
@@ -27,6 +29,8 @@ class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
27
  /**
28
  * Functions to check for.
29
  *
 
 
30
  * @var array
31
  */
32
  protected $targetFunctions = array(
@@ -37,6 +41,8 @@ class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
37
  * Tokens which, for the purposes of this sniff, indicate that there is
38
  * a variable element to the value passed.
39
  *
 
 
40
  * @var array
41
  */
42
  private $variableValueTokens = array(
@@ -52,6 +58,8 @@ class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
52
  /**
53
  * Do a version check to determine if this sniff needs to run at all.
54
  *
 
 
55
  * @return bool
56
  */
57
  protected function bowOutEarly()
@@ -63,6 +71,8 @@ class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
63
  /**
64
  * Process the parameters of a matched function.
65
  *
 
 
66
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
67
  * @param int $stackPtr The position of the current token in the stack.
68
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * In PHP 5.2 and lower, the `$initial` parameter for `array_reduce()` had to be an integer.
18
  *
19
+ * PHP version 5.3
20
  *
21
+ * @link https://www.php.net/manual/en/migration53.other.php#migration53.other
22
+ * @link https://www.php.net/manual/en/function.array-reduce.php#refsect1-function.array-reduce-changelog
23
+ *
24
+ * @since 9.0.0
25
  */
26
  class NewArrayReduceInitialTypeSniff extends AbstractFunctionCallParameterSniff
27
  {
29
  /**
30
  * Functions to check for.
31
  *
32
+ * @since 9.0.0
33
+ *
34
  * @var array
35
  */
36
  protected $targetFunctions = array(
41
  * Tokens which, for the purposes of this sniff, indicate that there is
42
  * a variable element to the value passed.
43
  *
44
+ * @since 9.0.0
45
+ *
46
  * @var array
47
  */
48
  private $variableValueTokens = array(
58
  /**
59
  * Do a version check to determine if this sniff needs to run at all.
60
  *
61
+ * @since 9.0.0
62
+ *
63
  * @return bool
64
  */
65
  protected function bowOutEarly()
71
  /**
72
  * Process the parameters of a matched function.
73
  *
74
+ * @since 9.0.0
75
+ *
76
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
77
  * @param int $stackPtr The position of the current token in the stack.
78
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewFopenModesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -13,13 +14,13 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\ParameterValues\NewFopenModesSniff.
17
  *
18
- * Detect: Changes in allowed values for the fopen() $mode parameter.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
23
  */
24
  class NewFopenModesSniff extends AbstractFunctionCallParameterSniff
25
  {
@@ -27,6 +28,8 @@ class NewFopenModesSniff extends AbstractFunctionCallParameterSniff
27
  /**
28
  * Functions to check for.
29
  *
 
 
30
  * @var array
31
  */
32
  protected $targetFunctions = array(
@@ -37,6 +40,8 @@ class NewFopenModesSniff extends AbstractFunctionCallParameterSniff
37
  /**
38
  * Do a version check to determine if this sniff needs to run at all.
39
  *
 
 
40
  * @return bool
41
  */
42
  protected function bowOutEarly()
@@ -50,6 +55,8 @@ class NewFopenModesSniff extends AbstractFunctionCallParameterSniff
50
  /**
51
  * Process the parameters of a matched function.
52
  *
 
 
53
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
54
  * @param int $stackPtr The position of the current token in the stack.
55
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Check for valid values for the `fopen()` `$mode` parameter.
18
  *
19
+ * PHP version 5.2+
20
  *
21
+ * @link https://www.php.net/manual/en/function.fopen.php#refsect1-function.fopen-changelog
22
+ *
23
+ * @since 9.0.0
24
  */
25
  class NewFopenModesSniff extends AbstractFunctionCallParameterSniff
26
  {
28
  /**
29
  * Functions to check for.
30
  *
31
+ * @since 9.0.0
32
+ *
33
  * @var array
34
  */
35
  protected $targetFunctions = array(
40
  /**
41
  * Do a version check to determine if this sniff needs to run at all.
42
  *
43
+ * @since 9.0.0
44
+ *
45
  * @return bool
46
  */
47
  protected function bowOutEarly()
55
  /**
56
  * Process the parameters of a matched function.
57
  *
58
+ * @since 9.0.0
59
+ *
60
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
61
  * @param int $stackPtr The position of the current token in the stack.
62
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHTMLEntitiesEncodingDefaultSniff.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+
16
+ /**
17
+ * As of PHP 5.4, the default character set for `htmlspecialchars()`, `htmlentities()`
18
+ * and `html_entity_decode()` is now `UTF-8`, instead of `ISO-8859-1`.
19
+ *
20
+ * PHP version 5.4
21
+ *
22
+ * @link https://www.php.net/manual/en/migration54.other.php
23
+ * @link https://www.php.net/manual/en/function.html-entity-decode.php#refsect1-function.html-entity-decode-changelog
24
+ * @link https://www.php.net/manual/en/function.htmlentities.php#refsect1-function.htmlentities-changelog
25
+ * @link https://www.php.net/manual/en/function.htmlspecialchars.php#refsect1-function.htmlspecialchars-changelog
26
+ *
27
+ * @since 9.3.0
28
+ */
29
+ class NewHTMLEntitiesEncodingDefaultSniff extends AbstractFunctionCallParameterSniff
30
+ {
31
+
32
+ /**
33
+ * Functions to check for.
34
+ *
35
+ * Key is the function name, value the 1-based parameter position of
36
+ * the $encoding parameter.
37
+ *
38
+ * @since 9.3.0
39
+ *
40
+ * @var array
41
+ */
42
+ protected $targetFunctions = array(
43
+ 'html_entity_decode' => 3,
44
+ 'htmlentities' => 3,
45
+ 'htmlspecialchars' => 3,
46
+ );
47
+
48
+
49
+ /**
50
+ * Do a version check to determine if this sniff needs to run at all.
51
+ *
52
+ * Note: This sniff should only trigger errors when both PHP 5.3 or lower,
53
+ * as well as PHP 5.4 or higher need to be supported within the application.
54
+ *
55
+ * @since 9.3.0
56
+ *
57
+ * @return bool
58
+ */
59
+ protected function bowOutEarly()
60
+ {
61
+ return ($this->supportsBelow('5.3') === false || $this->supportsAbove('5.4') === false);
62
+ }
63
+
64
+
65
+ /**
66
+ * Process the parameters of a matched function.
67
+ *
68
+ * @since 9.3.0
69
+ *
70
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
71
+ * @param int $stackPtr The position of the current token in the stack.
72
+ * @param string $functionName The token content (function name) which was matched.
73
+ * @param array $parameters Array with information about the parameters.
74
+ *
75
+ * @return int|void Integer stack pointer to skip forward or void to continue
76
+ * normal file processing.
77
+ */
78
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
79
+ {
80
+ $functionLC = strtolower($functionName);
81
+ if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) {
82
+ return;
83
+ }
84
+
85
+ $phpcsFile->addError(
86
+ 'The default value of the $encoding parameter for %s() was changed from ISO-8859-1 to UTF-8 in PHP 5.4. For cross-version compatibility, the $encoding parameter should be explicitly set.',
87
+ $stackPtr,
88
+ 'NotSet',
89
+ array($functionName)
90
+ );
91
+ }
92
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewHashAlgorithmsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -13,11 +14,14 @@ use PHPCompatibility\AbstractNewFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\ParameterValues\NewHashAlgorithmsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
21
  */
22
  class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
23
  {
@@ -27,6 +31,8 @@ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
27
  * The array lists : version number with false (not present) or true (present).
28
  * If's sufficient to list the first version where the hash algorithm appears.
29
  *
 
 
30
  * @var array(string => array(string => bool))
31
  */
32
  protected $newAlgorithms = array(
@@ -99,12 +105,18 @@ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
99
  '7.0' => false,
100
  '7.1' => true,
101
  ),
 
 
 
 
102
  );
103
 
104
 
105
  /**
106
  * Returns an array of tokens this test wants to listen for.
107
  *
 
 
108
  * @return array
109
  */
110
  public function register()
@@ -116,6 +128,8 @@ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
116
  /**
117
  * Processes this test, when one of its tokens is encountered.
118
  *
 
 
119
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
120
  * @param int $stackPtr The position of the current token in the
121
  * stack passed in $tokens.
@@ -145,6 +159,8 @@ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
145
  /**
146
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
147
  *
 
 
148
  * @param array $itemInfo Base information about the item.
149
  *
150
  * @return array Version and other information about the item.
@@ -158,6 +174,8 @@ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
158
  /**
159
  * Get the error message template for this sniff.
160
  *
 
 
161
  * @return string
162
  */
163
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect the use of newly introduced hash algorithms.
18
  *
19
+ * PHP version 5.2+
20
+ *
21
+ * @link https://www.php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-changelog
22
+ *
23
+ * @since 7.0.7
24
+ * @since 7.1.0 Now extends the `AbstractNewFeatureSniff` instead of the base `Sniff` class..
25
  */
26
  class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
27
  {
31
  * The array lists : version number with false (not present) or true (present).
32
  * If's sufficient to list the first version where the hash algorithm appears.
33
  *
34
+ * @since 7.0.7
35
+ *
36
  * @var array(string => array(string => bool))
37
  */
38
  protected $newAlgorithms = array(
105
  '7.0' => false,
106
  '7.1' => true,
107
  ),
108
+ 'crc32c' => array(
109
+ '7.3' => false,
110
+ '7.4' => true,
111
+ ),
112
  );
113
 
114
 
115
  /**
116
  * Returns an array of tokens this test wants to listen for.
117
  *
118
+ * @since 7.0.7
119
+ *
120
  * @return array
121
  */
122
  public function register()
128
  /**
129
  * Processes this test, when one of its tokens is encountered.
130
  *
131
+ * @since 7.0.7
132
+ *
133
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
134
  * @param int $stackPtr The position of the current token in the
135
  * stack passed in $tokens.
159
  /**
160
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
161
  *
162
+ * @since 7.1.0
163
+ *
164
  * @param array $itemInfo Base information about the item.
165
  *
166
  * @return array Version and other information about the item.
174
  /**
175
  * Get the error message template for this sniff.
176
  *
177
+ * @since 7.1.0
178
+ *
179
  * @return string
180
  */
181
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIDNVariantDefaultSniff.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+
16
+ /**
17
+ * The default value for the `$variant` parameter has changed from `INTL_IDNA_VARIANT_2003`
18
+ * to `INTL_IDNA_VARIANT_UTS46` in PHP 7.4.
19
+ *
20
+ * PHP version 7.4
21
+ *
22
+ * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.intl
23
+ * @link https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003
24
+ * @link https://www.php.net/manual/en/function.idn-to-ascii.php
25
+ * @link https://www.php.net/manual/en/function.idn-to-utf8.php
26
+ *
27
+ * @since 9.3.0
28
+ */
29
+ class NewIDNVariantDefaultSniff extends AbstractFunctionCallParameterSniff
30
+ {
31
+
32
+ /**
33
+ * Functions to check for.
34
+ *
35
+ * Key is the function name, value the 1-based parameter position of
36
+ * the $variant parameter.
37
+ *
38
+ * @since 9.3.0
39
+ *
40
+ * @var array
41
+ */
42
+ protected $targetFunctions = array(
43
+ 'idn_to_ascii' => 3,
44
+ 'idn_to_utf8' => 3,
45
+ );
46
+
47
+ /**
48
+ * Do a version check to determine if this sniff needs to run at all.
49
+ *
50
+ * Note: This sniff should only trigger errors when both PHP 7.3 or lower,
51
+ * as well as PHP 7.4 or higher need to be supported within the application.
52
+ *
53
+ * @since 9.3.0
54
+ *
55
+ * @return bool
56
+ */
57
+ protected function bowOutEarly()
58
+ {
59
+ return ($this->supportsBelow('7.3') === false || $this->supportsAbove('7.4') === false);
60
+ }
61
+
62
+
63
+ /**
64
+ * Process the parameters of a matched function.
65
+ *
66
+ * @since 9.3.0
67
+ *
68
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
69
+ * @param int $stackPtr The position of the current token in the stack.
70
+ * @param string $functionName The token content (function name) which was matched.
71
+ * @param array $parameters Array with information about the parameters.
72
+ *
73
+ * @return int|void Integer stack pointer to skip forward or void to continue
74
+ * normal file processing.
75
+ */
76
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
77
+ {
78
+ $functionLC = strtolower($functionName);
79
+ if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) {
80
+ return;
81
+ }
82
+
83
+ $error = 'The default value of the %s() $variant parameter has changed from INTL_IDNA_VARIANT_2003 to INTL_IDNA_VARIANT_UTS46 in PHP 7.4. For optimal cross-version compatibility, the $variant parameter should be explicitly set.';
84
+ $phpcsFile->addError(
85
+ $error,
86
+ $stackPtr,
87
+ 'NotSet',
88
+ array($functionName)
89
+ );
90
+ }
91
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewIconvMbstringCharsetDefaultSniff.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * Detect calls to Iconv and Mbstring functions with the optional `$charset`/`$encoding` parameter not set.
19
+ *
20
+ * The default value for the iconv `$charset` and the MbString $encoding` parameters was changed
21
+ * in PHP 5.6 to the value of `default_charset`, which defaults to `UTF-8`.
22
+ *
23
+ * Previously, the iconv functions would default to the value of `iconv.internal_encoding`;
24
+ * The Mbstring functions would default to the return value of `mb_internal_encoding()`.
25
+ * In both case, this would normally come down to `ISO-8859-1`.
26
+ *
27
+ * PHP version 5.6
28
+ *
29
+ * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.default-encoding
30
+ * @link https://www.php.net/manual/en/migration56.deprecated.php#migration56.deprecated.iconv-mbstring-encoding
31
+ * @link https://wiki.php.net/rfc/default_encoding
32
+ *
33
+ * @since 9.3.0
34
+ */
35
+ class NewIconvMbstringCharsetDefaultSniff extends AbstractFunctionCallParameterSniff
36
+ {
37
+
38
+ /**
39
+ * Functions to check for.
40
+ *
41
+ * Only those functions where the charset/encoding parameter is optional need to be listed.
42
+ *
43
+ * Key is the function name, value the 1-based parameter position of
44
+ * the $charset/$encoding parameter.
45
+ *
46
+ * @since 9.3.0
47
+ *
48
+ * @var array
49
+ */
50
+ protected $targetFunctions = array(
51
+ 'iconv_mime_decode_headers' => 3,
52
+ 'iconv_mime_decode' => 3,
53
+ 'iconv_mime_encode' => 3, // Special case.
54
+ 'iconv_strlen' => 2,
55
+ 'iconv_strpos' => 4,
56
+ 'iconv_strrpos' => 3,
57
+ 'iconv_substr' => 4,
58
+
59
+ 'mb_check_encoding' => 2,
60
+ 'mb_chr' => 2,
61
+ 'mb_convert_case' => 3,
62
+ 'mb_convert_encoding' => 3,
63
+ 'mb_convert_kana' => 3,
64
+ 'mb_decode_numericentity' => 3,
65
+ 'mb_encode_numericentity' => 3,
66
+ 'mb_ord' => 2,
67
+ 'mb_scrub' => 2,
68
+ 'mb_strcut' => 4,
69
+ 'mb_stripos' => 4,
70
+ 'mb_stristr' => 4,
71
+ 'mb_strlen' => 2,
72
+ 'mb_strpos' => 4,
73
+ 'mb_strrchr' => 4,
74
+ 'mb_strrichr' => 4,
75
+ 'mb_strripos' => 4,
76
+ 'mb_strrpos' => 4,
77
+ 'mb_strstr' => 4,
78
+ 'mb_strtolower' => 2,
79
+ 'mb_strtoupper' => 2,
80
+ 'mb_strwidth' => 2,
81
+ 'mb_substr_count' => 3,
82
+ 'mb_substr' => 4,
83
+ );
84
+
85
+
86
+ /**
87
+ * Do a version check to determine if this sniff needs to run at all.
88
+ *
89
+ * Note: This sniff should only trigger errors when both PHP 5.5 or lower,
90
+ * as well as PHP 5.6 or higher need to be supported within the application.
91
+ *
92
+ * @since 9.3.0
93
+ *
94
+ * @return bool
95
+ */
96
+ protected function bowOutEarly()
97
+ {
98
+ return ($this->supportsBelow('5.5') === false || $this->supportsAbove('5.6') === false);
99
+ }
100
+
101
+
102
+ /**
103
+ * Process the parameters of a matched function.
104
+ *
105
+ * @since 9.3.0
106
+ *
107
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
108
+ * @param int $stackPtr The position of the current token in the stack.
109
+ * @param string $functionName The token content (function name) which was matched.
110
+ * @param array $parameters Array with information about the parameters.
111
+ *
112
+ * @return int|void Integer stack pointer to skip forward or void to continue
113
+ * normal file processing.
114
+ */
115
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
116
+ {
117
+ $functionLC = strtolower($functionName);
118
+ if ($functionLC === 'iconv_mime_encode') {
119
+ // Special case the iconv_mime_encode() function.
120
+ return $this->processIconvMimeEncode($phpcsFile, $stackPtr, $functionName, $parameters);
121
+ }
122
+
123
+ if (isset($parameters[$this->targetFunctions[$functionLC]]) === true) {
124
+ return;
125
+ }
126
+
127
+ $paramName = '$encoding';
128
+ if (strpos($functionLC, 'iconv_') === 0) {
129
+ $paramName = '$charset';
130
+ } elseif ($functionLC === 'mb_convert_encoding') {
131
+ $paramName = '$from_encoding';
132
+ }
133
+
134
+ $error = 'The default value of the %1$s parameter for %2$s() was changed from ISO-8859-1 to UTF-8 in PHP 5.6. For cross-version compatibility, the %1$s parameter should be explicitly set.';
135
+ $data = array(
136
+ $paramName,
137
+ $functionName,
138
+ );
139
+
140
+ $phpcsFile->addError($error, $stackPtr, 'NotSet', $data);
141
+ }
142
+
143
+ /**
144
+ * Process the parameters of a matched call to the iconv_mime_encode() function.
145
+ *
146
+ * @since 9.3.0
147
+ *
148
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
149
+ * @param int $stackPtr The position of the current token in the stack.
150
+ * @param string $functionName The token content (function name) which was matched.
151
+ * @param array $parameters Array with information about the parameters.
152
+ *
153
+ * @return int|void Integer stack pointer to skip forward or void to continue
154
+ * normal file processing.
155
+ */
156
+ public function processIconvMimeEncode(File $phpcsFile, $stackPtr, $functionName, $parameters)
157
+ {
158
+ $error = 'The default value of the %s parameter index for iconv_mime_encode() was changed from ISO-8859-1 to UTF-8 in PHP 5.6. For cross-version compatibility, the %s should be explicitly set.';
159
+
160
+ $functionLC = strtolower($functionName);
161
+ if (isset($parameters[$this->targetFunctions[$functionLC]]) === false) {
162
+ $phpcsFile->addError(
163
+ $error,
164
+ $stackPtr,
165
+ 'PreferencesNotSet',
166
+ array(
167
+ '$preferences[\'input/output-charset\']',
168
+ '$preferences[\'input-charset\'] and $preferences[\'output-charset\'] indexes',
169
+ )
170
+ );
171
+
172
+ return;
173
+ }
174
+
175
+ $tokens = $phpcsFile->getTokens();
176
+ $targetParam = $parameters[$this->targetFunctions[$functionLC]];
177
+ $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], ($targetParam['end'] + 1), true);
178
+ if ($firstNonEmpty === false) {
179
+ // Parse error or live coding.
180
+ return;
181
+ }
182
+
183
+ if ($tokens[$firstNonEmpty]['code'] === \T_ARRAY
184
+ || $tokens[$firstNonEmpty]['code'] === \T_OPEN_SHORT_ARRAY
185
+ ) {
186
+ $hasInputCharset = preg_match('`([\'"])input-charset\1\s*=>`', $targetParam['raw']);
187
+ $hasOutputCharset = preg_match('`([\'"])output-charset\1\s*=>`', $targetParam['raw']);
188
+ if ($hasInputCharset === 1 && $hasOutputCharset === 1) {
189
+ // Both input as well as output charset are set.
190
+ return;
191
+ }
192
+
193
+ if ($hasInputCharset !== 1) {
194
+ $phpcsFile->addError(
195
+ $error,
196
+ $firstNonEmpty,
197
+ 'InputPreferenceNotSet',
198
+ array(
199
+ '$preferences[\'input-charset\']',
200
+ '$preferences[\'input-charset\'] index',
201
+ )
202
+ );
203
+ }
204
+
205
+ if ($hasOutputCharset !== 1) {
206
+ $phpcsFile->addError(
207
+ $error,
208
+ $firstNonEmpty,
209
+ 'OutputPreferenceNotSet',
210
+ array(
211
+ '$preferences[\'output-charset\']',
212
+ '$preferences[\'output-charset\'] index',
213
+ )
214
+ );
215
+ }
216
+
217
+ return;
218
+ }
219
+
220
+ // The $preferences parameter was passed, but it was a variable/constant/output of a function call.
221
+ $phpcsFile->addWarning(
222
+ $error,
223
+ $firstNonEmpty,
224
+ 'Undetermined',
225
+ array(
226
+ '$preferences[\'input/output-charset\']',
227
+ '$preferences[\'input-charset\'] and $preferences[\'output-charset\'] indexes',
228
+ )
229
+ );
230
+ }
231
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewNegativeStringOffsetSniff.
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
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -15,16 +14,14 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ParameterValues\NewNegativeStringOffsetSniff.
19
- *
20
- * Detect: negative string offsets as parameters passed to functions where this
21
  * was not allowed prior to PHP 7.1.
22
  *
23
  * PHP version 7.1
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
  */
29
  class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff
30
  {
@@ -32,6 +29,8 @@ class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff
32
  /**
33
  * Functions to check for.
34
  *
 
 
35
  * @var array Function name => 1-based parameter offset of the affected parameters => parameter name.
36
  */
37
  protected $targetFunctions = array(
@@ -79,6 +78,8 @@ class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff
79
  /**
80
  * Do a version check to determine if this sniff needs to run at all.
81
  *
 
 
82
  * @return bool
83
  */
84
  protected function bowOutEarly()
@@ -89,6 +90,8 @@ class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff
89
  /**
90
  * Process the parameters of a matched function.
91
  *
 
 
92
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
93
  * @param int $stackPtr The position of the current token in the stack.
94
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect negative string offsets as parameters passed to functions where this
 
 
18
  * was not allowed prior to PHP 7.1.
19
  *
20
  * PHP version 7.1
21
  *
22
+ * @link https://wiki.php.net/rfc/negative-string-offsets
23
+ *
24
+ * @since 9.0.0
25
  */
26
  class NewNegativeStringOffsetSniff extends AbstractFunctionCallParameterSniff
27
  {
29
  /**
30
  * Functions to check for.
31
  *
32
+ * @since 9.0.0
33
+ *
34
  * @var array Function name => 1-based parameter offset of the affected parameters => parameter name.
35
  */
36
  protected $targetFunctions = array(
78
  /**
79
  * Do a version check to determine if this sniff needs to run at all.
80
  *
81
+ * @since 9.0.0
82
+ *
83
  * @return bool
84
  */
85
  protected function bowOutEarly()
90
  /**
91
  * Process the parameters of a matched function.
92
  *
93
+ * @since 9.0.0
94
+ *
95
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
96
  * @param int $stackPtr The position of the current token in the stack.
97
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewPCREModifiers.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -13,13 +14,17 @@ use PHPCompatibility\Sniffs\ParameterValues\RemovedPCREModifiersSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\ParameterValues\NewPCREModifiers.
17
  *
18
- * Check for usage of newly added regex modifiers for PCRE functions.
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
23
  */
24
  class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
25
  {
@@ -27,10 +32,11 @@ class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
27
  /**
28
  * Functions to check for.
29
  *
 
 
30
  * @var array
31
  */
32
  protected $targetFunctions = array(
33
- 'preg_replace' => true,
34
  'preg_filter' => true,
35
  'preg_grep' => true,
36
  'preg_match_all' => true,
@@ -47,6 +53,8 @@ class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
47
  * The key should be the modifier (case-sensitive!).
48
  * The value should be the PHP version in which the modifier was introduced.
49
  *
 
 
50
  * @var array
51
  */
52
  protected $newModifiers = array(
@@ -60,6 +68,8 @@ class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
60
  /**
61
  * Do a version check to determine if this sniff needs to run at all.
62
  *
 
 
63
  * @return bool
64
  */
65
  protected function bowOutEarly()
@@ -73,6 +83,8 @@ class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
73
  /**
74
  * Examine the regex modifier string.
75
  *
 
 
76
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
77
  * @param int $stackPtr The position of the current token in the
78
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Check for the use of newly added regex modifiers for PCRE functions.
18
  *
19
+ * Initially just checks for the PHP 7.2 new `J` modifier.
20
  *
21
+ * PHP version 7.2+
22
+ *
23
+ * @link https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
24
+ * @link https://www.php.net/manual/en/migration72.new-features.php#migration72.new-features.pcre
25
+ *
26
+ * @since 8.2.0
27
+ * @since 9.0.0 Renamed from `PCRENewModifiersSniff` to `NewPCREModifiersSniff`.
28
  */
29
  class NewPCREModifiersSniff extends RemovedPCREModifiersSniff
30
  {
32
  /**
33
  * Functions to check for.
34
  *
35
+ * @since 8.2.0
36
+ *
37
  * @var array
38
  */
39
  protected $targetFunctions = array(
 
40
  'preg_filter' => true,
41
  'preg_grep' => true,
42
  'preg_match_all' => true,
53
  * The key should be the modifier (case-sensitive!).
54
  * The value should be the PHP version in which the modifier was introduced.
55
  *
56
+ * @since 8.2.0
57
+ *
58
  * @var array
59
  */
60
  protected $newModifiers = array(
68
  /**
69
  * Do a version check to determine if this sniff needs to run at all.
70
  *
71
+ * @since 8.2.0
72
+ *
73
  * @return bool
74
  */
75
  protected function bowOutEarly()
83
  /**
84
  * Examine the regex modifier string.
85
  *
86
+ * @since 8.2.0
87
+ *
88
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
89
  * @param int $stackPtr The position of the current token in the
90
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPackFormatSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\NewPackFormatSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -13,13 +14,13 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\ParameterValues\NewPackFormatSniff.
17
  *
18
- * Detect: Changes in the allowed values for $format passed to pack().
19
  *
20
- * @category PHP
21
- * @package PHPCompatibility
22
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
23
  */
24
  class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
25
  {
@@ -27,6 +28,8 @@ class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
27
  /**
28
  * Functions to check for.
29
  *
 
 
30
  * @var array
31
  */
32
  protected $targetFunctions = array(
@@ -36,6 +39,8 @@ class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
36
  /**
37
  * List of new format character codes added to pack().
38
  *
 
 
39
  * @var array Regex pattern => Version array.
40
  */
41
  protected $newFormats = array(
@@ -57,6 +62,8 @@ class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
57
  /**
58
  * Do a version check to determine if this sniff needs to run at all.
59
  *
 
 
60
  * @return bool
61
  */
62
  protected function bowOutEarly()
@@ -68,6 +75,8 @@ class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
68
  /**
69
  * Process the parameters of a matched function.
70
  *
 
 
71
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
72
  * @param int $stackPtr The position of the current token in the stack.
73
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Check for valid values for the `$format` passed to `pack()`.
18
  *
19
+ * PHP version 5.4+
20
  *
21
+ * @link https://www.php.net/manual/en/function.pack.php#refsect1-function.pack-changelog
22
+ *
23
+ * @since 9.0.0
24
  */
25
  class NewPackFormatSniff extends AbstractFunctionCallParameterSniff
26
  {
28
  /**
29
  * Functions to check for.
30
  *
31
+ * @since 9.0.0
32
+ *
33
  * @var array
34
  */
35
  protected $targetFunctions = array(
39
  /**
40
  * List of new format character codes added to pack().
41
  *
42
+ * @since 9.0.0
43
+ *
44
  * @var array Regex pattern => Version array.
45
  */
46
  protected $newFormats = array(
62
  /**
63
  * Do a version check to determine if this sniff needs to run at all.
64
  *
65
+ * @since 9.0.0
66
+ *
67
  * @return bool
68
  */
69
  protected function bowOutEarly()
75
  /**
76
  * Process the parameters of a matched function.
77
  *
78
+ * @since 9.0.0
79
+ *
80
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
81
  * @param int $stackPtr The position of the current token in the stack.
82
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewPasswordAlgoConstantValuesSniff.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * The constant value of the password hash algorithm constants has changed in PHP 7.4.
19
+ *
20
+ * Applications using the constants `PASSWORD_DEFAULT`, `PASSWORD_BCRYPT`,
21
+ * `PASSWORD_ARGON2I`, and `PASSWORD_ARGON2ID` will continue to function correctly.
22
+ * Using an integer will still work, but will produce a deprecation warning.
23
+ *
24
+ * PHP version 7.4
25
+ *
26
+ * @link https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.password-algorithm-constants
27
+ * @link https://wiki.php.net/rfc/password_registry
28
+ *
29
+ * @since 9.3.0
30
+ */
31
+ class NewPasswordAlgoConstantValuesSniff extends AbstractFunctionCallParameterSniff
32
+ {
33
+
34
+ /**
35
+ * Functions to check for.
36
+ *
37
+ * Key is the function name, value the 1-based parameter position of
38
+ * the $algo parameter.
39
+ *
40
+ * @since 9.3.0
41
+ *
42
+ * @var array
43
+ */
44
+ protected $targetFunctions = array(
45
+ 'password_hash' => 2,
46
+ 'password_needs_rehash' => 2,
47
+ );
48
+
49
+ /**
50
+ * Tokens types which indicate that the parameter passed is not the PHP native constant.
51
+ *
52
+ * @since 9.3.0
53
+ *
54
+ * @var array
55
+ */
56
+ private $invalidTokenTypes = array(
57
+ \T_NULL => true,
58
+ \T_TRUE => true,
59
+ \T_FALSE => true,
60
+ \T_LNUMBER => true,
61
+ \T_DNUMBER => true,
62
+ \T_CONSTANT_ENCAPSED_STRING => true,
63
+ \T_DOUBLE_QUOTED_STRING => true,
64
+ \T_HEREDOC => true,
65
+ \T_NOWDOC => true,
66
+ );
67
+
68
+
69
+ /**
70
+ * Do a version check to determine if this sniff needs to run at all.
71
+ *
72
+ * @since 9.3.0
73
+ *
74
+ * @return bool
75
+ */
76
+ protected function bowOutEarly()
77
+ {
78
+ return ($this->supportsAbove('7.4') === false);
79
+ }
80
+
81
+
82
+ /**
83
+ * Process the parameters of a matched function.
84
+ *
85
+ * @since 9.3.0
86
+ *
87
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
88
+ * @param int $stackPtr The position of the current token in the stack.
89
+ * @param string $functionName The token content (function name) which was matched.
90
+ * @param array $parameters Array with information about the parameters.
91
+ *
92
+ * @return int|void Integer stack pointer to skip forward or void to continue
93
+ * normal file processing.
94
+ */
95
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
96
+ {
97
+ $functionLC = strtolower($functionName);
98
+ if (isset($parameters[$this->targetFunctions[$functionLC]]) === false) {
99
+ return;
100
+ }
101
+
102
+ $targetParam = $parameters[$this->targetFunctions[$functionLC]];
103
+ $tokens = $phpcsFile->getTokens();
104
+
105
+ for ($i = $targetParam['start']; $i <= $targetParam['end']; $i++) {
106
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
107
+ continue;
108
+ }
109
+
110
+ if (isset($this->invalidTokenTypes[$tokens[$i]['code']]) === true) {
111
+ $phpcsFile->addWarning(
112
+ 'The value of the password hash algorithm constants has changed in PHP 7.4. Pass a PHP native constant to the %s() function instead of using the value of the constant. Found: %s',
113
+ $stackPtr,
114
+ 'NotAlgoConstant',
115
+ array(
116
+ $functionName,
117
+ $targetParam['raw'],
118
+ )
119
+ );
120
+
121
+ break;
122
+ }
123
+ }
124
+ }
125
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewProcOpenCmdArraySniff.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * As of PHP 7.4, `proc_open()` now also accepts an array instead of a string for the command.
19
+ *
20
+ * In that case, the process will be opened directly (without going through a shell) and
21
+ * PHP will take care of any necessary argument escaping.
22
+ *
23
+ * PHP version 7.4
24
+ *
25
+ * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.standard.proc-open
26
+ * @link https://www.php.net/manual/en/function.proc-open.php
27
+ *
28
+ * @since 9.3.0
29
+ */
30
+ class NewProcOpenCmdArraySniff extends AbstractFunctionCallParameterSniff
31
+ {
32
+
33
+ /**
34
+ * Functions to check for.
35
+ *
36
+ * @since 9.3.0
37
+ *
38
+ * @var array
39
+ */
40
+ protected $targetFunctions = array(
41
+ 'proc_open' => true,
42
+ );
43
+
44
+
45
+ /**
46
+ * Do a version check to determine if this sniff needs to run at all.
47
+ *
48
+ * @since 9.3.0
49
+ *
50
+ * @return bool
51
+ */
52
+ protected function bowOutEarly()
53
+ {
54
+ return false;
55
+ }
56
+
57
+
58
+ /**
59
+ * Process the parameters of a matched function.
60
+ *
61
+ * @since 9.3.0
62
+ *
63
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
+ * @param int $stackPtr The position of the current token in the stack.
65
+ * @param string $functionName The token content (function name) which was matched.
66
+ * @param array $parameters Array with information about the parameters.
67
+ *
68
+ * @return int|void Integer stack pointer to skip forward or void to continue
69
+ * normal file processing.
70
+ */
71
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
72
+ {
73
+ if (isset($parameters[1]) === false) {
74
+ return;
75
+ }
76
+
77
+ $tokens = $phpcsFile->getTokens();
78
+ $targetParam = $parameters[1];
79
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], $targetParam['end'], true);
80
+
81
+ if ($nextNonEmpty === false) {
82
+ // Shouldn't be possible.
83
+ return;
84
+ }
85
+
86
+ if ($tokens[$nextNonEmpty]['code'] !== \T_ARRAY
87
+ && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_SHORT_ARRAY
88
+ ) {
89
+ // Not passed as an array.
90
+ return;
91
+ }
92
+
93
+ if ($this->supportsBelow('7.3') === true) {
94
+ $phpcsFile->addError(
95
+ 'The proc_open() function did not accept $cmd to be passed in array format in PHP 7.3 and earlier.',
96
+ $nextNonEmpty,
97
+ 'Found'
98
+ );
99
+ }
100
+
101
+ if ($this->supportsAbove('7.4') === true) {
102
+ if (strpos($targetParam['raw'], 'escapeshellarg(') === false) {
103
+ // Efficiency: prevent needlessly walking the array.
104
+ return;
105
+ }
106
+
107
+ $items = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty);
108
+
109
+ if (empty($items)) {
110
+ return;
111
+ }
112
+
113
+ foreach ($items as $item) {
114
+ for ($i = $item['start']; $i <= $item['end']; $i++) {
115
+ if ($tokens[$i]['code'] !== \T_STRING
116
+ || $tokens[$i]['content'] !== 'escapeshellarg'
117
+ ) {
118
+ continue;
119
+ }
120
+
121
+ // @todo Potential future enhancement: check if it's a call to the PHP native function.
122
+
123
+ $phpcsFile->addWarning(
124
+ 'When passing proc_open() the $cmd parameter as an array, PHP will take care of any necessary argument escaping. Found: %s',
125
+ $i,
126
+ 'Invalid',
127
+ array($item['raw'])
128
+ );
129
+
130
+ // Only throw one error per array item.
131
+ break;
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/NewStripTagsAllowableTagsArraySniff.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * As of PHP 7.4, `strip_tags()` now also accepts an array of `$allowable_tags`.
19
+ *
20
+ * PHP version 7.4
21
+ *
22
+ * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.standard.strip-tags
23
+ * @link https://www.php.net/manual/en/function.strip-tags.php
24
+ *
25
+ * @since 9.3.0
26
+ */
27
+ class NewStripTagsAllowableTagsArraySniff extends AbstractFunctionCallParameterSniff
28
+ {
29
+
30
+ /**
31
+ * Functions to check for.
32
+ *
33
+ * @since 9.3.0
34
+ *
35
+ * @var array
36
+ */
37
+ protected $targetFunctions = array(
38
+ 'strip_tags' => true,
39
+ );
40
+
41
+ /**
42
+ * Text string tokens to examine.
43
+ *
44
+ * @since 9.3.0
45
+ *
46
+ * @var array
47
+ */
48
+ private $textStringTokens = array(
49
+ \T_CONSTANT_ENCAPSED_STRING => true,
50
+ \T_DOUBLE_QUOTED_STRING => true,
51
+ \T_INLINE_HTML => true,
52
+ \T_HEREDOC => true,
53
+ \T_NOWDOC => true,
54
+ );
55
+
56
+
57
+ /**
58
+ * Do a version check to determine if this sniff needs to run at all.
59
+ *
60
+ * @since 9.3.0
61
+ *
62
+ * @return bool
63
+ */
64
+ protected function bowOutEarly()
65
+ {
66
+ return false;
67
+ }
68
+
69
+
70
+ /**
71
+ * Process the parameters of a matched function.
72
+ *
73
+ * @since 9.3.0
74
+ *
75
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
76
+ * @param int $stackPtr The position of the current token in the stack.
77
+ * @param string $functionName The token content (function name) which was matched.
78
+ * @param array $parameters Array with information about the parameters.
79
+ *
80
+ * @return int|void Integer stack pointer to skip forward or void to continue
81
+ * normal file processing.
82
+ */
83
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
84
+ {
85
+ if (isset($parameters[2]) === false) {
86
+ return;
87
+ }
88
+
89
+ $tokens = $phpcsFile->getTokens();
90
+ $targetParam = $parameters[2];
91
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $targetParam['start'], $targetParam['end'], true);
92
+
93
+ if ($nextNonEmpty === false) {
94
+ // Shouldn't be possible.
95
+ return;
96
+ }
97
+
98
+ if ($tokens[$nextNonEmpty]['code'] !== \T_ARRAY
99
+ && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_SHORT_ARRAY
100
+ ) {
101
+ // Not passed as a hard-coded array.
102
+ return;
103
+ }
104
+
105
+ if ($this->supportsBelow('7.3') === true) {
106
+ $phpcsFile->addError(
107
+ 'The strip_tags() function did not accept $allowable_tags to be passed in array format in PHP 7.3 and earlier.',
108
+ $nextNonEmpty,
109
+ 'Found'
110
+ );
111
+ }
112
+
113
+ if ($this->supportsAbove('7.4') === true) {
114
+ if (strpos($targetParam['raw'], '>') === false) {
115
+ // Efficiency: prevent needlessly walking the array.
116
+ return;
117
+ }
118
+
119
+ $items = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty);
120
+
121
+ if (empty($items)) {
122
+ return;
123
+ }
124
+
125
+ foreach ($items as $item) {
126
+ for ($i = $item['start']; $i <= $item['end']; $i++) {
127
+ if ($tokens[$i]['code'] === \T_STRING
128
+ || $tokens[$i]['code'] === \T_VARIABLE
129
+ ) {
130
+ // Variable, constant, function call. Ignore complete item as undetermined.
131
+ break;
132
+ }
133
+
134
+ if (isset($this->textStringTokens[$tokens[$i]['code']]) === true
135
+ && strpos($tokens[$i]['content'], '>') !== false
136
+ ) {
137
+
138
+ $phpcsFile->addWarning(
139
+ 'When passing strip_tags() the $allowable_tags parameter as an array, the tags should not be enclosed in <> brackets. Found: %s',
140
+ $i,
141
+ 'Invalid',
142
+ array($item['raw'])
143
+ );
144
+
145
+ // Only throw one error per array item.
146
+ break;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedHashAlgorithmsSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedHashAlgorithmsSniff.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
- * @copyright 2012 Cu.be Solutions bvba
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -16,16 +14,14 @@ use PHPCompatibility\AbstractRemovedFeatureSniff;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedHashAlgorithmsSniff.
20
- *
21
- * Discourages the use of deprecated and removed hash algorithms.
22
  *
23
  * PHP version 5.4
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim.godden@cu.be>
28
- * @copyright 2012 Cu.be Solutions bvba
29
  */
30
  class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
31
  {
@@ -36,6 +32,8 @@ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
36
  * The array lists : version number with false (deprecated) and true (removed).
37
  * If's sufficient to list the first version where the hash algorithm was deprecated/removed.
38
  *
 
 
39
  * @var array(string => array(string => bool))
40
  */
41
  protected $removedAlgorithms = array(
@@ -50,6 +48,8 @@ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
50
  /**
51
  * Returns an array of tokens this test wants to listen for.
52
  *
 
 
53
  * @return array
54
  */
55
  public function register()
@@ -61,6 +61,8 @@ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
61
  /**
62
  * Processes this test, when one of its tokens is encountered.
63
  *
 
 
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the
66
  * stack passed in $tokens.
@@ -89,6 +91,8 @@ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
89
  /**
90
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
91
  *
 
 
92
  * @param array $itemInfo Base information about the item.
93
  *
94
  * @return array Version and other information about the item.
@@ -102,6 +106,8 @@ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
102
  /**
103
  * Get the error message template for this sniff.
104
  *
 
 
105
  * @return string
106
  */
107
  protected function getErrorMsgTemplate()
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect the use of deprecated and removed hash algorithms.
 
 
18
  *
19
  * PHP version 5.4
20
  *
21
+ * @link https://www.php.net/manual/en/function.hash-algos.php#refsect1-function.hash-algos-changelog
22
+ *
23
+ * @since 5.5
24
+ * @since 7.1.0 Now extends the `AbstractRemovedFeatureSniff` instead of the base `Sniff` class.
25
  */
26
  class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
27
  {
32
  * The array lists : version number with false (deprecated) and true (removed).
33
  * If's sufficient to list the first version where the hash algorithm was deprecated/removed.
34
  *
35
+ * @since 7.0.7
36
+ *
37
  * @var array(string => array(string => bool))
38
  */
39
  protected $removedAlgorithms = array(
48
  /**
49
  * Returns an array of tokens this test wants to listen for.
50
  *
51
+ * @since 5.5
52
+ *
53
  * @return array
54
  */
55
  public function register()
61
  /**
62
  * Processes this test, when one of its tokens is encountered.
63
  *
64
+ * @since 5.5
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.
91
  /**
92
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
93
  *
94
+ * @since 7.1.0
95
+ *
96
  * @param array $itemInfo Base information about the item.
97
  *
98
  * @return array Version and other information about the item.
106
  /**
107
  * Get the error message template for this sniff.
108
  *
109
+ * @since 7.1.0
110
+ *
111
  * @return string
112
  */
113
  protected function getErrorMsgTemplate()
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedIconvEncodingSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedIconvEncodingSniff.
4
  *
5
- * PHP version 5.6
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -15,19 +14,20 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedIconvEncodingSniff.
19
  *
20
- * Detect: "The iconv and mbstring configuration options related to encoding
21
- * have been deprecated in favour of default_charset."
22
  *
23
  * {@internal It is unclear which mbstring functions should be targetted, so for now,
24
- * only the iconv function is handled.}}
25
  *
26
  * PHP version 5.6
27
  *
28
- * @category PHP
29
- * @package PHPCompatibility
30
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
31
  */
32
  class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff
33
  {
@@ -35,6 +35,8 @@ class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff
35
  /**
36
  * Functions to check for.
37
  *
 
 
38
  * @var array
39
  */
40
  protected $targetFunctions = array(
@@ -45,6 +47,8 @@ class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff
45
  /**
46
  * Do a version check to determine if this sniff needs to run at all.
47
  *
 
 
48
  * @return bool
49
  */
50
  protected function bowOutEarly()
@@ -56,6 +60,8 @@ class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff
56
  /**
57
  * Process the parameters of a matched function.
58
  *
 
 
59
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
60
  * @param int $stackPtr The position of the current token in the stack.
61
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect passing deprecated `$type` values to `iconv_get_encoding()`.
18
  *
19
+ * "The iconv and mbstring configuration options related to encoding have been
20
+ * deprecated in favour of default_charset."
21
  *
22
  * {@internal It is unclear which mbstring functions should be targetted, so for now,
23
+ * only the iconv function is handled.}
24
  *
25
  * PHP version 5.6
26
  *
27
+ * @link https://www.php.net/manual/en/migration56.deprecated.php#migration56.deprecated.iconv-mbstring-encoding
28
+ * @link https://wiki.php.net/rfc/default_encoding
29
+ *
30
+ * @since 9.0.0
31
  */
32
  class RemovedIconvEncodingSniff extends AbstractFunctionCallParameterSniff
33
  {
35
  /**
36
  * Functions to check for.
37
  *
38
+ * @since 9.0.0
39
+ *
40
  * @var array
41
  */
42
  protected $targetFunctions = array(
47
  /**
48
  * Do a version check to determine if this sniff needs to run at all.
49
  *
50
+ * @since 9.0.0
51
+ *
52
  * @return bool
53
  */
54
  protected function bowOutEarly()
60
  /**
61
  * Process the parameters of a matched function.
62
  *
63
+ * @since 9.0.0
64
+ *
65
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
66
  * @param int $stackPtr The position of the current token in the stack.
67
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedImplodeFlexibleParamOrderSniff.php ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * Passing the `$glue` and `$pieces` parameters to `implode()` in reverse order has
19
+ * been deprecated in PHP 7.4.
20
+ *
21
+ * PHP version 7.4
22
+ *
23
+ * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.implode-reverse-parameters
24
+ * @link https://wiki.php.net/rfc/deprecations_php_7_4#implode_parameter_order_mix
25
+ * @link https://php.net/manual/en/function.implode.php
26
+ *
27
+ * @since 9.3.0
28
+ */
29
+ class RemovedImplodeFlexibleParamOrderSniff extends AbstractFunctionCallParameterSniff
30
+ {
31
+
32
+ /**
33
+ * Functions to check for.
34
+ *
35
+ * @since 9.3.0
36
+ *
37
+ * @var array
38
+ */
39
+ protected $targetFunctions = array(
40
+ 'implode' => true,
41
+ 'join' => true,
42
+ );
43
+
44
+ /**
45
+ * List of PHP native constants which should be recognized as text strings.
46
+ *
47
+ * @since 9.3.0
48
+ *
49
+ * @var array
50
+ */
51
+ private $constantStrings = array(
52
+ 'DIRECTORY_SEPARATOR' => true,
53
+ 'PHP_EOL' => true,
54
+ );
55
+
56
+ /**
57
+ * List of PHP native functions which should be recognized as returning an array.
58
+ *
59
+ * Note: The array_*() functions will always be taken into account.
60
+ *
61
+ * @since 9.3.0
62
+ *
63
+ * @var array
64
+ */
65
+ private $arrayFunctions = array(
66
+ 'compact' => true,
67
+ 'explode' => true,
68
+ 'range' => true,
69
+ );
70
+
71
+ /**
72
+ * List of PHP native array functions which should *not* be recognized as returning an array.
73
+ *
74
+ * @since 9.3.0
75
+ *
76
+ * @var array
77
+ */
78
+ private $arrayFunctionExceptions = array(
79
+ 'array_key_exists' => true,
80
+ 'array_key_first' => true,
81
+ 'array_key_last' => true,
82
+ 'array_multisort' => true,
83
+ 'array_pop' => true,
84
+ 'array_product' => true,
85
+ 'array_push' => true,
86
+ 'array_search' => true,
87
+ 'array_shift' => true,
88
+ 'array_sum' => true,
89
+ 'array_unshift' => true,
90
+ 'array_walk_recursive' => true,
91
+ 'array_walk' => true,
92
+ );
93
+
94
+
95
+ /**
96
+ * Do a version check to determine if this sniff needs to run at all.
97
+ *
98
+ * @since 9.3.0
99
+ *
100
+ * @return bool
101
+ */
102
+ protected function bowOutEarly()
103
+ {
104
+ return ($this->supportsAbove('7.4') === false);
105
+ }
106
+
107
+
108
+ /**
109
+ * Process the parameters of a matched function.
110
+ *
111
+ * @since 9.3.0
112
+ *
113
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
114
+ * @param int $stackPtr The position of the current token in the stack.
115
+ * @param string $functionName The token content (function name) which was matched.
116
+ * @param array $parameters Array with information about the parameters.
117
+ *
118
+ * @return int|void Integer stack pointer to skip forward or void to continue
119
+ * normal file processing.
120
+ */
121
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
122
+ {
123
+ if (isset($parameters[2]) === false) {
124
+ // Only one parameter, this must be $pieces. Bow out.
125
+ return;
126
+ }
127
+
128
+ $tokens = $phpcsFile->getTokens();
129
+
130
+ /*
131
+ * Examine the first parameter.
132
+ * If there is any indication that this is an array declaration, we have an error.
133
+ */
134
+
135
+ $targetParam = $parameters[1];
136
+ $start = $targetParam['start'];
137
+ $end = ($targetParam['end'] + 1);
138
+ $isOnlyText = true;
139
+
140
+ $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $end, true);
141
+ if ($firstNonEmpty === false) {
142
+ // Parse error. Shouldn't be possible.
143
+ return;
144
+ }
145
+
146
+ if ($tokens[$firstNonEmpty]['code'] === \T_OPEN_PARENTHESIS) {
147
+ $start = ($firstNonEmpty + 1);
148
+ $end = $tokens[$firstNonEmpty]['parenthesis_closer'];
149
+ }
150
+
151
+ $hasTernary = $phpcsFile->findNext(\T_INLINE_THEN, $start, $end);
152
+ if ($hasTernary !== false
153
+ && isset($tokens[$start]['nested_parenthesis'], $tokens[$hasTernary]['nested_parenthesis'])
154
+ && count($tokens[$start]['nested_parenthesis']) === count($tokens[$hasTernary]['nested_parenthesis'])
155
+ ) {
156
+ $start = ($hasTernary + 1);
157
+ }
158
+
159
+ for ($i = $start; $i < $end; $i++) {
160
+ $tokenCode = $tokens[$i]['code'];
161
+
162
+ if (isset(Tokens::$emptyTokens[$tokenCode])) {
163
+ continue;
164
+ }
165
+
166
+ if ($tokenCode === \T_STRING && isset($this->constantStrings[$tokens[$i]['content']])) {
167
+ continue;
168
+ }
169
+
170
+ if ($hasTernary !== false && $tokenCode === \T_INLINE_ELSE) {
171
+ continue;
172
+ }
173
+
174
+ if (isset(Tokens::$stringTokens[$tokenCode]) === false) {
175
+ $isOnlyText = false;
176
+ }
177
+
178
+ if ($tokenCode === \T_ARRAY || $tokenCode === \T_OPEN_SHORT_ARRAY || $tokenCode === \T_ARRAY_CAST) {
179
+ $this->throwNotice($phpcsFile, $stackPtr, $functionName);
180
+ return;
181
+ }
182
+
183
+ if ($tokenCode === \T_STRING) {
184
+ /*
185
+ * Check for specific functions which return an array (i.e. $pieces).
186
+ */
187
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), $end, true);
188
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
189
+ continue;
190
+ }
191
+
192
+ $nameLc = strtolower($tokens[$i]['content']);
193
+ if (isset($this->arrayFunctions[$nameLc]) === false
194
+ && (strpos($nameLc, 'array_') !== 0
195
+ || isset($this->arrayFunctionExceptions[$nameLc]) === true)
196
+ ) {
197
+ continue;
198
+ }
199
+
200
+ // Now make sure it's the PHP native function being called.
201
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($i - 1), $start, true);
202
+ if ($tokens[$prevNonEmpty]['code'] === \T_DOUBLE_COLON
203
+ || $tokens[$prevNonEmpty]['code'] === \T_OBJECT_OPERATOR
204
+ ) {
205
+ // Method call, not a call to the PHP native function.
206
+ continue;
207
+ }
208
+
209
+ if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
210
+ && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
211
+ ) {
212
+ // Namespaced function.
213
+ continue;
214
+ }
215
+
216
+ // Ok, so we know that there is an array function in the first param.
217
+ // 99.9% chance that this is $pieces, not $glue.
218
+ $this->throwNotice($phpcsFile, $stackPtr, $functionName);
219
+ return;
220
+ }
221
+ }
222
+
223
+ if ($isOnlyText === true) {
224
+ // First parameter only contained text string tokens, i.e. glue.
225
+ return;
226
+ }
227
+
228
+ /*
229
+ * Examine the second parameter.
230
+ */
231
+
232
+ $targetParam = $parameters[2];
233
+ $start = $targetParam['start'];
234
+ $end = ($targetParam['end'] + 1);
235
+
236
+ $firstNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $start, $end, true);
237
+ if ($firstNonEmpty === false) {
238
+ // Parse error. Shouldn't be possible.
239
+ return;
240
+ }
241
+
242
+ if ($tokens[$firstNonEmpty]['code'] === \T_OPEN_PARENTHESIS) {
243
+ $start = ($firstNonEmpty + 1);
244
+ $end = $tokens[$firstNonEmpty]['parenthesis_closer'];
245
+ }
246
+
247
+ $hasTernary = $phpcsFile->findNext(\T_INLINE_THEN, $start, $end);
248
+ if ($hasTernary !== false
249
+ && isset($tokens[$start]['nested_parenthesis'], $tokens[$hasTernary]['nested_parenthesis'])
250
+ && count($tokens[$start]['nested_parenthesis']) === count($tokens[$hasTernary]['nested_parenthesis'])
251
+ ) {
252
+ $start = ($hasTernary + 1);
253
+ }
254
+
255
+ for ($i = $start; $i < $end; $i++) {
256
+ $tokenCode = $tokens[$i]['code'];
257
+
258
+ if (isset(Tokens::$emptyTokens[$tokenCode])) {
259
+ continue;
260
+ }
261
+
262
+ if ($tokenCode === \T_ARRAY || $tokenCode === \T_OPEN_SHORT_ARRAY || $tokenCode === \T_ARRAY_CAST) {
263
+ // Found an array, $pieces is second.
264
+ return;
265
+ }
266
+
267
+ if ($tokenCode === \T_STRING && isset($this->constantStrings[$tokens[$i]['content']])) {
268
+ // One of the special cased, PHP native string constants found.
269
+ $this->throwNotice($phpcsFile, $stackPtr, $functionName);
270
+ return;
271
+ }
272
+
273
+ if ($tokenCode === \T_STRING || $tokenCode === \T_VARIABLE) {
274
+ // Function call, constant or variable encountered.
275
+ // No matter what this is combined with, we won't be able to reliably determine the value.
276
+ return;
277
+ }
278
+
279
+ if ($tokenCode === \T_CONSTANT_ENCAPSED_STRING
280
+ || $tokenCode === \T_DOUBLE_QUOTED_STRING
281
+ || $tokenCode === \T_HEREDOC
282
+ || $tokenCode === \T_NOWDOC
283
+ ) {
284
+ $this->throwNotice($phpcsFile, $stackPtr, $functionName);
285
+ return;
286
+ }
287
+ }
288
+ }
289
+
290
+
291
+ /**
292
+ * Throw the error/warning.
293
+ *
294
+ * @since 9.3.0
295
+ *
296
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
297
+ * @param int $stackPtr The position of the current token in the stack.
298
+ * @param string $functionName The token content (function name) which was matched.
299
+ *
300
+ * @return void
301
+ */
302
+ protected function throwNotice(File $phpcsFile, $stackPtr, $functionName)
303
+ {
304
+ $message = 'Passing the $glue and $pieces parameters in reverse order to %s has been deprecated since PHP 7.4';
305
+ $isError = false;
306
+ $errorCode = 'Deprecated';
307
+ $data = array($functionName);
308
+
309
+ /*
310
+ Support for the deprecated behaviour is expected to be removed in PHP 8.0.
311
+ Once this has been implemented, this section should be uncommented.
312
+ if ($this->supportsAbove('8.0') === true) {
313
+ $message .= ' and is removed since PHP 8.0';
314
+ $isError = true;
315
+ $errorCode = 'Removed';
316
+ }
317
+ */
318
+
319
+ $message .= '; $glue should be the first parameter and $pieces the second';
320
+
321
+ $this->addMessage($phpcsFile, $message, $stackPtr, $isError, $errorCode, $data);
322
+ }
323
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbStrrposEncodingThirdParamSniff.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\ParameterValues;
12
+
13
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
+ use PHP_CodeSniffer_File as File;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * Detect passing `$encoding` to `mb_strrpos()` as 3rd argument.
19
+ *
20
+ * The `$encoding` parameter was moved from the third position to the fourth in PHP 5.2.0.
21
+ * For backward compatibility, `$encoding` could be specified as the third parameter, but doing
22
+ * so is deprecated and will be removed in the future.
23
+ *
24
+ * Between PHP 5.2 and PHP 7.3, this was a deprecation in documentation only.
25
+ * As of PHP 7.4, a deprecation warning will be thrown if an encoding is passed as the 3rd
26
+ * argument.
27
+ * As of PHP 8, the argument is expected to change to accept an integer only.
28
+ *
29
+ * PHP version 5.2
30
+ * PHP version 7.4
31
+ *
32
+ * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.mbstring
33
+ * @link https://wiki.php.net/rfc/deprecations_php_7_4#mb_strrpos_with_encoding_as_3rd_argument
34
+ * @link https://www.php.net/manual/en/function.mb-strrpos.php
35
+ *
36
+ * @since 9.3.0
37
+ */
38
+ class RemovedMbStrrposEncodingThirdParamSniff extends AbstractFunctionCallParameterSniff
39
+ {
40
+
41
+ /**
42
+ * Functions to check for.
43
+ *
44
+ * @since 9.3.0
45
+ *
46
+ * @var array
47
+ */
48
+ protected $targetFunctions = array(
49
+ 'mb_strrpos' => true,
50
+ );
51
+
52
+ /**
53
+ * Tokens which should be recognized as text.
54
+ *
55
+ * @since 9.3.0
56
+ *
57
+ * @var array
58
+ */
59
+ private $textStringTokens = array(
60
+ \T_CONSTANT_ENCAPSED_STRING,
61
+ \T_DOUBLE_QUOTED_STRING,
62
+ \T_HEREDOC,
63
+ \T_NOWDOC,
64
+ );
65
+
66
+ /**
67
+ * Tokens which should be recognized as numbers.
68
+ *
69
+ * @since 9.3.0
70
+ *
71
+ * @var array
72
+ */
73
+ private $numberTokens = array(
74
+ \T_LNUMBER => \T_LNUMBER,
75
+ \T_DNUMBER => \T_DNUMBER,
76
+ \T_MINUS => \T_MINUS,
77
+ \T_PLUS => \T_PLUS,
78
+ );
79
+
80
+
81
+ /**
82
+ * Do a version check to determine if this sniff needs to run at all.
83
+ *
84
+ * @since 9.3.0
85
+ *
86
+ * @return bool
87
+ */
88
+ protected function bowOutEarly()
89
+ {
90
+ return $this->supportsAbove('5.2') === false;
91
+ }
92
+
93
+
94
+ /**
95
+ * Process the parameters of a matched function.
96
+ *
97
+ * @since 9.3.0
98
+ *
99
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
100
+ * @param int $stackPtr The position of the current token in the stack.
101
+ * @param string $functionName The token content (function name) which was matched.
102
+ * @param array $parameters Array with information about the parameters.
103
+ *
104
+ * @return int|void Integer stack pointer to skip forward or void to continue
105
+ * normal file processing.
106
+ */
107
+ public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
108
+ {
109
+ if (isset($parameters[3]) === false) {
110
+ // Optional third parameter not set.
111
+ return;
112
+ }
113
+
114
+ if (isset($parameters[4]) === true) {
115
+ // Encoding set as fourth parameter.
116
+ return;
117
+ }
118
+
119
+ $targetParam = $parameters[3];
120
+ $targets = $this->numberTokens + Tokens::$emptyTokens;
121
+ $nonNumber = $phpcsFile->findNext($targets, $targetParam['start'], ($targetParam['end'] + 1), true);
122
+ if ($nonNumber === false) {
123
+ return;
124
+ }
125
+
126
+ if ($this->isNumericCalculation($phpcsFile, $targetParam['start'], $targetParam['end']) === true) {
127
+ return;
128
+ }
129
+
130
+ $hasString = $phpcsFile->findNext($this->textStringTokens, $targetParam['start'], ($targetParam['end'] + 1));
131
+ if ($hasString === false) {
132
+ // No text strings found. Undetermined.
133
+ return;
134
+ }
135
+
136
+ $error = 'Passing the encoding to mb_strrpos() as third parameter is soft deprecated since PHP 5.2';
137
+ if ($this->supportsAbove('7.4') === true) {
138
+ $error .= ' and hard deprecated since PHP 7.4';
139
+ }
140
+
141
+ $error .= '. Use an explicit 0 as the offset in the third parameter.';
142
+
143
+ $phpcsFile->addWarning(
144
+ $error,
145
+ $targetParam['start'],
146
+ 'Deprecated'
147
+ );
148
+ }
149
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedMbstringModifiersSniff.
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
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -16,13 +15,20 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedMbstringModifiersSniff.
 
 
20
  *
21
  * PHP version 7.1
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
26
  */
27
  class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff
28
  {
@@ -32,6 +38,9 @@ class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff
32
  *
33
  * Key is the function name, value the parameter position of the options parameter.
34
  *
 
 
 
35
  * @var array
36
  */
37
  protected $targetFunctions = array(
@@ -46,6 +55,8 @@ class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff
46
  /**
47
  * Do a version check to determine if this sniff needs to run at all.
48
  *
 
 
49
  * @return bool
50
  */
51
  protected function bowOutEarly()
@@ -59,7 +70,9 @@ class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff
59
  /**
60
  * Process the parameters of a matched function.
61
  *
62
- * This method has to be made concrete in child classes.
 
 
63
  *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the stack.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Check for use of deprecated and removed regex modifiers for MbString regex functions.
19
+ *
20
+ * Initially just checks for the PHP 7.1 deprecated `e` modifier.
21
  *
22
  * PHP version 7.1
23
  *
24
+ * @link https://wiki.php.net/rfc/deprecate_mb_ereg_replace_eval_option
25
+ * @link https://www.php.net/manual/en/function.mb-regex-set-options.php
26
+ *
27
+ * @since 7.0.5
28
+ * @since 7.0.8 This sniff now throws a warning instead of an error as the functionality is
29
+ * only deprecated (for now).
30
+ * @since 8.2.0 Now extends the `AbstractFunctionCallParameterSniff` instead of the base `Sniff` class.
31
+ * @since 9.0.0 Renamed from `MbstringReplaceEModifierSniff` to `RemovedMbstringModifiersSniff`.
32
  */
33
  class RemovedMbstringModifiersSniff extends AbstractFunctionCallParameterSniff
34
  {
38
  *
39
  * Key is the function name, value the parameter position of the options parameter.
40
  *
41
+ * @since 7.0.5
42
+ * @since 8.2.0 Renamed from `$functions` to `$targetFunctions`.
43
+ *
44
  * @var array
45
  */
46
  protected $targetFunctions = array(
55
  /**
56
  * Do a version check to determine if this sniff needs to run at all.
57
  *
58
+ * @since 8.2.0
59
+ *
60
  * @return bool
61
  */
62
  protected function bowOutEarly()
70
  /**
71
  * Process the parameters of a matched function.
72
  *
73
+ * @since 7.0.5
74
+ * @since 8.2.0 Renamed from `process()` to `processParameters()` and removed
75
+ * logic superfluous now the sniff extends the abstract.
76
  *
77
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
78
  * @param int $stackPtr The position of the current token in the stack.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedNonCryptoHashSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedNonCryptoHashSniff.
4
  *
5
- * PHP version 7.2
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -15,16 +14,16 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedNonCryptoHashSniff.
19
  *
20
- * Detect: "The hash_hmac(), hash_hmac_file(), hash_pbkdf2(), and hash_init()
21
- * (with HASH_HMAC) functions no longer accept non-cryptographic hashes."
22
  *
23
  * PHP version 7.2
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
  */
29
  class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
30
  {
@@ -32,6 +31,8 @@ class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
32
  /**
33
  * Functions to check for.
34
  *
 
 
35
  * @var array
36
  */
37
  protected $targetFunctions = array(
@@ -44,6 +45,8 @@ class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
44
  /**
45
  * List of the non-cryptographic hashes.
46
  *
 
 
47
  * @var array
48
  */
49
  protected $disabledCryptos = array(
@@ -61,6 +64,8 @@ class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
61
  /**
62
  * Do a version check to determine if this sniff needs to run at all.
63
  *
 
 
64
  * @return bool
65
  */
66
  protected function bowOutEarly()
@@ -72,6 +77,8 @@ class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
72
  /**
73
  * Process the parameters of a matched function.
74
  *
 
 
75
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
76
  * @param int $stackPtr The position of the current token in the stack.
77
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect usage of non-cryptographic hashes.
18
  *
19
+ * "The `hash_hmac()`, `hash_hmac_file()`, `hash_pbkdf2()`, and `hash_init()`
20
+ * (with `HASH_HMAC`) functions no longer accept non-cryptographic hashes."
21
  *
22
  * PHP version 7.2
23
  *
24
+ * @link https://www.php.net/manual/en/migration72.incompatible.php#migration72.incompatible.hash-functions
25
+ *
26
+ * @since 9.0.0
27
  */
28
  class RemovedNonCryptoHashSniff extends AbstractFunctionCallParameterSniff
29
  {
31
  /**
32
  * Functions to check for.
33
  *
34
+ * @since 9.0.0
35
+ *
36
  * @var array
37
  */
38
  protected $targetFunctions = array(
45
  /**
46
  * List of the non-cryptographic hashes.
47
  *
48
+ * @since 9.0.0
49
+ *
50
  * @var array
51
  */
52
  protected $disabledCryptos = array(
64
  /**
65
  * Do a version check to determine if this sniff needs to run at all.
66
  *
67
+ * @since 9.0.0
68
+ *
69
  * @return bool
70
  */
71
  protected function bowOutEarly()
77
  /**
78
  * Process the parameters of a matched function.
79
  *
80
+ * @since 9.0.0
81
+ *
82
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
  * @param int $stackPtr The position of the current token in the stack.
84
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedPCREModifiersSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedPCREModifiersSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
- * @copyright 2014 Cu.be Solutions bvba
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -17,17 +15,26 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedPCREModifiersSniff.
21
  *
22
- * Check for usage of the `e` modifier with PCRE functions which is deprecated since PHP 5.5
23
  * and removed as of PHP 7.0.
24
  *
 
 
 
25
  * PHP version 5.5
 
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Wim Godden <wim.godden@cu.be>
30
- * @copyright 2014 Cu.be Solutions bvba
 
 
 
 
 
31
  */
32
  class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
33
  {
@@ -35,6 +42,9 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
35
  /**
36
  * Functions to check for.
37
  *
 
 
 
38
  * @var array
39
  */
40
  protected $targetFunctions = array(
@@ -45,6 +55,8 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
45
  /**
46
  * Regex bracket delimiters.
47
  *
 
 
48
  * @var array
49
  */
50
  protected $doublesSeparators = array(
@@ -58,6 +70,10 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
58
  /**
59
  * Process the parameters of a matched function.
60
  *
 
 
 
 
61
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
62
  * @param int $stackPtr The position of the current token in the stack.
63
  * @param string $functionName The token content (function name) which was matched.
@@ -116,6 +132,8 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
116
  /**
117
  * Do a version check to determine if this sniff needs to run at all.
118
  *
 
 
119
  * @return bool
120
  */
121
  protected function bowOutEarly()
@@ -125,7 +143,9 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
125
 
126
 
127
  /**
128
- * Analyse a potential regex pattern for usage of the /e modifier.
 
 
129
  *
130
  * @param array $pattern Array containing the start and end token
131
  * pointer of the potential regex pattern and
@@ -191,6 +211,8 @@ class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
191
  /**
192
  * Examine the regex modifier string.
193
  *
 
 
194
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
195
  * @param int $stackPtr The position of the current token in the
196
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Check for the use of deprecated and removed regex modifiers for PCRE regex functions.
19
  *
20
+ * Initially just checks for the `e` modifier, which was deprecated since PHP 5.5
21
  * and removed as of PHP 7.0.
22
  *
23
+ * {@internal If and when this sniff would need to start checking for other modifiers, a minor
24
+ * refactor will be needed as all references to the `e` modifier are currently hard-coded.}
25
+ *
26
  * PHP version 5.5
27
+ * PHP version 7.0
28
  *
29
+ * @link https://wiki.php.net/rfc/remove_preg_replace_eval_modifier
30
+ * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
31
+ * @link https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
32
+ *
33
+ * @since 5.6
34
+ * @since 7.0.8 This sniff now throws a warning (deprecated) or an error (removed) depending
35
+ * on the `testVersion` set. Previously it would always throw an error.
36
+ * @since 8.2.0 Now extends the `AbstractFunctionCallParameterSniff` instead of the base `Sniff` class.
37
+ * @since 9.0.0 Renamed from `PregReplaceEModifierSniff` to `RemovedPCREModifiersSniff`.
38
  */
39
  class RemovedPCREModifiersSniff extends AbstractFunctionCallParameterSniff
40
  {
42
  /**
43
  * Functions to check for.
44
  *
45
+ * @since 7.0.1
46
+ * @since 8.2.0 Renamed from `$functions` to `$targetFunctions`.
47
+ *
48
  * @var array
49
  */
50
  protected $targetFunctions = array(
55
  /**
56
  * Regex bracket delimiters.
57
  *
58
+ * @since 7.0.5 This array was originally contained within the `process()` method.
59
+ *
60
  * @var array
61
  */
62
  protected $doublesSeparators = array(
70
  /**
71
  * Process the parameters of a matched function.
72
  *
73
+ * @since 5.6
74
+ * @since 8.2.0 Renamed from `process()` to `processParameters()` and removed
75
+ * logic superfluous now the sniff extends the abstract.
76
+ *
77
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
78
  * @param int $stackPtr The position of the current token in the stack.
79
  * @param string $functionName The token content (function name) which was matched.
132
  /**
133
  * Do a version check to determine if this sniff needs to run at all.
134
  *
135
+ * @since 8.2.0
136
+ *
137
  * @return bool
138
  */
139
  protected function bowOutEarly()
143
 
144
 
145
  /**
146
+ * Analyse a potential regex pattern for use of the /e modifier.
147
+ *
148
+ * @since 7.1.2 This logic was originally contained within the `process()` method.
149
  *
150
  * @param array $pattern Array containing the start and end token
151
  * pointer of the potential regex pattern and
211
  /**
212
  * Examine the regex modifier string.
213
  *
214
+ * @since 8.2.0 Split off from the `processRegexPattern()` method.
215
+ *
216
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
217
  * @param int $stackPtr The position of the current token in the
218
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ParameterValues/RemovedSetlocaleStringSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedSetlocaleStringSniff.
4
  *
5
- * PHP version 4.2
6
- * PHP version 7.0
7
- *
8
- * @category PHP
9
- * @package PHPCompatibility
10
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\ParameterValues;
@@ -16,17 +14,18 @@ use PHPCompatibility\AbstractFunctionCallParameterSniff;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\ParameterValues\RemovedSetlocaleStringSniff.
20
  *
21
- * Detect: Support for the category parameter passed as a string has been removed.
22
- * Only LC_* constants can be used as of this version [7.0.0].
23
  *
24
  * PHP version 4.2
25
  * PHP version 7.0
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
30
  */
31
  class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff
32
  {
@@ -34,6 +33,8 @@ class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff
34
  /**
35
  * Functions to check for.
36
  *
 
 
37
  * @var array
38
  */
39
  protected $targetFunctions = array(
@@ -44,6 +45,8 @@ class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff
44
  /**
45
  * Do a version check to determine if this sniff needs to run at all.
46
  *
 
 
47
  * @return bool
48
  */
49
  protected function bowOutEarly()
@@ -55,6 +58,8 @@ class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff
55
  /**
56
  * Process the parameters of a matched function.
57
  *
 
 
58
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
59
  * @param int $stackPtr The position of the current token in the stack.
60
  * @param string $functionName The token content (function name) which was matched.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\ParameterValues;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect passing a string literal as `$category` to `setlocale()`.
18
  *
19
+ * Support for the category parameter passed as a string has been removed.
20
+ * Only `LC_*` constants can be used as of PHP 7.0.0.
21
  *
22
  * PHP version 4.2
23
  * PHP version 7.0
24
  *
25
+ * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
26
+ * @link https://www.php.net/manual/en/function.setlocale.php#refsect1-function.setlocale-changelog
27
+ *
28
+ * @since 9.0.0
29
  */
30
  class RemovedSetlocaleStringSniff extends AbstractFunctionCallParameterSniff
31
  {
33
  /**
34
  * Functions to check for.
35
  *
36
+ * @since 9.0.0
37
+ *
38
  * @var array
39
  */
40
  protected $targetFunctions = array(
45
  /**
46
  * Do a version check to determine if this sniff needs to run at all.
47
  *
48
+ * @since 9.0.0
49
+ *
50
  * @return bool
51
  */
52
  protected function bowOutEarly()
58
  /**
59
  * Process the parameters of a matched function.
60
  *
61
+ * @since 9.0.0
62
+ *
63
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
64
  * @param int $stackPtr The position of the current token in the stack.
65
  * @param string $functionName The token content (function name) which was matched.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php CHANGED
@@ -1,14 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\ForbiddenCallTimePassByReference.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Gary Rogers <gmrwebde@gmail.com>
10
- * @author Florian Grandel <jerico.dev@gmail.com>
11
- * @copyright 2009 Florian Grandel
12
  */
13
 
14
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -18,17 +15,18 @@ use PHP_CodeSniffer_File as File;
18
  use PHP_CodeSniffer_Tokens as Tokens;
19
 
20
  /**
21
- * \PHPCompatibility\Sniffs\Syntax\ForbiddenCallTimePassByReference.
22
  *
23
- * Discourages the use of call time pass by references
24
  *
25
  * PHP version 5.4
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Gary Rogers <gmrwebde@gmail.com>
30
- * @author Florian Grandel <jerico.dev@gmail.com>
31
- * @copyright 2009 Florian Grandel
 
32
  */
33
  class ForbiddenCallTimePassByReferenceSniff extends Sniff
34
  {
@@ -39,6 +37,8 @@ class ForbiddenCallTimePassByReferenceSniff extends Sniff
39
  * Near duplicate of Tokens::$assignmentTokens + Tokens::$equalityTokens.
40
  * Copied in for PHPCS cross-version compatibility.
41
  *
 
 
42
  * @var array
43
  */
44
  private $assignOrCompare = array(
@@ -72,6 +72,8 @@ class ForbiddenCallTimePassByReferenceSniff extends Sniff
72
  /**
73
  * Returns an array of tokens this test wants to listen for.
74
  *
 
 
75
  * @return array
76
  */
77
  public function register()
@@ -85,6 +87,8 @@ class ForbiddenCallTimePassByReferenceSniff extends Sniff
85
  /**
86
  * Processes this test, when one of its tokens is encountered.
87
  *
 
 
88
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
89
  * @param int $stackPtr The position of the current token
90
  * in the stack passed in $tokens.
@@ -161,6 +165,8 @@ class ForbiddenCallTimePassByReferenceSniff extends Sniff
161
  /**
162
  * Determine whether a parameter is passed by reference.
163
  *
 
 
164
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
165
  * @param array $parameter Information on the current parameter
166
  * to be examined.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2009-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect the use of call time pass by reference.
19
  *
20
+ * This behaviour has been deprecated in PHP 5.3 and removed in PHP 5.4.
21
  *
22
  * PHP version 5.4
23
  *
24
+ * @link https://wiki.php.net/rfc/calltimebyref
25
+ * @link https://www.php.net/manual/en/language.references.pass.php
26
+ *
27
+ * @since 5.5
28
+ * @since 7.0.8 This sniff now throws a warning (deprecated) or an error (removed) depending
29
+ * on the `testVersion` set. Previously it would always throw an error.
30
  */
31
  class ForbiddenCallTimePassByReferenceSniff extends Sniff
32
  {
37
  * Near duplicate of Tokens::$assignmentTokens + Tokens::$equalityTokens.
38
  * Copied in for PHPCS cross-version compatibility.
39
  *
40
+ * @since 8.1.0
41
+ *
42
  * @var array
43
  */
44
  private $assignOrCompare = array(
72
  /**
73
  * Returns an array of tokens this test wants to listen for.
74
  *
75
+ * @since 5.5
76
+ *
77
  * @return array
78
  */
79
  public function register()
87
  /**
88
  * Processes this test, when one of its tokens is encountered.
89
  *
90
+ * @since 5.5
91
+ *
92
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
93
  * @param int $stackPtr The position of the current token
94
  * in the stack passed in $tokens.
165
  /**
166
  * Determine whether a parameter is passed by reference.
167
  *
168
+ * @since 7.0.6 Split off from the `process()` method.
169
+ *
170
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
171
  * @param array $parameter Information on the current parameter
172
  * to be examined.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayStringDereferencingSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff.
4
  *
5
- * PHP version 5.5
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -16,21 +15,36 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff.
 
 
 
20
  *
21
- * Array and string literals can now be dereferenced directly to access individual elements and characters.
 
22
  *
23
  * PHP version 5.5
 
 
 
 
 
 
 
 
 
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
  */
29
  class NewArrayStringDereferencingSniff extends Sniff
30
  {
 
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -45,6 +59,8 @@ class NewArrayStringDereferencingSniff extends Sniff
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 in
50
  * the stack passed in $tokens.
@@ -53,10 +69,61 @@ class NewArrayStringDereferencingSniff extends Sniff
53
  */
54
  public function process(File $phpcsFile, $stackPtr)
55
  {
56
- if ($this->supportsBelow('5.4') === false) {
 
 
 
 
 
57
  return;
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  $tokens = $phpcsFile->getTokens();
61
 
62
  switch ($tokens[$stackPtr]['code']) {
@@ -68,7 +135,7 @@ class NewArrayStringDereferencingSniff extends Sniff
68
  case \T_ARRAY:
69
  if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) {
70
  // Live coding.
71
- return;
72
  } else {
73
  $type = 'arrays';
74
  $end = $tokens[$stackPtr]['parenthesis_closer'];
@@ -78,7 +145,7 @@ class NewArrayStringDereferencingSniff extends Sniff
78
  case \T_OPEN_SHORT_ARRAY:
79
  if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
80
  // Live coding.
81
- return;
82
  } else {
83
  $type = 'arrays';
84
  $end = $tokens[$stackPtr]['bracket_closer'];
@@ -88,21 +155,45 @@ class NewArrayStringDereferencingSniff extends Sniff
88
 
89
  if (isset($type, $end) === false) {
90
  // Shouldn't happen, but for some reason did.
91
- return;
92
  }
93
 
94
- $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true, null, true);
95
-
96
- if ($nextNonEmpty !== false
97
- && ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET'
98
- || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SHORT_ARRAY') // Work around bug #1381 in PHPCS 2.8.1 and lower.
99
- ) {
100
- $phpcsFile->addError(
101
- 'Direct array dereferencing of %s is not present in PHP version 5.4 or earlier',
102
- $nextNonEmpty,
103
- 'Found',
104
- array($type)
105
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
 
 
 
 
 
107
  }
108
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect array and string literal dereferencing.
19
+ *
20
+ * As of PHP 5.5, array and string literals can now be dereferenced directly to
21
+ * access individual elements and characters.
22
  *
23
+ * As of PHP 7.0, this also works when using curly braces for the dereferencing.
24
+ * While unclear, this most likely has to do with the Uniform Variable Syntax changes.
25
  *
26
  * PHP version 5.5
27
+ * PHP version 7.0
28
+ *
29
+ * @link https://www.php.net/manual/en/migration55.new-features.php#migration55.new-features.const-dereferencing
30
+ * @link https://wiki.php.net/rfc/constdereference
31
+ * @link https://wiki.php.net/rfc/uniform_variable_syntax
32
+ * @link https://www.php.net/manual/en/language.types.array.php#example-63
33
+ *
34
+ * {@internal The reason for splitting the logic of this sniff into different methods is
35
+ * to allow re-use of the logic by the PHP 7.4 `RemovedCurlyBraceArrayAccess` sniff.}
36
  *
37
+ * @since 7.1.4
38
+ * @since 9.3.0 Now also detects dereferencing using curly braces.
 
39
  */
40
  class NewArrayStringDereferencingSniff extends Sniff
41
  {
42
+
43
  /**
44
  * Returns an array of tokens this test wants to listen for.
45
  *
46
+ * @since 7.1.4
47
+ *
48
  * @return array
49
  */
50
  public function register()
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
62
+ * @since 7.1.4
63
+ *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in
66
  * the stack passed in $tokens.
69
  */
70
  public function process(File $phpcsFile, $stackPtr)
71
  {
72
+ if ($this->supportsBelow('5.6') === false) {
73
+ return;
74
+ }
75
+
76
+ $dereferencing = $this->isArrayStringDereferencing($phpcsFile, $stackPtr);
77
+ if (empty($dereferencing)) {
78
  return;
79
  }
80
 
81
+ $tokens = $phpcsFile->getTokens();
82
+ $supports54 = $this->supportsBelow('5.4');
83
+
84
+ foreach ($dereferencing['braces'] as $openBrace => $closeBrace) {
85
+ if ($supports54 === true
86
+ && ($tokens[$openBrace]['type'] === 'T_OPEN_SQUARE_BRACKET'
87
+ || $tokens[$openBrace]['type'] === 'T_OPEN_SHORT_ARRAY') // Work around bug #1381 in PHPCS 2.8.1 and lower.
88
+ ) {
89
+ $phpcsFile->addError(
90
+ 'Direct array dereferencing of %s is not present in PHP version 5.4 or earlier',
91
+ $openBrace,
92
+ 'Found',
93
+ array($dereferencing['type'])
94
+ );
95
+
96
+ continue;
97
+ }
98
+
99
+ // PHP 7.0 Array/string dereferencing using curly braces.
100
+ if ($tokens[$openBrace]['type'] === 'T_OPEN_CURLY_BRACKET') {
101
+ $phpcsFile->addError(
102
+ 'Direct array dereferencing of %s using curly braces is not present in PHP version 5.6 or earlier',
103
+ $openBrace,
104
+ 'FoundUsingCurlies',
105
+ array($dereferencing['type'])
106
+ );
107
+ }
108
+ }
109
+ }
110
+
111
+
112
+ /**
113
+ * Check if this string/array is being dereferenced.
114
+ *
115
+ * @since 9.3.0 Logic split off from the process method.
116
+ *
117
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
118
+ * @param int $stackPtr The position of the current token in
119
+ * the stack passed in $tokens.
120
+ *
121
+ * @return array Array containing the type of access and stack pointers to the
122
+ * open/close braces involved in the array/string dereferencing;
123
+ * or an empty array if no array/string dereferencing was detected.
124
+ */
125
+ public function isArrayStringDereferencing(File $phpcsFile, $stackPtr)
126
+ {
127
  $tokens = $phpcsFile->getTokens();
128
 
129
  switch ($tokens[$stackPtr]['code']) {
135
  case \T_ARRAY:
136
  if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) {
137
  // Live coding.
138
+ return array();
139
  } else {
140
  $type = 'arrays';
141
  $end = $tokens[$stackPtr]['parenthesis_closer'];
145
  case \T_OPEN_SHORT_ARRAY:
146
  if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
147
  // Live coding.
148
+ return array();
149
  } else {
150
  $type = 'arrays';
151
  $end = $tokens[$stackPtr]['bracket_closer'];
155
 
156
  if (isset($type, $end) === false) {
157
  // Shouldn't happen, but for some reason did.
158
+ return array();
159
  }
160
 
161
+ $braces = array();
162
+
163
+ do {
164
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true, null, true);
165
+ if ($nextNonEmpty === false) {
166
+ break;
167
+ }
168
+
169
+ if ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET'
170
+ || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_CURLY_BRACKET' // PHP 7.0+.
171
+ || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SHORT_ARRAY' // Work around bug #1381 in PHPCS 2.8.1 and lower.
172
+ ) {
173
+ if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) {
174
+ // Live coding or parse error.
175
+ break;
176
+ }
177
+
178
+ $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer'];
179
+
180
+ // Continue, just in case there is nested array access, i.e. `array(1, 2, 3)[$i][$j];`.
181
+ $end = $tokens[$nextNonEmpty]['bracket_closer'];
182
+ continue;
183
+ }
184
+
185
+ // If we're still here, we've reached the end of the variable.
186
+ break;
187
+
188
+ } while (true);
189
+
190
+ if (empty($braces)) {
191
+ return array();
192
  }
193
+
194
+ return array(
195
+ 'type' => $type,
196
+ 'braces' => $braces,
197
+ );
198
  }
199
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewArrayUnpackingSniff.php CHANGED
@@ -19,6 +19,7 @@ use PHP_CodeSniffer_Tokens as Tokens;
19
  *
20
  * PHP version 7.4
21
  *
 
22
  * @link https://wiki.php.net/rfc/spread_operator_for_array
23
  *
24
  * @since 9.2.0
@@ -29,6 +30,8 @@ class NewArrayUnpackingSniff extends Sniff
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -42,6 +45,8 @@ class NewArrayUnpackingSniff extends Sniff
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
 
 
45
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
46
  * @param int $stackPtr The position of the current token in the
47
  * stack passed in $tokens.
19
  *
20
  * PHP version 7.4
21
  *
22
+ * @link https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.unpack-inside-array
23
  * @link https://wiki.php.net/rfc/spread_operator_for_array
24
  *
25
  * @since 9.2.0
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
33
+ * @since 9.2.0
34
+ *
35
  * @return array
36
  */
37
  public function register()
45
  /**
46
  * Processes this test, when one of its tokens is encountered.
47
  *
48
+ * @since 9.2.0
49
+ *
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $stackPtr The position of the current token in the
52
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff.
4
  *
5
- * PHP version 5.4
6
- * PHP version 7.0
7
- *
8
- * @category PHP
9
- * @package PHPCompatibility
10
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -17,17 +15,28 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff.
 
 
 
21
  *
22
- * PHP 5.4: Class member access on instantiation has been added, e.g. (new Foo)->bar().
23
- * PHP 7.0: Class member access on cloning has been added, e.g. (clone $foo)->bar().
24
  *
25
  * PHP version 5.4
26
  * PHP version 7.0
27
  *
28
- * @category PHP
29
- * @package PHPCompatibility
30
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
 
 
 
31
  */
32
  class NewClassMemberAccessSniff extends Sniff
33
  {
@@ -35,6 +44,8 @@ class NewClassMemberAccessSniff extends Sniff
35
  /**
36
  * Returns an array of tokens this test wants to listen for.
37
  *
 
 
38
  * @return array
39
  */
40
  public function register()
@@ -48,6 +59,8 @@ class NewClassMemberAccessSniff extends Sniff
48
  /**
49
  * Processes this test, when one of its tokens is encountered.
50
  *
 
 
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token in the
53
  * stack passed in $tokens.
@@ -56,17 +69,73 @@ class NewClassMemberAccessSniff extends Sniff
56
  */
57
  public function process(File $phpcsFile, $stackPtr)
58
  {
59
- $tokens = $phpcsFile->getTokens();
60
-
61
- if ($tokens[$stackPtr]['code'] === \T_NEW && $this->supportsBelow('5.3') !== true) {
62
  return;
63
- } elseif ($tokens[$stackPtr]['code'] === \T_CLONE && $this->supportsBelow('5.6') !== true) {
 
 
 
64
  return;
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) {
68
  // The `new className/clone $a` has to be in parentheses, without is not supported.
69
- return;
70
  }
71
 
72
  $parenthesisCloser = end($tokens[$stackPtr]['nested_parenthesis']);
@@ -74,40 +143,50 @@ class NewClassMemberAccessSniff extends Sniff
74
 
75
  if (isset($tokens[$parenthesisOpener]['parenthesis_owner']) === true) {
76
  // If there is an owner, these parentheses are for a different purpose.
77
- return;
78
  }
79
 
80
  $prevBeforeParenthesis = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($parenthesisOpener - 1), null, true);
81
  if ($prevBeforeParenthesis !== false && $tokens[$prevBeforeParenthesis]['code'] === \T_STRING) {
82
  // This is most likely a function call with the new/cloned object as a parameter.
83
- return;
84
  }
85
 
86
- $nextAfterParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, ($parenthesisCloser + 1), null, true);
87
- if ($nextAfterParenthesis === false) {
88
- // Live coding.
89
- return;
90
- }
91
 
92
- if ($tokens[$nextAfterParenthesis]['code'] !== \T_OBJECT_OPERATOR
93
- && $tokens[$nextAfterParenthesis]['code'] !== \T_OPEN_SQUARE_BRACKET
94
- ) {
95
- return;
96
- }
97
 
98
- $data = array('instantiation', '5.3');
99
- $errorCode = 'OnNewFound';
 
 
 
100
 
101
- if ($tokens[$stackPtr]['code'] === \T_CLONE) {
102
- $data = array('cloning', '5.6');
103
- $errorCode = 'OnCloneFound';
104
- }
 
 
 
105
 
106
- $phpcsFile->addError(
107
- 'Class member access on object %s was not supported in PHP %s or earlier',
108
- $parenthesisCloser,
109
- $errorCode,
110
- $data
111
- );
 
 
 
 
 
 
 
112
  }
113
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect class member access on object instantiation/cloning.
19
+ *
20
+ * PHP 5.4: Class member access on instantiation has been added, e.g. `(new Foo)->bar()`.
21
+ * PHP 7.0: Class member access on cloning has been added, e.g. `(clone $foo)->bar()`.
22
  *
23
+ * As of PHP 7.0, class member access on instantiation also works when using curly braces.
24
+ * While unclear, this most likely has to do with the Uniform Variable Syntax changes.
25
  *
26
  * PHP version 5.4
27
  * PHP version 7.0
28
  *
29
+ * @link https://www.php.net/manual/en/language.oop5.basic.php#example-177
30
+ * @link https://www.php.net/manual/en/language.oop5.cloning.php#language.oop5.traits.properties.example
31
+ * @link https://www.php.net/manual/en/migration54.new-features.php
32
+ * @link https://wiki.php.net/rfc/instance-method-call
33
+ * @link https://wiki.php.net/rfc/uniform_variable_syntax
34
+ *
35
+ * {@internal The reason for splitting the logic of this sniff into different methods is
36
+ * to allow re-use of the logic by the PHP 7.4 `RemovedCurlyBraceArrayAccess` sniff.}
37
+ *
38
+ * @since 8.2.0
39
+ * @since 9.3.0 Now also detects class member access on instantiation using curly braces.
40
  */
41
  class NewClassMemberAccessSniff extends Sniff
42
  {
44
  /**
45
  * Returns an array of tokens this test wants to listen for.
46
  *
47
+ * @since 8.2.0
48
+ *
49
  * @return array
50
  */
51
  public function register()
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
62
+ * @since 8.2.0
63
+ *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the
66
  * stack passed in $tokens.
69
  */
70
  public function process(File $phpcsFile, $stackPtr)
71
  {
72
+ if ($this->supportsBelow('5.6') === false) {
 
 
73
  return;
74
+ }
75
+
76
+ $pointers = $this->isClassMemberAccess($phpcsFile, $stackPtr);
77
+ if (empty($pointers)) {
78
  return;
79
  }
80
 
81
+ $tokens = $phpcsFile->getTokens();
82
+ $supports53 = $this->supportsBelow('5.3');
83
+
84
+ $error = 'Class member access on object %s was not supported in PHP %s or earlier';
85
+ $data = array('instantiation', '5.3');
86
+ $errorCode = 'OnNewFound';
87
+
88
+ if ($tokens[$stackPtr]['code'] === \T_CLONE) {
89
+ $data = array('cloning', '5.6');
90
+ $errorCode = 'OnCloneFound';
91
+ }
92
+
93
+ foreach ($pointers as $open => $close) {
94
+ $itemData = $data;
95
+ $itemErrorCode = $errorCode;
96
+
97
+ if ($tokens[$stackPtr]['code'] === \T_NEW
98
+ && $tokens[$open]['code'] !== \T_OPEN_CURLY_BRACKET
99
+ ) {
100
+ if ($supports53 === true) {
101
+ $phpcsFile->addError($error, $open, $itemErrorCode, $itemData);
102
+ }
103
+ continue;
104
+ }
105
+
106
+ if ($tokens[$stackPtr]['code'] === \T_NEW
107
+ && $tokens[$open]['code'] === \T_OPEN_CURLY_BRACKET
108
+ ) {
109
+ // Non-curlies was already handled above.
110
+ $itemData = array('instantiation using curly braces', '5.6');
111
+ $itemErrorCode = 'OnNewFoundUsingCurlies';
112
+ }
113
+
114
+ $phpcsFile->addError($error, $open, $itemErrorCode, $itemData);
115
+ }
116
+ }
117
+
118
+
119
+ /**
120
+ * Check if the class being instantiated/cloned is being dereferenced.
121
+ *
122
+ * @since 9.3.0 Logic split off from the process method.
123
+ *
124
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
125
+ * @param int $stackPtr The position of the current token in
126
+ * the stack passed in $tokens.
127
+ *
128
+ * @return array Array containing the stack pointers to the object operator or
129
+ * the open/close braces involved in the class member access;
130
+ * or an empty array if no class member access was detected.
131
+ */
132
+ public function isClassMemberAccess(File $phpcsFile, $stackPtr)
133
+ {
134
+ $tokens = $phpcsFile->getTokens();
135
+
136
  if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) {
137
  // The `new className/clone $a` has to be in parentheses, without is not supported.
138
+ return array();
139
  }
140
 
141
  $parenthesisCloser = end($tokens[$stackPtr]['nested_parenthesis']);
143
 
144
  if (isset($tokens[$parenthesisOpener]['parenthesis_owner']) === true) {
145
  // If there is an owner, these parentheses are for a different purpose.
146
+ return array();
147
  }
148
 
149
  $prevBeforeParenthesis = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($parenthesisOpener - 1), null, true);
150
  if ($prevBeforeParenthesis !== false && $tokens[$prevBeforeParenthesis]['code'] === \T_STRING) {
151
  // This is most likely a function call with the new/cloned object as a parameter.
152
+ return array();
153
  }
154
 
155
+ $braces = array();
156
+ $end = $parenthesisCloser;
 
 
 
157
 
158
+ do {
159
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true, null, true);
160
+ if ($nextNonEmpty === false) {
161
+ break;
162
+ }
163
 
164
+ if ($tokens[$nextNonEmpty]['code'] === \T_OBJECT_OPERATOR) {
165
+ // No need to walk any further if this is object access.
166
+ $braces[$nextNonEmpty] = true;
167
+ break;
168
+ }
169
 
170
+ if ($tokens[$nextNonEmpty]['code'] === \T_OPEN_SQUARE_BRACKET
171
+ || $tokens[$nextNonEmpty]['code'] === \T_OPEN_CURLY_BRACKET // PHP 7.0+.
172
+ ) {
173
+ if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) {
174
+ // Live coding or parse error.
175
+ break;
176
+ }
177
 
178
+ $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer'];
179
+
180
+ // Continue, just in case there is nested array access, i.e. `(new Foo())[1][0];`.
181
+ $end = $tokens[$nextNonEmpty]['bracket_closer'];
182
+ continue;
183
+ }
184
+
185
+ // If we're still here, we've reached the end.
186
+ break;
187
+
188
+ } while (true);
189
+
190
+ return $braces;
191
  }
192
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewDynamicAccessToStaticSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewDynamicAccessToStaticSniff.
4
  *
5
- * PHP version 5.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -16,16 +15,17 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Syntax\NewDynamicAccessToStaticSniff.
20
  *
21
  * As of PHP 5.3, static properties and methods as well as class constants
22
  * can be accessed using a dynamic (variable) class name.
23
  *
24
  * PHP version 5.3
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
29
  */
30
  class NewDynamicAccessToStaticSniff extends Sniff
31
  {
@@ -33,6 +33,8 @@ class NewDynamicAccessToStaticSniff extends Sniff
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
 
 
36
  * @return array
37
  */
38
  public function register()
@@ -45,6 +47,8 @@ class NewDynamicAccessToStaticSniff extends Sniff
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 in the
50
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect dynamic access to static methods and properties, as well as class constants.
19
  *
20
  * As of PHP 5.3, static properties and methods as well as class constants
21
  * can be accessed using a dynamic (variable) class name.
22
  *
23
  * PHP version 5.3
24
  *
25
+ * @link https://www.php.net/manual/en/migration53.new-features.php
26
+ *
27
+ * @since 8.1.0
28
+ * @since 9.0.0 Renamed from `DynamicAccessToStaticSniff` to `NewDynamicAccessToStaticSniff`.
29
  */
30
  class NewDynamicAccessToStaticSniff extends Sniff
31
  {
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
36
+ * @since 8.1.0
37
+ *
38
  * @return array
39
  */
40
  public function register()
47
  /**
48
  * Processes this test, when one of its tokens is encountered.
49
  *
50
+ * @since 8.1.0
51
+ *
52
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
53
  * @param int $stackPtr The position of the current token in the
54
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewFlexibleHeredocNowdocSniff.
4
  *
5
- * PHP version 7.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -16,19 +15,20 @@ use PHPCompatibility\PHPCSHelper;
16
  use PHP_CodeSniffer_File as File;
17
 
18
  /**
19
- * New Flexible Heredoc Nowdoc.
20
  *
21
  * As of PHP 7.3:
22
- * - The body and the closing marker of a Heredoc/nowdoc can be indented;
23
  * - The closing marker no longer needs to be on a line by itself;
24
  * - The heredoc/nowdoc body may no longer contain the closing marker at the
25
  * start of any of its lines.
26
  *
27
  * PHP version 7.3
28
  *
29
- * @category PHP
30
- * @package PHPCompatibility
31
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
32
  */
33
  class NewFlexibleHeredocNowdocSniff extends Sniff
34
  {
@@ -36,6 +36,8 @@ class NewFlexibleHeredocNowdocSniff extends Sniff
36
  /**
37
  * Returns an array of tokens this test wants to listen for.
38
  *
 
 
39
  * @return array
40
  */
41
  public function register()
@@ -57,6 +59,8 @@ class NewFlexibleHeredocNowdocSniff extends Sniff
57
  /**
58
  * Processes this test, when one of its tokens is encountered.
59
  *
 
 
60
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
61
  * @param int $stackPtr The position of the current token in the
62
  * stack passed in $tokens.
@@ -84,6 +88,8 @@ class NewFlexibleHeredocNowdocSniff extends Sniff
84
  /**
85
  * Detect indented and/or non-stand alone closing markers.
86
  *
 
 
87
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
88
  * @param int $stackPtr The position of the current token in the
89
  * stack passed in $tokens.
@@ -171,6 +177,8 @@ class NewFlexibleHeredocNowdocSniff extends Sniff
171
  /**
172
  * Detect heredoc/nowdoc identifiers at the start of lines in the heredoc/nowdoc body.
173
  *
 
 
174
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
175
  * @param int $stackPtr The position of the current token in the
176
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect usage of flexible heredoc/nowdoc and related cross-version incompatibilities.
19
  *
20
  * As of PHP 7.3:
21
+ * - The body and the closing marker of a heredoc/nowdoc can be indented;
22
  * - The closing marker no longer needs to be on a line by itself;
23
  * - The heredoc/nowdoc body may no longer contain the closing marker at the
24
  * start of any of its lines.
25
  *
26
  * PHP version 7.3
27
  *
28
+ * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.heredoc
29
+ * @link https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
30
+ *
31
+ * @since 9.0.0
32
  */
33
  class NewFlexibleHeredocNowdocSniff extends Sniff
34
  {
36
  /**
37
  * Returns an array of tokens this test wants to listen for.
38
  *
39
+ * @since 9.0.0
40
+ *
41
  * @return array
42
  */
43
  public function register()
59
  /**
60
  * Processes this test, when one of its tokens is encountered.
61
  *
62
+ * @since 9.0.0
63
+ *
64
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
65
  * @param int $stackPtr The position of the current token in the
66
  * stack passed in $tokens.
88
  /**
89
  * Detect indented and/or non-stand alone closing markers.
90
  *
91
+ * @since 9.0.0
92
+ *
93
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
94
  * @param int $stackPtr The position of the current token in the
95
  * stack passed in $tokens.
177
  /**
178
  * Detect heredoc/nowdoc identifiers at the start of lines in the heredoc/nowdoc body.
179
  *
180
+ * @since 9.0.0
181
+ *
182
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
183
  * @param int $stackPtr The position of the current token in the
184
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionArrayDereferencingSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -16,19 +15,34 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff.
 
 
 
 
 
20
  *
21
  * PHP version 5.4
 
 
 
 
 
 
 
 
 
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Wim Godden <wim.godden@cu.be>
26
  */
27
  class NewFunctionArrayDereferencingSniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -39,6 +53,8 @@ class NewFunctionArrayDereferencingSniff extends Sniff
39
  /**
40
  * Processes this test, when one of its tokens is encountered.
41
  *
 
 
42
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
43
  * @param int $stackPtr The position of the current token in
44
  * the stack passed in $tokens.
@@ -47,26 +63,81 @@ class NewFunctionArrayDereferencingSniff extends Sniff
47
  */
48
  public function process(File $phpcsFile, $stackPtr)
49
  {
50
- if ($this->supportsBelow('5.3') === false) {
 
 
 
 
 
51
  return;
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  $tokens = $phpcsFile->getTokens();
55
 
56
  // Next non-empty token should be the open parenthesis.
57
  $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
58
  if ($openParenthesis === false || $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) {
59
- return;
60
  }
61
 
62
  // Don't throw errors during live coding.
63
  if (isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
64
- return;
65
  }
66
 
67
  // Is this T_STRING really a function or method call ?
68
  $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
69
- if ($prevToken !== false && \in_array($tokens[$prevToken]['code'], array(\T_DOUBLE_COLON, \T_OBJECT_OPERATOR), true) === false) {
 
 
 
 
 
 
 
70
  $ignore = array(
71
  \T_FUNCTION => true,
72
  \T_CONST => true,
@@ -78,18 +149,39 @@ class NewFunctionArrayDereferencingSniff extends Sniff
78
 
79
  if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
80
  // Not a call to a PHP function or method.
81
- return;
82
  }
83
  }
84
 
85
- $closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer'];
86
- $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($closeParenthesis + 1), null, true, null, true);
87
- if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET') {
88
- $phpcsFile->addError(
89
- 'Function array dereferencing is not present in PHP version 5.3 or earlier',
90
- $nextNonEmpty,
91
- 'Found'
92
- );
93
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
  }
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect function array dereferencing as introduced in PHP 5.4.
19
+ *
20
+ * PHP 5.4 supports direct array dereferencing on the return of a method/function call.
21
+ *
22
+ * As of PHP 7.0, this also works when using curly braces for the dereferencing.
23
+ * While unclear, this most likely has to do with the Uniform Variable Syntax changes.
24
  *
25
  * PHP version 5.4
26
+ * PHP version 7.0
27
+ *
28
+ * @link https://www.php.net/manual/en/language.types.array.php#example-63
29
+ * @link https://www.php.net/manual/en/migration54.new-features.php
30
+ * @link https://wiki.php.net/rfc/functionarraydereferencing
31
+ * @link https://wiki.php.net/rfc/uniform_variable_syntax
32
+ *
33
+ * {@internal The reason for splitting the logic of this sniff into different methods is
34
+ * to allow re-use of the logic by the PHP 7.4 RemovedCurlyBraceArrayAccess sniff.}
35
  *
36
+ * @since 7.0.0
37
+ * @since 9.3.0 Now also detects dereferencing using curly braces.
 
38
  */
39
  class NewFunctionArrayDereferencingSniff extends Sniff
40
  {
41
  /**
42
  * Returns an array of tokens this test wants to listen for.
43
  *
44
+ * @since 7.0.0
45
+ *
46
  * @return array
47
  */
48
  public function register()
53
  /**
54
  * Processes this test, when one of its tokens is encountered.
55
  *
56
+ * @since 7.0.0
57
+ *
58
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
59
  * @param int $stackPtr The position of the current token in
60
  * the stack passed in $tokens.
63
  */
64
  public function process(File $phpcsFile, $stackPtr)
65
  {
66
+ if ($this->supportsBelow('5.6') === false) {
67
+ return;
68
+ }
69
+
70
+ $dereferencing = $this->isFunctionArrayDereferencing($phpcsFile, $stackPtr);
71
+ if (empty($dereferencing)) {
72
  return;
73
  }
74
 
75
+ $tokens = $phpcsFile->getTokens();
76
+ $supports53 = $this->supportsBelow('5.3');
77
+
78
+ foreach ($dereferencing as $openBrace => $closeBrace) {
79
+ if ($supports53 === true
80
+ && $tokens[$openBrace]['type'] === 'T_OPEN_SQUARE_BRACKET'
81
+ ) {
82
+ $phpcsFile->addError(
83
+ 'Function array dereferencing is not present in PHP version 5.3 or earlier',
84
+ $openBrace,
85
+ 'Found'
86
+ );
87
+
88
+ continue;
89
+ }
90
+
91
+ // PHP 7.0 function array dereferencing using curly braces.
92
+ if ($tokens[$openBrace]['type'] === 'T_OPEN_CURLY_BRACKET') {
93
+ $phpcsFile->addError(
94
+ 'Function array dereferencing using curly braces is not present in PHP version 5.6 or earlier',
95
+ $openBrace,
96
+ 'FoundUsingCurlies'
97
+ );
98
+ }
99
+ }
100
+ }
101
+
102
+
103
+ /**
104
+ * Check if the return of a function/method call is being dereferenced.
105
+ *
106
+ * @since 9.3.0 Logic split off from the process method.
107
+ *
108
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
109
+ * @param int $stackPtr The position of the current token in
110
+ * the stack passed in $tokens.
111
+ *
112
+ * @return array Array containing stack pointers to the open/close braces
113
+ * involved in the function dereferencing;
114
+ * or an empty array if no function dereferencing was detected.
115
+ */
116
+ public function isFunctionArrayDereferencing(File $phpcsFile, $stackPtr)
117
+ {
118
  $tokens = $phpcsFile->getTokens();
119
 
120
  // Next non-empty token should be the open parenthesis.
121
  $openParenthesis = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
122
  if ($openParenthesis === false || $tokens[$openParenthesis]['code'] !== \T_OPEN_PARENTHESIS) {
123
+ return array();
124
  }
125
 
126
  // Don't throw errors during live coding.
127
  if (isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
128
+ return array();
129
  }
130
 
131
  // Is this T_STRING really a function or method call ?
132
  $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
133
+ if ($prevToken !== false
134
+ && \in_array($tokens[$prevToken]['code'], array(\T_DOUBLE_COLON, \T_OBJECT_OPERATOR), true) === false
135
+ ) {
136
+ if ($tokens[$prevToken]['code'] === \T_BITWISE_AND) {
137
+ // This may be a function declared by reference.
138
+ $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevToken - 1), null, true);
139
+ }
140
+
141
  $ignore = array(
142
  \T_FUNCTION => true,
143
  \T_CONST => true,
149
 
150
  if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
151
  // Not a call to a PHP function or method.
152
+ return array();
153
  }
154
  }
155
 
156
+ $current = $tokens[$openParenthesis]['parenthesis_closer'];
157
+ $braces = array();
158
+
159
+ do {
160
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true, null, true);
161
+ if ($nextNonEmpty === false) {
162
+ break;
163
+ }
164
+
165
+ if ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET'
166
+ || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_CURLY_BRACKET' // PHP 7.0+.
167
+ ) {
168
+ if (isset($tokens[$nextNonEmpty]['bracket_closer']) === false) {
169
+ // Live coding or parse error.
170
+ break;
171
+ }
172
+
173
+ $braces[$nextNonEmpty] = $tokens[$nextNonEmpty]['bracket_closer'];
174
+
175
+ // Continue, just in case there is nested array access, i.e. `echo $foo->bar()[0][2];`.
176
+ $current = $tokens[$nextNonEmpty]['bracket_closer'];
177
+ continue;
178
+ }
179
+
180
+ // If we're still here, we've reached the end of the function call.
181
+ break;
182
+
183
+ } while (true);
184
+
185
+ return $braces;
186
  }
187
  }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewFunctionCallTrailingCommaSniff.
4
  *
5
- * PHP version 7.3
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -16,19 +15,23 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Syntax\NewFunctionCallTrailingCommaSniff.
20
  *
21
  * PHP version 7.3
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
26
  */
27
  class NewFunctionCallTrailingCommaSniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -45,6 +48,8 @@ class NewFunctionCallTrailingCommaSniff extends Sniff
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 in
50
  * the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect trailing comma's in function calls, `isset()` and `unset()` as allowed since PHP 7.3.
19
  *
20
  * PHP version 7.3
21
  *
22
+ * @link https://www.php.net/manual/en/migration73.new-features.php#migration73.new-features.core.trailing-commas
23
+ * @link https://wiki.php.net/rfc/trailing-comma-function-calls
24
+ *
25
+ * @since 8.2.0
26
+ * @since 9.0.0 Renamed from `NewTrailingCommaSniff` to `NewFunctionCallTrailingCommaSniff`.
27
  */
28
  class NewFunctionCallTrailingCommaSniff extends Sniff
29
  {
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
33
+ * @since 8.2.0
34
+ *
35
  * @return array
36
  */
37
  public function register()
48
  /**
49
  * Processes this test, when one of its tokens is encountered.
50
  *
51
+ * @since 8.2.0
52
+ *
53
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
54
  * @param int $stackPtr The position of the current token in
55
  * the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/NewShortArraySniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\NewShortArray.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Alex Miroshnikov <unknown@example.com>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -15,15 +14,15 @@ use PHPCompatibility\Sniff;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Syntax\NewShortArray.
19
- *
20
- * Short array syntax is available since PHP 5.4
21
  *
22
  * PHP version 5.4
23
  *
24
- * @category PHP
25
- * @package PHPCompatibility
26
- * @author Alex Miroshnikov <unknown@example.com>
 
 
27
  */
28
  class NewShortArraySniff extends Sniff
29
  {
@@ -31,6 +30,8 @@ class NewShortArraySniff extends Sniff
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -45,6 +46,8 @@ class NewShortArraySniff extends Sniff
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 in
50
  * the stack passed in $tokens.
@@ -60,7 +63,7 @@ class NewShortArraySniff extends Sniff
60
  $tokens = $phpcsFile->getTokens();
61
  $token = $tokens[$stackPtr];
62
 
63
- $error = '%s is available since 5.4';
64
  $data = array();
65
 
66
  if ($token['type'] === 'T_OPEN_SHORT_ARRAY') {
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of short array syntax which is available since PHP 5.4.
 
 
18
  *
19
  * PHP version 5.4
20
  *
21
+ * @link https://wiki.php.net/rfc/shortsyntaxforarrays
22
+ * @link https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax
23
+ *
24
+ * @since 7.0.0
25
+ * @since 9.0.0 Renamed from `ShortArraySniff` to `NewShortArraySniff`.
26
  */
27
  class NewShortArraySniff extends Sniff
28
  {
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
33
+ * @since 7.0.0
34
+ *
35
  * @return array
36
  */
37
  public function register()
46
  /**
47
  * Processes this test, when one of its tokens is encountered.
48
  *
49
+ * @since 7.0.0
50
+ *
51
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
  * @param int $stackPtr The position of the current token in
53
  * the stack passed in $tokens.
63
  $tokens = $phpcsFile->getTokens();
64
  $token = $tokens[$stackPtr];
65
 
66
+ $error = '%s is not supported in PHP 5.3 or lower';
67
  $data = array();
68
 
69
  if ($token['type'] === 'T_OPEN_SHORT_ARRAY') {
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedCurlyBraceArrayAccessSniff.php ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\Syntax;
12
+
13
+ use PHPCompatibility\Sniff;
14
+ use PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff;
15
+ use PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff;
16
+ use PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff;
17
+ use PHP_CodeSniffer_File as File;
18
+ use PHP_CodeSniffer_Tokens as Tokens;
19
+
20
+ /**
21
+ * Using the curly brace syntax to access array or string offsets has been deprecated in PHP 7.4.
22
+ *
23
+ * PHP version 7.4
24
+ *
25
+ * @link https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.array-string-access-curly-brace
26
+ * @link https://wiki.php.net/rfc/deprecate_curly_braces_array_access
27
+ *
28
+ * @since 9.3.0
29
+ */
30
+ class RemovedCurlyBraceArrayAccessSniff extends Sniff
31
+ {
32
+
33
+ /**
34
+ * Instance of the NewArrayStringDereferencing sniff.
35
+ *
36
+ * @since 9.3.0
37
+ *
38
+ * @var \PHPCompatibility\Sniffs\Syntax\NewArrayStringDereferencingSniff
39
+ */
40
+ private $newArrayStringDereferencing;
41
+
42
+ /**
43
+ * Target tokens as register by the NewArrayStringDereferencing sniff.
44
+ *
45
+ * @since 9.3.0
46
+ *
47
+ * @var array
48
+ */
49
+ private $newArrayStringDereferencingTargets;
50
+
51
+ /**
52
+ * Instance of the NewClassMemberAccess sniff.
53
+ *
54
+ * @since 9.3.0
55
+ *
56
+ * @var \PHPCompatibility\Sniffs\Syntax\NewClassMemberAccessSniff
57
+ */
58
+ private $newClassMemberAccess;
59
+
60
+ /**
61
+ * Target tokens as register by the NewClassMemberAccess sniff.
62
+ *
63
+ * @since 9.3.0
64
+ *
65
+ * @var array
66
+ */
67
+ private $newClassMemberAccessTargets;
68
+
69
+ /**
70
+ * Instance of the NewFunctionArrayDereferencing sniff.
71
+ *
72
+ * @since 9.3.0
73
+ *
74
+ * @var \PHPCompatibility\Sniffs\Syntax\NewFunctionArrayDereferencingSniff
75
+ */
76
+ private $newFunctionArrayDereferencing;
77
+
78
+ /**
79
+ * Target tokens as register by the NewFunctionArrayDereferencing sniff.
80
+ *
81
+ * @since 9.3.0
82
+ *
83
+ * @var array
84
+ */
85
+ private $newFunctionArrayDereferencingTargets;
86
+
87
+
88
+ /**
89
+ * Constructor.
90
+ *
91
+ * @since 9.3.0
92
+ */
93
+ public function __construct()
94
+ {
95
+ $this->newArrayStringDereferencing = new NewArrayStringDereferencingSniff();
96
+ $this->newClassMemberAccess = new NewClassMemberAccessSniff();
97
+ $this->newFunctionArrayDereferencing = new NewFunctionArrayDereferencingSniff();
98
+ }
99
+
100
+
101
+ /**
102
+ * Returns an array of tokens this test wants to listen for.
103
+ *
104
+ * @since 9.3.0
105
+ *
106
+ * @return array
107
+ */
108
+ public function register()
109
+ {
110
+ $targets = array(
111
+ array(
112
+ \T_VARIABLE,
113
+ \T_STRING, // Constants.
114
+ ),
115
+ );
116
+
117
+ // Registers T_ARRAY, T_OPEN_SHORT_ARRAY and T_CONSTANT_ENCAPSED_STRING.
118
+ $additionalTargets = $this->newArrayStringDereferencing->register();
119
+ $this->newArrayStringDereferencingTargets = array_flip($additionalTargets);
120
+ $targets[] = $additionalTargets;
121
+
122
+ // Registers T_NEW and T_CLONE.
123
+ $additionalTargets = $this->newClassMemberAccess->register();
124
+ $this->newClassMemberAccessTargets = array_flip($additionalTargets);
125
+ $targets[] = $additionalTargets;
126
+
127
+ // Registers T_STRING.
128
+ $additionalTargets = $this->newFunctionArrayDereferencing->register();
129
+ $this->newFunctionArrayDereferencingTargets = array_flip($additionalTargets);
130
+ $targets[] = $additionalTargets;
131
+
132
+ return call_user_func_array('array_merge', $targets);
133
+ }
134
+
135
+
136
+ /**
137
+ * Processes this test, when one of its tokens is encountered.
138
+ *
139
+ * @since 9.3.0
140
+ *
141
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
142
+ * @param int $stackPtr The position of the current token in
143
+ * the stack passed in $tokens.
144
+ *
145
+ * @return void
146
+ */
147
+ public function process(File $phpcsFile, $stackPtr)
148
+ {
149
+ if ($this->supportsAbove('7.4') === false) {
150
+ return;
151
+ }
152
+
153
+ $tokens = $phpcsFile->getTokens();
154
+ $braces = array();
155
+
156
+ // Note: Overwriting braces in each `if` is fine as only one will match anyway.
157
+ if ($tokens[$stackPtr]['code'] === \T_VARIABLE) {
158
+ $braces = $this->isVariableArrayAccess($phpcsFile, $stackPtr);
159
+ }
160
+
161
+ if (isset($this->newArrayStringDereferencingTargets[$tokens[$stackPtr]['code']])) {
162
+ $dereferencing = $this->newArrayStringDereferencing->isArrayStringDereferencing($phpcsFile, $stackPtr);
163
+ if (isset($dereferencing['braces'])) {
164
+ $braces = $dereferencing['braces'];
165
+ }
166
+ }
167
+
168
+ if (isset($this->newClassMemberAccessTargets[$tokens[$stackPtr]['code']])) {
169
+ $braces = $this->newClassMemberAccess->isClassMemberAccess($phpcsFile, $stackPtr);
170
+ }
171
+
172
+ if (isset($this->newFunctionArrayDereferencingTargets[$tokens[$stackPtr]['code']])) {
173
+ $braces = $this->newFunctionArrayDereferencing->isFunctionArrayDereferencing($phpcsFile, $stackPtr);
174
+ }
175
+
176
+ if (empty($braces) && $tokens[$stackPtr]['code'] === \T_STRING) {
177
+ $braces = $this->isConstantArrayAccess($phpcsFile, $stackPtr);
178
+ }
179
+
180
+ if (empty($braces)) {
181
+ return;
182
+ }
183
+
184
+ foreach ($braces as $open => $close) {
185
+ // Some of the functions will sniff for both curlies as well as square braces.
186
+ if ($tokens[$open]['code'] !== \T_OPEN_CURLY_BRACKET) {
187
+ continue;
188
+ }
189
+
190
+ // Make sure there is something between the braces, otherwise it's still not curly brace array access.
191
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($open + 1), $close, true);
192
+ if ($nextNonEmpty === false) {
193
+ // Nothing between the brackets. Parse error. Ignore.
194
+ continue;
195
+ }
196
+
197
+ // OK, so we've found curly brace array access.
198
+ $snippet = $phpcsFile->getTokensAsString($stackPtr, (($close - $stackPtr) + 1));
199
+ $fix = $phpcsFile->addFixableWarning(
200
+ 'Curly brace syntax for accessing array elements and string offsets has been deprecated in PHP 7.4. Found: %s',
201
+ $open,
202
+ 'Found',
203
+ array($snippet)
204
+ );
205
+
206
+ if ($fix === true) {
207
+ $phpcsFile->fixer->beginChangeset();
208
+ $phpcsFile->fixer->replaceToken($open, '[');
209
+ $phpcsFile->fixer->replaceToken($close, ']');
210
+ $phpcsFile->fixer->endChangeset();
211
+ }
212
+ }
213
+ }
214
+
215
+
216
+ /**
217
+ * Determine whether a variable is being dereferenced using curly brace syntax.
218
+ *
219
+ * @since 9.3.0
220
+ *
221
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
222
+ * @param int $stackPtr The position of the current token in
223
+ * the stack passed in $tokens.
224
+ *
225
+ * @return array An array with the stack pointers to the open/close braces of
226
+ * the curly brace array access, or an empty array if no curly
227
+ * brace array access was detected.
228
+ */
229
+ protected function isVariableArrayAccess(File $phpcsFile, $stackPtr)
230
+ {
231
+ $tokens = $phpcsFile->getTokens();
232
+ $current = $stackPtr;
233
+ $braces = array();
234
+
235
+ do {
236
+ $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true);
237
+ if ($current === false) {
238
+ break;
239
+ }
240
+
241
+ // Skip over square bracket array access. Bracket styles can be mixed.
242
+ if ($tokens[$current]['code'] === \T_OPEN_SQUARE_BRACKET
243
+ && isset($tokens[$current]['bracket_closer']) === true
244
+ && $current === $tokens[$current]['bracket_opener']
245
+ ) {
246
+ $current = $tokens[$current]['bracket_closer'];
247
+ continue;
248
+ }
249
+
250
+ // Handle property access.
251
+ if ($tokens[$current]['code'] === \T_OBJECT_OPERATOR) {
252
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true);
253
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== \T_STRING) {
254
+ // Live coding or parse error.
255
+ break;
256
+ }
257
+
258
+ $current = $nextNonEmpty;
259
+ continue;
260
+ }
261
+
262
+ if ($tokens[$current]['code'] === \T_OPEN_CURLY_BRACKET) {
263
+ if (isset($tokens[$current]['bracket_closer']) === false) {
264
+ // Live coding or parse error.
265
+ break;
266
+ }
267
+
268
+ $braces[$current] = $tokens[$current]['bracket_closer'];
269
+
270
+ // Continue, just in case there is nested access using curly braces, i.e. `$a{$i}{$j};`.
271
+ $current = $tokens[$current]['bracket_closer'];
272
+ continue;
273
+ }
274
+
275
+ // If we're still here, we've reached the end of the variable.
276
+ break;
277
+
278
+ } while (true);
279
+
280
+ return $braces;
281
+ }
282
+
283
+
284
+ /**
285
+ * Determine whether a T_STRING is a constant being dereferenced using curly brace syntax.
286
+ *
287
+ * {@internal Note: the first braces for array access to a constant, for some unknown reason,
288
+ * can never be curlies, but have to be square brackets.
289
+ * Subsequent braces can be curlies.}
290
+ *
291
+ * @since 9.3.0
292
+ *
293
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
294
+ * @param int $stackPtr The position of the current token in
295
+ * the stack passed in $tokens.
296
+ *
297
+ * @return array An array with the stack pointers to the open/close braces of
298
+ * the curly brace array access, or an empty array if no curly
299
+ * brace array access was detected.
300
+ */
301
+ protected function isConstantArrayAccess(File $phpcsFile, $stackPtr)
302
+ {
303
+ $tokens = $phpcsFile->getTokens();
304
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
305
+
306
+ if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false
307
+ && $tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON // Class constant access.
308
+ ) {
309
+ return array();
310
+ }
311
+
312
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
313
+ if ($nextNonEmpty === false) {
314
+ return array();
315
+ }
316
+
317
+ if ($tokens[$nextNonEmpty]['code'] !== \T_OPEN_SQUARE_BRACKET
318
+ || isset($tokens[$nextNonEmpty]['bracket_closer']) === false
319
+ ) {
320
+ // Array access for constants must start with square brackets.
321
+ return array();
322
+ }
323
+
324
+ $current = $tokens[$nextNonEmpty]['bracket_closer'];
325
+ $braces = array();
326
+
327
+ do {
328
+ $current = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), null, true);
329
+ if ($current === false) {
330
+ break;
331
+ }
332
+
333
+ // Skip over square bracket array access. Bracket styles can be mixed.
334
+ if ($tokens[$current]['code'] === \T_OPEN_SQUARE_BRACKET
335
+ && isset($tokens[$current]['bracket_closer']) === true
336
+ && $current === $tokens[$current]['bracket_opener']
337
+ ) {
338
+ $current = $tokens[$current]['bracket_closer'];
339
+ continue;
340
+ }
341
+
342
+ if ($tokens[$current]['code'] === \T_OPEN_CURLY_BRACKET) {
343
+ if (isset($tokens[$current]['bracket_closer']) === false) {
344
+ // Live coding or parse error.
345
+ break;
346
+ }
347
+
348
+ $braces[$current] = $tokens[$current]['bracket_closer'];
349
+
350
+ // Continue, just in case there is nested access using curly braces, i.e. `$a{$i}{$j};`.
351
+ $current = $tokens[$current]['bracket_closer'];
352
+ continue;
353
+ }
354
+
355
+ // If we're still here, we've reached the end of the variable.
356
+ break;
357
+
358
+ } while (true);
359
+
360
+ return $braces;
361
+ }
362
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php CHANGED
@@ -1,13 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Syntax\RemovedNewReferenceSniff.
4
  *
5
- * PHP version 5.4
6
- *
7
- * @category PHP
8
  * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
- * @copyright 2012 Cu.be Solutions bvba
 
11
  */
12
 
13
  namespace PHPCompatibility\Sniffs\Syntax;
@@ -17,16 +15,17 @@ use PHP_CodeSniffer_File as File;
17
  use PHP_CodeSniffer_Tokens as Tokens;
18
 
19
  /**
20
- * \PHPCompatibility\Sniffs\Syntax\RemovedNewReferenceSniff.
21
  *
22
- * Discourages the use of assigning the return value of new by reference
23
  *
24
- * PHP version 5.4
 
25
  *
26
- * @category PHP
27
- * @package PHPCompatibility
28
- * @author Wim Godden <wim.godden@cu.be>
29
- * @copyright 2012 Cu.be Solutions bvba
30
  */
31
  class RemovedNewReferenceSniff extends Sniff
32
  {
@@ -34,6 +33,8 @@ class RemovedNewReferenceSniff extends Sniff
34
  /**
35
  * Returns an array of tokens this test wants to listen for.
36
  *
 
 
37
  * @return array
38
  */
39
  public function register()
@@ -44,6 +45,8 @@ class RemovedNewReferenceSniff extends Sniff
44
  /**
45
  * Processes this test, when one of its tokens is encountered.
46
  *
 
 
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token in the
49
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
 
 
 
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Syntax;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect the use of assigning the return value of `new` by reference.
19
  *
20
+ * This syntax has been deprecated since PHP 5.3 and removed in PHP 7.0.
21
  *
22
+ * PHP version 5.3
23
+ * PHP version 7.0
24
  *
25
+ * @link https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
26
+ *
27
+ * @since 5.5
28
+ * @since 9.0.0 Renamed from `DeprecatedNewReferenceSniff` to `RemovedNewReferenceSniff`.
29
  */
30
  class RemovedNewReferenceSniff extends Sniff
31
  {
33
  /**
34
  * Returns an array of tokens this test wants to listen for.
35
  *
36
+ * @since 5.5
37
+ *
38
  * @return array
39
  */
40
  public function register()
45
  /**
46
  * Processes this test, when one of its tokens is encountered.
47
  *
48
+ * @since 5.5
49
+ *
50
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
51
  * @param int $stackPtr The position of the current token in the
52
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TextStrings/NewUnicodeEscapeSequenceSniff.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\TextStrings;
12
+
13
+ use PHPCompatibility\Sniff;
14
+ use PHP_CodeSniffer_Exception as PHPCS_Exception;
15
+ use PHP_CodeSniffer_File as File;
16
+
17
+ /**
18
+ * PHP 7.0 introduced a Unicode codepoint escape sequence.
19
+ *
20
+ * Strings containing a literal `\u{` followed by an invalid sequence will cause a
21
+ * fatal error as of PHP 7.0.
22
+ *
23
+ * PHP version 7.0
24
+ *
25
+ * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.unicode-codepoint-escape-syntax
26
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.strings.unicode-escapes
27
+ * @link https://wiki.php.net/rfc/unicode_escape
28
+ * @link https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double
29
+ *
30
+ * @since 9.3.0
31
+ */
32
+ class NewUnicodeEscapeSequenceSniff extends Sniff
33
+ {
34
+
35
+ /**
36
+ * Returns an array of tokens this test wants to listen for.
37
+ *
38
+ * @since 9.3.0
39
+ *
40
+ * @return array
41
+ */
42
+ public function register()
43
+ {
44
+ return array(
45
+ \T_CONSTANT_ENCAPSED_STRING,
46
+ \T_DOUBLE_QUOTED_STRING,
47
+ \T_HEREDOC,
48
+ );
49
+ }
50
+
51
+
52
+ /**
53
+ * Processes this test, when one of its tokens is encountered.
54
+ *
55
+ * @since 9.3.0
56
+ *
57
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
58
+ * @param int $stackPtr The position of the current token in
59
+ * the stack passed in $tokens.
60
+ *
61
+ * @return void
62
+ */
63
+ public function process(File $phpcsFile, $stackPtr)
64
+ {
65
+ $tokens = $phpcsFile->getTokens();
66
+
67
+ // Check whether this is a single quoted or double quoted string.
68
+ if ($tokens[$stackPtr]['code'] === \T_CONSTANT_ENCAPSED_STRING) {
69
+
70
+ // Find the start of the - potentially multi-line - text string.
71
+ $start = $stackPtr;
72
+ for ($i = ($stackPtr - 1); $i >= 0; $i--) {
73
+ if ($tokens[$i]['code'] === \T_WHITESPACE) {
74
+ continue;
75
+ }
76
+
77
+ if ($tokens[$i]['code'] === \T_CONSTANT_ENCAPSED_STRING) {
78
+ $start = $i;
79
+ continue;
80
+ }
81
+
82
+ break;
83
+ }
84
+
85
+ try {
86
+ $textString = $this->getCompleteTextString($phpcsFile, $start, false);
87
+ } catch (PHPCS_Exception $e) {
88
+ // Something went wrong determining the start of the text string.
89
+ return;
90
+ }
91
+
92
+ $startQuote = $textString[0];
93
+ $endQuote = substr($textString, -1);
94
+ if (($startQuote === "'" && $endQuote === "'")
95
+ || $startQuote !== $endQuote
96
+ ) {
97
+ // Single quoted string, not our concern.
98
+ return;
99
+ }
100
+ }
101
+
102
+ $content = $this->stripQuotes($tokens[$stackPtr]['content']);
103
+ $count = preg_match_all('`(?<!\\\\)\\\\u\{([^}\n\r]*)(\})?`', $content, $matches, \PREG_SET_ORDER);
104
+ if ($count === false || $count === 0) {
105
+ return;
106
+ }
107
+
108
+ foreach ($matches as $match) {
109
+ $valid = false; // If the close curly is missing, we have an incomplete escape sequence.
110
+ if (isset($match[2])) {
111
+ $valid = $this->isValidUnicodeEscapeSequence($match[1]);
112
+ }
113
+
114
+ if ($this->supportsBelow('5.6') === true && $valid === true) {
115
+ $phpcsFile->addError(
116
+ 'Unicode codepoint escape sequences are not supported in PHP 5.6 or earlier. Found: %s',
117
+ $stackPtr,
118
+ 'Found',
119
+ array($match[0])
120
+ );
121
+ }
122
+
123
+ if ($this->supportsAbove('7.0') === true && $valid === false) {
124
+ $phpcsFile->addError(
125
+ 'Strings containing a literal \u{ followed by an invalid unicode codepoint escape sequence will cause a fatal error in PHP 7.0 and above. Escape the leading backslash to prevent this. Found: %s',
126
+ $stackPtr,
127
+ 'Invalid',
128
+ array($match[0])
129
+ );
130
+ }
131
+ }
132
+ }
133
+
134
+
135
+ /**
136
+ * Verify if the codepoint in a unicode escape sequence is valid.
137
+ *
138
+ * @since 9.3.0
139
+ *
140
+ * @param string $codepoint The codepoint as a string.
141
+ *
142
+ * @return bool
143
+ */
144
+ protected function isValidUnicodeEscapeSequence($codepoint)
145
+ {
146
+ if (trim($codepoint) === '') {
147
+ return false;
148
+ }
149
+
150
+ // Check if it's a valid hex codepoint.
151
+ if (preg_match('`^[0-9A-F]+$`iD', $codepoint, $match) !== 1) {
152
+ return false;
153
+ }
154
+
155
+ if (hexdec($codepoint) > 1114111) {
156
+ // Outside of the maximum permissable range.
157
+ return false;
158
+ }
159
+
160
+ return true;
161
+ }
162
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\TypeCasts\NewTypeCastsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\TypeCasts;
@@ -14,11 +15,13 @@ use PHPCompatibility\PHPCSHelper;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
- * \PHPCompatibility\Sniffs\TypeCasts\NewTypeCastsSniff.
18
  *
19
- * @category PHP
20
- * @package PHPCompatibility
21
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
22
  */
23
  class NewTypeCastsSniff extends AbstractNewFeatureSniff
24
  {
@@ -29,7 +32,9 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
29
  * The array lists : version number with false (not present) or true (present).
30
  * If's sufficient to list the first version where the keyword appears.
31
  *
32
- * @var array(string => array(string => int|string|null))
 
 
33
  */
34
  protected $newTypeCasts = array(
35
  'T_UNSET_CAST' => array(
@@ -48,6 +53,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
48
  /**
49
  * Returns an array of tokens this test wants to listen for.
50
  *
 
 
51
  * @return array
52
  */
53
  public function register()
@@ -80,6 +87,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
80
  /**
81
  * Processes this test, when one of its tokens is encountered.
82
  *
 
 
83
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
84
  * @param int $stackPtr The position of the current token in
85
  * the stack passed in $tokens.
@@ -132,6 +141,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
132
  /**
133
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
134
  *
 
 
135
  * @param array $itemInfo Base information about the item.
136
  *
137
  * @return array Version and other information about the item.
@@ -145,6 +156,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
145
  /**
146
  * Get an array of the non-PHP-version array keys used in a sub-array.
147
  *
 
 
148
  * @return array
149
  */
150
  protected function getNonVersionArrayKeys()
@@ -156,6 +169,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
156
  /**
157
  * Retrieve the relevant detail (version) information for use in an error message.
158
  *
 
 
159
  * @param array $itemArray Version and other information about the item.
160
  * @param array $itemInfo Base information about the item.
161
  *
@@ -173,6 +188,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
173
  /**
174
  * Filter the error message before it's passed to PHPCS.
175
  *
 
 
176
  * @param string $error The error message which was created.
177
  * @param array $itemInfo Base information about the item this error message applies to.
178
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -188,6 +205,8 @@ class NewTypeCastsSniff extends AbstractNewFeatureSniff
188
  /**
189
  * Filter the error data before it's passed to PHPCS.
190
  *
 
 
191
  * @param array $data The error data array which was created.
192
  * @param array $itemInfo Base information about the item this error message applies to.
193
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\TypeCasts;
15
  use PHP_CodeSniffer_File as File;
16
 
17
  /**
18
+ * Detect use of newly introduced type casts.
19
  *
20
+ * PHP version All
21
+ *
22
+ * @link https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting
23
+ *
24
+ * @since 8.0.1
25
  */
26
  class NewTypeCastsSniff extends AbstractNewFeatureSniff
27
  {
32
  * The array lists : version number with false (not present) or true (present).
33
  * If's sufficient to list the first version where the keyword appears.
34
  *
35
+ * @since 8.0.1
36
+ *
37
+ * @var array(string => array(string => bool|string))
38
  */
39
  protected $newTypeCasts = array(
40
  'T_UNSET_CAST' => array(
53
  /**
54
  * Returns an array of tokens this test wants to listen for.
55
  *
56
+ * @since 8.0.1
57
+ *
58
  * @return array
59
  */
60
  public function register()
87
  /**
88
  * Processes this test, when one of its tokens is encountered.
89
  *
90
+ * @since 8.0.1
91
+ *
92
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
93
  * @param int $stackPtr The position of the current token in
94
  * the stack passed in $tokens.
141
  /**
142
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
143
  *
144
+ * @since 8.0.1
145
+ *
146
  * @param array $itemInfo Base information about the item.
147
  *
148
  * @return array Version and other information about the item.
156
  /**
157
  * Get an array of the non-PHP-version array keys used in a sub-array.
158
  *
159
+ * @since 8.0.1
160
+ *
161
  * @return array
162
  */
163
  protected function getNonVersionArrayKeys()
169
  /**
170
  * Retrieve the relevant detail (version) information for use in an error message.
171
  *
172
+ * @since 8.0.1
173
+ *
174
  * @param array $itemArray Version and other information about the item.
175
  * @param array $itemInfo Base information about the item.
176
  *
188
  /**
189
  * Filter the error message before it's passed to PHPCS.
190
  *
191
+ * @since 8.0.1
192
+ *
193
  * @param string $error The error message which was created.
194
  * @param array $itemInfo Base information about the item this error message applies to.
195
  * @param array $errorInfo Detail information about an item this error message applies to.
205
  /**
206
  * Filter the error data before it's passed to PHPCS.
207
  *
208
+ * @since 8.0.1
209
+ *
210
  * @param array $data The error data array which was created.
211
  * @param array $itemInfo Base information about the item this error message applies to.
212
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/TypeCasts/RemovedTypeCastsSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\TypeCasts\RemovedTypeCastsSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\TypeCasts;
@@ -13,11 +14,16 @@ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
  use PHP_CodeSniffer_File as File;
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\TypeCasts\RemovedTypeCastsSniff.
17
  *
18
- * @category PHP
19
- * @package PHPCompatibility
20
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
 
 
 
21
  */
22
  class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
23
  {
@@ -27,7 +33,9 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
27
  * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
28
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
29
  *
30
- * @var array(string => array(string => bool|string|null))
 
 
31
  */
32
  protected $deprecatedTypeCasts = array(
33
  'T_UNSET_CAST' => array(
@@ -35,12 +43,19 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
35
  'alternative' => 'unset()',
36
  'description' => 'unset',
37
  ),
 
 
 
 
 
38
  );
39
 
40
 
41
  /**
42
  * Returns an array of tokens this test wants to listen for.
43
  *
 
 
44
  * @return array
45
  */
46
  public function register()
@@ -57,6 +72,8 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
57
  /**
58
  * Processes this test, when one of its tokens is encountered.
59
  *
 
 
60
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
61
  * @param int $stackPtr The position of the current token in
62
  * the stack passed in $tokens.
@@ -68,6 +85,12 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
68
  $tokens = $phpcsFile->getTokens();
69
  $tokenType = $tokens[$stackPtr]['type'];
70
 
 
 
 
 
 
 
71
  $itemInfo = array(
72
  'name' => $tokenType,
73
  'description' => $this->deprecatedTypeCasts[$tokenType]['description'],
@@ -79,6 +102,8 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
79
  /**
80
  * Get an array of the non-PHP-version array keys used in a sub-array.
81
  *
 
 
82
  * @return array
83
  */
84
  protected function getNonVersionArrayKeys()
@@ -89,6 +114,8 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
89
  /**
90
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
91
  *
 
 
92
  * @param array $itemInfo Base information about the item.
93
  *
94
  * @return array Version and other information about the item.
@@ -102,6 +129,8 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
102
  /**
103
  * Get the error message template for this sniff.
104
  *
 
 
105
  * @return string
106
  */
107
  protected function getErrorMsgTemplate()
@@ -113,6 +142,8 @@ class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
113
  /**
114
  * Filter the error data before it's passed to PHPCS.
115
  *
 
 
116
  * @param array $data The error data array which was created.
117
  * @param array $itemInfo Base information about the item this error message applies to.
118
  * @param array $errorInfo Detail information about an item this error message applies to.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\TypeCasts;
14
  use PHP_CodeSniffer_File as File;
15
 
16
  /**
17
+ * Detect use of deprecated/removed type casts.
18
  *
19
+ * PHP version All
20
+ *
21
+ * @link https://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting
22
+ * @link https://wiki.php.net/rfc/deprecations_php_7_2#unset_cast
23
+ * @link https://wiki.php.net/rfc/deprecations_php_7_4#the_real_type
24
+ *
25
+ * @since 8.0.1
26
+ * @since 9.0.0 Renamed from `DeprecatedTypeCastsSniff` to `RemovedTypeCastsSniff`.
27
  */
28
  class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff
29
  {
33
  * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
34
  * If no alternative exists, it is NULL, i.e, the function should just not be used.
35
  *
36
+ * @since 8.0.1
37
+ *
38
+ * @var array(string => array(string => bool|string))
39
  */
40
  protected $deprecatedTypeCasts = array(
41
  'T_UNSET_CAST' => array(
43
  'alternative' => 'unset()',
44
  'description' => 'unset',
45
  ),
46
+ 'T_DOUBLE_CAST' => array(
47
+ '7.4' => false,
48
+ 'alternative' => '(float)',
49
+ 'description' => 'real',
50
+ ),
51
  );
52
 
53
 
54
  /**
55
  * Returns an array of tokens this test wants to listen for.
56
  *
57
+ * @since 8.0.1
58
+ *
59
  * @return array
60
  */
61
  public function register()
72
  /**
73
  * Processes this test, when one of its tokens is encountered.
74
  *
75
+ * @since 8.0.1
76
+ *
77
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
78
  * @param int $stackPtr The position of the current token in
79
  * the stack passed in $tokens.
85
  $tokens = $phpcsFile->getTokens();
86
  $tokenType = $tokens[$stackPtr]['type'];
87
 
88
+ // Special case `T_DOUBLE_CAST` as the same token is used for (float) and (double) casts.
89
+ if ($tokenType === 'T_DOUBLE_CAST' && strpos($tokens[$stackPtr]['content'], 'real') === false) {
90
+ // Float/double casts, not (real) cast.
91
+ return;
92
+ }
93
+
94
  $itemInfo = array(
95
  'name' => $tokenType,
96
  'description' => $this->deprecatedTypeCasts[$tokenType]['description'],
102
  /**
103
  * Get an array of the non-PHP-version array keys used in a sub-array.
104
  *
105
+ * @since 8.0.1
106
+ *
107
  * @return array
108
  */
109
  protected function getNonVersionArrayKeys()
114
  /**
115
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
116
  *
117
+ * @since 8.0.1
118
+ *
119
  * @param array $itemInfo Base information about the item.
120
  *
121
  * @return array Version and other information about the item.
129
  /**
130
  * Get the error message template for this sniff.
131
  *
132
+ * @since 8.0.1
133
+ *
134
  * @return string
135
  */
136
  protected function getErrorMsgTemplate()
142
  /**
143
  * Filter the error data before it's passed to PHPCS.
144
  *
145
+ * @since 8.0.1
146
+ *
147
  * @param array $data The error data array which was created.
148
  * @param array $itemInfo Base information about the item this error message applies to.
149
  * @param array $errorInfo Detail information about an item this error message applies to.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php CHANGED
@@ -1,24 +1,24 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Upgrade\LowPHPCSSniff.
4
  *
5
- * @category Upgrade
6
- * @package PHPCompatibility
7
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Upgrade;
11
 
12
  use PHPCompatibility\Sniff;
13
  use PHPCompatibility\PHPCSHelper;
 
14
 
15
  /**
16
- * \PHPCompatibility\Sniffs\Upgrade\LowPHPCSSniff.
17
- *
18
  * Add a notification for users of low PHPCS versions.
19
  *
20
- * Originally PHPCompatibility supported PHPCS 1.5.x, 2.x, 3.x.
21
- * Support for PHPCS <2.3.0 will be dropped in PHPCompatibility 9.0.0.
22
  *
23
  * The standard will - up to a point - still work for users of lower
24
  * PHPCS versions, but will give less accurate results and may throw
@@ -27,9 +27,10 @@ use PHPCompatibility\PHPCSHelper;
27
  * This sniff adds an explicit error/warning for users of the standard
28
  * using a PHPCS version below the recommended version.
29
  *
30
- * @category Upgrade
31
- * @package PHPCompatibility
32
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
33
  */
34
  class LowPHPCSSniff extends Sniff
35
  {
@@ -38,18 +39,24 @@ class LowPHPCSSniff extends Sniff
38
  *
39
  * Users on PHPCS versions below this will see an ERROR message.
40
  *
 
 
 
41
  * @var string
42
  */
43
- protected $minSupportedVersion = '1.5.6';
44
 
45
  /**
46
  * The minimum recommended PHPCS version.
47
  *
48
  * Users on PHPCS versions below this will see a WARNING.
49
  *
 
 
 
50
  * @var string
51
  */
52
- protected $minRecommendedVersion = '2.6.0';
53
 
54
  /**
55
  * Keep track of whether this sniff needs to actually run.
@@ -58,6 +65,8 @@ class LowPHPCSSniff extends Sniff
58
  * version is detected or once the error/warning has been thrown,
59
  * to make sure that the notice will only be thrown once per run.
60
  *
 
 
61
  * @var bool
62
  */
63
  private $examine = true;
@@ -66,25 +75,30 @@ class LowPHPCSSniff extends Sniff
66
  /**
67
  * Returns an array of tokens this test wants to listen for.
68
  *
 
 
69
  * @return array
70
  */
71
  public function register()
72
  {
73
  return array(
74
- T_OPEN_TAG,
75
  );
76
  }
77
 
78
  /**
79
  * Processes this test, when one of its tokens is encountered.
80
  *
 
 
81
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
82
  * @param int $stackPtr The position of the current token in the
83
  * stack passed in $tokens.
84
  *
85
- * @return void
 
86
  */
87
- public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
88
  {
89
  // Don't do anything if the warning has already been thrown or is not necessary.
90
  if ($this->examine === false) {
@@ -94,29 +108,29 @@ class LowPHPCSSniff extends Sniff
94
  $phpcsVersion = PHPCSHelper::getVersion();
95
 
96
  // Don't do anything if the PHPCS version used is above the minimum recommended version.
97
- if (version_compare($phpcsVersion, $this->minRecommendedVersion, '>=')) {
98
  $this->examine = false;
99
  return ($phpcsFile->numTokens + 1);
100
  }
101
 
102
- if (version_compare($phpcsVersion, $this->minSupportedVersion, '<')) {
103
  $isError = true;
104
- $message = "IMPORTANT: Please be advised that the minimum PHP_CodeSniffer version the PHPCompatibility standard supports is %s. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation. The recommended version of PHP_CodeSniffer for PHPCompatibility is %s or higher.";
105
- $errorCode = 'Unsupported_' . $this->stringToErrorCode($this->minSupportedVersion);
106
  $replacements = array(
107
- $this->minSupportedVersion,
108
  $phpcsVersion,
109
- $this->minRecommendedVersion,
110
  $errorCode,
111
  );
112
  } else {
113
  $isError = false;
114
- $message = "IMPORTANT: Please be advised that for the most reliable PHPCompatibility results, PHP_CodeSniffer %s or higher should be used. Support for lower versions will be dropped in the foreseeable future. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation to version %s or higher.";
115
- $errorCode = 'BelowRecommended_' . $this->stringToErrorCode($this->minRecommendedVersion);
116
  $replacements = array(
117
- $this->minRecommendedVersion,
118
  $phpcsVersion,
119
- $this->minRecommendedVersion,
120
  $errorCode,
121
  );
122
  }
@@ -145,11 +159,14 @@ class LowPHPCSSniff extends Sniff
145
  * it should be. A patch for that is included in the same upstream PR.
146
  *
147
  * If/when the upstream PR has been merged and the minimum supported/recommended version
148
- * of PHPCompatibility would go beyond that, the below code should be adjusted.}}
149
  */
150
  $reportWidth = PHPCSHelper::getCommandLineData($phpcsFile, 'reportWidth');
 
 
 
151
  $showSources = PHPCSHelper::getCommandLineData($phpcsFile, 'showSources');
152
- if ($showSources === true && version_compare($phpcsVersion, '2.3.0', '>=')) {
153
  $reportWidth += 6;
154
  }
155
 
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Upgrade;
12
 
13
  use PHPCompatibility\Sniff;
14
  use PHPCompatibility\PHPCSHelper;
15
+ use PHP_CodeSniffer_File as File;
16
 
17
  /**
 
 
18
  * Add a notification for users of low PHPCS versions.
19
  *
20
+ * Originally PHPCompatibility supported PHPCS 1.5.x, 2.x and since PHPCompatibility 8.0.0, 3.x.
21
+ * Support for PHPCS < 2.3.0 has been dropped in PHPCompatibility 9.0.0.
22
  *
23
  * The standard will - up to a point - still work for users of lower
24
  * PHPCS versions, but will give less accurate results and may throw
27
  * This sniff adds an explicit error/warning for users of the standard
28
  * using a PHPCS version below the recommended version.
29
  *
30
+ * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/688
31
+ * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/835
32
+ *
33
+ * @since 8.2.0
34
  */
35
  class LowPHPCSSniff extends Sniff
36
  {
39
  *
40
  * Users on PHPCS versions below this will see an ERROR message.
41
  *
42
+ * @since 8.2.0
43
+ * @since 9.3.0 Changed from $minSupportedVersion property to a constant.
44
+ *
45
  * @var string
46
  */
47
+ const MIN_SUPPORTED_VERSION = '2.3.0';
48
 
49
  /**
50
  * The minimum recommended PHPCS version.
51
  *
52
  * Users on PHPCS versions below this will see a WARNING.
53
  *
54
+ * @since 8.2.0
55
+ * @since 9.3.0 Changed from $minRecommendedVersion property to a constant.
56
+ *
57
  * @var string
58
  */
59
+ const MIN_RECOMMENDED_VERSION = '2.6.0';
60
 
61
  /**
62
  * Keep track of whether this sniff needs to actually run.
65
  * version is detected or once the error/warning has been thrown,
66
  * to make sure that the notice will only be thrown once per run.
67
  *
68
+ * @since 8.2.0
69
+ *
70
  * @var bool
71
  */
72
  private $examine = true;
75
  /**
76
  * Returns an array of tokens this test wants to listen for.
77
  *
78
+ * @since 8.2.0
79
+ *
80
  * @return array
81
  */
82
  public function register()
83
  {
84
  return array(
85
+ \T_OPEN_TAG,
86
  );
87
  }
88
 
89
  /**
90
  * Processes this test, when one of its tokens is encountered.
91
  *
92
+ * @since 8.2.0
93
+ *
94
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
95
  * @param int $stackPtr The position of the current token in the
96
  * stack passed in $tokens.
97
  *
98
+ * @return int|void Integer stack pointer to skip forward or void to continue
99
+ * normal file processing.
100
  */
101
+ public function process(File $phpcsFile, $stackPtr)
102
  {
103
  // Don't do anything if the warning has already been thrown or is not necessary.
104
  if ($this->examine === false) {
108
  $phpcsVersion = PHPCSHelper::getVersion();
109
 
110
  // Don't do anything if the PHPCS version used is above the minimum recommended version.
111
+ if (version_compare($phpcsVersion, self::MIN_RECOMMENDED_VERSION, '>=')) {
112
  $this->examine = false;
113
  return ($phpcsFile->numTokens + 1);
114
  }
115
 
116
+ if (version_compare($phpcsVersion, self::MIN_SUPPORTED_VERSION, '<')) {
117
  $isError = true;
118
+ $message = 'IMPORTANT: Please be advised that the minimum PHP_CodeSniffer version the PHPCompatibility standard supports is %s. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation. The recommended version of PHP_CodeSniffer for PHPCompatibility is %s or higher.';
119
+ $errorCode = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION);
120
  $replacements = array(
121
+ self::MIN_SUPPORTED_VERSION,
122
  $phpcsVersion,
123
+ self::MIN_RECOMMENDED_VERSION,
124
  $errorCode,
125
  );
126
  } else {
127
  $isError = false;
128
+ $message = 'IMPORTANT: Please be advised that for the most reliable PHPCompatibility results, PHP_CodeSniffer %s or higher should be used. Support for lower versions will be dropped in the foreseeable future. You are currently using PHP_CodeSniffer %s. Please upgrade your PHP_CodeSniffer installation to version %s or higher.';
129
+ $errorCode = 'BelowRecommended_' . $this->stringToErrorCode(self::MIN_RECOMMENDED_VERSION);
130
  $replacements = array(
131
+ self::MIN_RECOMMENDED_VERSION,
132
  $phpcsVersion,
133
+ self::MIN_RECOMMENDED_VERSION,
134
  $errorCode,
135
  );
136
  }
159
  * it should be. A patch for that is included in the same upstream PR.
160
  *
161
  * If/when the upstream PR has been merged and the minimum supported/recommended version
162
+ * of PHPCompatibility would go beyond that, the below code should be adjusted.}
163
  */
164
  $reportWidth = PHPCSHelper::getCommandLineData($phpcsFile, 'reportWidth');
165
+ if (empty($reportWidth)) {
166
+ $reportWidth = 80;
167
+ }
168
  $showSources = PHPCSHelper::getCommandLineData($phpcsFile, 'showSources');
169
+ if ($showSources === true) {
170
  $reportWidth += 6;
171
  }
172
 
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPSniff.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
+ */
10
+
11
+ namespace PHPCompatibility\Sniffs\Upgrade;
12
+
13
+ use PHPCompatibility\Sniff;
14
+ use PHPCompatibility\PHPCSHelper;
15
+ use PHP_CodeSniffer_File as File;
16
+
17
+ /**
18
+ * Add a notification for users of low PHP versions.
19
+ *
20
+ * Originally PHPCompatibility supported PHP 5.1 and higher.
21
+ * As of PHPCompatibility 8.0.0, support for PHP < 5.3 has been dropped.
22
+ *
23
+ * The intention is to drop support for PHP 5.3 in the (near) future.
24
+ *
25
+ * This sniff adds an explicit error/warning for users of the standard
26
+ * using a PHP version below the recommended version.
27
+ *
28
+ * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/835
29
+ *
30
+ * @since 9.3.0
31
+ */
32
+ class LowPHPSniff extends Sniff
33
+ {
34
+ /**
35
+ * The minimum supported PHP version.
36
+ *
37
+ * Users on PHP versions below this will see an ERROR message.
38
+ *
39
+ * @since 9.3.0
40
+ *
41
+ * @var string
42
+ */
43
+ const MIN_SUPPORTED_VERSION = '5.3';
44
+
45
+ /**
46
+ * The minimum recommended PHP version.
47
+ *
48
+ * Users on PHP versions below this will see a WARNING.
49
+ *
50
+ * @since 9.3.0
51
+ *
52
+ * @var string
53
+ */
54
+ const MIN_RECOMMENDED_VERSION = '5.4';
55
+
56
+ /**
57
+ * Keep track of whether this sniff needs to actually run.
58
+ *
59
+ * This will be set to `false` when either a high enough PHP
60
+ * version is detected or once the error/warning has been thrown,
61
+ * to make sure that the notice will only be thrown once per run.
62
+ *
63
+ * @since 9.3.0
64
+ *
65
+ * @var bool
66
+ */
67
+ private $examine = true;
68
+
69
+
70
+ /**
71
+ * Returns an array of tokens this test wants to listen for.
72
+ *
73
+ * @since 9.3.0
74
+ *
75
+ * @return array
76
+ */
77
+ public function register()
78
+ {
79
+ return array(
80
+ \T_OPEN_TAG,
81
+ );
82
+ }
83
+
84
+ /**
85
+ * Processes this test, when one of its tokens is encountered.
86
+ *
87
+ * @since 9.3.0
88
+ *
89
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
90
+ * @param int $stackPtr The position of the current token in the
91
+ * stack passed in $tokens.
92
+ *
93
+ * @return int|void Integer stack pointer to skip forward or void to continue
94
+ * normal file processing.
95
+ */
96
+ public function process(File $phpcsFile, $stackPtr)
97
+ {
98
+ // Don't do anything if the warning has already been thrown or is not necessary.
99
+ if ($this->examine === false) {
100
+ return ($phpcsFile->numTokens + 1);
101
+ }
102
+
103
+ $phpVersion = phpversion();
104
+
105
+ // Don't do anything if the PHPCS version used is above the minimum recommended version.
106
+ if (version_compare($phpVersion, self::MIN_RECOMMENDED_VERSION, '>=')) {
107
+ $this->examine = false;
108
+ return ($phpcsFile->numTokens + 1);
109
+ }
110
+
111
+ if (version_compare($phpVersion, self::MIN_SUPPORTED_VERSION, '<')) {
112
+ $isError = true;
113
+ $message = 'IMPORTANT: Please be advised that the minimum PHP version the PHPCompatibility standard supports is %s. You are currently using PHP %s. Please upgrade your PHP installation. The recommended version of PHP for PHPCompatibility is %s or higher.';
114
+ $errorCode = 'Unsupported_' . $this->stringToErrorCode(self::MIN_SUPPORTED_VERSION);
115
+ $replacements = array(
116
+ self::MIN_SUPPORTED_VERSION,
117
+ $phpVersion,
118
+ self::MIN_RECOMMENDED_VERSION,
119
+ $errorCode,
120
+ );
121
+ } else {
122
+ $isError = false;
123
+ $message = 'IMPORTANT: Please be advised that for the most reliable PHPCompatibility results, PHP %s or higher should be used. Support for lower versions will be dropped in the foreseeable future. You are currently using PHP %s. Please upgrade your PHP installation to version %s or higher.';
124
+ $errorCode = 'BelowRecommended_' . $this->stringToErrorCode(self::MIN_RECOMMENDED_VERSION);
125
+ $replacements = array(
126
+ self::MIN_RECOMMENDED_VERSION,
127
+ $phpVersion,
128
+ self::MIN_RECOMMENDED_VERSION,
129
+ $errorCode,
130
+ );
131
+ }
132
+
133
+ /*
134
+ * Figure out the report width to determine how long the delimiter lines should be.
135
+ *
136
+ * This is not an exact calculation as there are a number of unknowns at the time the
137
+ * notice is thrown (whether there are other notices for the file, whether those are
138
+ * warnings or errors, whether there are auto-fixable issues etc).
139
+ *
140
+ * In other words, this is just an approximation to get a reasonably stable and
141
+ * readable message layout format.
142
+ *
143
+ * {@internal
144
+ * PHPCS has had some changes as to how the messages display over the years.
145
+ * Most significantly in 2.4.0 it was attempted to solve an issue with messages
146
+ * containing new lines. Unfortunately, that solution is buggy.
147
+ * An improved version has been pulled upstream and will hopefully make it
148
+ * into PHPCS 3.3.1/3.4.0.
149
+ *
150
+ * Anyway, this means that instead of new lines, delimiter lines will be used to improved
151
+ * the readability of the (long) message.
152
+ *
153
+ * Also, as of PHPCS 2.2.0, the report width when using the `-s` option is 8 wider than
154
+ * it should be. A patch for that is included in the same upstream PR.
155
+ *
156
+ * If/when the upstream PR has been merged and the minimum supported/recommended version
157
+ * of PHPCompatibility would go beyond that, the below code should be adjusted.}
158
+ */
159
+ $reportWidth = PHPCSHelper::getCommandLineData($phpcsFile, 'reportWidth');
160
+ if (empty($reportWidth)) {
161
+ $reportWidth = 80;
162
+ }
163
+ $showSources = PHPCSHelper::getCommandLineData($phpcsFile, 'showSources');
164
+ if ($showSources === true) {
165
+ $reportWidth += 6;
166
+ }
167
+
168
+ $messageWidth = ($reportWidth - 15); // 15 is length of " # | WARNING | ".
169
+ $delimiterLine = str_repeat('-', ($messageWidth));
170
+ $disableNotice = 'To disable this notice, add --exclude=PHPCompatibility.Upgrade.LowPHP to your command or add <exclude name="PHPCompatibility.Upgrade.LowPHP.%s"/> to your custom ruleset. ';
171
+ $thankYou = 'Thank you for using PHPCompatibility!';
172
+
173
+ $message .= ' ' . $delimiterLine;
174
+ $message .= ' ' . $disableNotice;
175
+ $message .= ' ' . $delimiterLine;
176
+ $message .= ' ' . $thankYou;
177
+
178
+ $this->addMessage($phpcsFile, $message, 0, $isError, $errorCode, $replacements);
179
+
180
+ $this->examine = false;
181
+ }
182
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewGroupUseDeclarationsSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\UseDeclarations\NewGroupUseDeclarationsSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim.godden@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\UseDeclarations;
@@ -16,19 +15,31 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\UseDeclarations\NewGroupUseDeclarationsSniff.
 
 
 
 
20
  *
21
  * PHP version 7.0
 
22
  *
23
- * @category PHP
24
- * @package PHPCompatibility
25
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
 
 
26
  */
27
  class NewGroupUseDeclarationsSniff extends Sniff
28
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
 
 
32
  * @return array
33
  */
34
  public function register()
@@ -44,6 +55,8 @@ class NewGroupUseDeclarationsSniff extends Sniff
44
  /**
45
  * Processes this test, when one of its tokens is encountered.
46
  *
 
 
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token in
49
  * the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\UseDeclarations;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect group use declarations as introduced in PHP 7.0.
19
+ *
20
+ * Checks for:
21
+ * - Group use statements as introduced in PHP 7.0.
22
+ * - Trailing comma's in group use statements as allowed since PHP 7.2.
23
  *
24
  * PHP version 7.0
25
+ * PHP version 7.2
26
  *
27
+ * @link https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.group-use-declarations
28
+ * @link https://www.php.net/manual/en/migration72.new-features.php#migration72.new-features.trailing-comma-in-grouped-namespaces
29
+ * @link https://wiki.php.net/rfc/group_use_declarations
30
+ * @link https://wiki.php.net/rfc/list-syntax-trailing-commas
31
+ * @link https://www.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing.group
32
+ *
33
+ * @since 7.0.0
34
+ * @since 8.0.1 Now also checks for trailing comma's in group `use` declarations.
35
  */
36
  class NewGroupUseDeclarationsSniff extends Sniff
37
  {
38
  /**
39
  * Returns an array of tokens this test wants to listen for.
40
  *
41
+ * @since 7.0.0
42
+ *
43
  * @return array
44
  */
45
  public function register()
55
  /**
56
  * Processes this test, when one of its tokens is encountered.
57
  *
58
+ * @since 7.0.0
59
+ *
60
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
61
  * @param int $stackPtr The position of the current token in
62
  * the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\UseDeclarations\NewUseConstFunctionSniff.
4
  *
5
- * PHP version 5.6
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\UseDeclarations;
@@ -16,17 +15,19 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\UseDeclarations\NewUseConstFunctionSniff.
20
  *
21
- * The use operator has been extended to support importing functions and
22
- * constants in addition to classes. This is achieved via the use function
23
- * and use const constructs, respectively.
24
  *
25
  * PHP version 5.6
26
  *
27
- * @category PHP
28
- * @package PHPCompatibility
29
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
30
  */
31
  class NewUseConstFunctionSniff extends Sniff
32
  {
@@ -34,6 +35,8 @@ class NewUseConstFunctionSniff extends Sniff
34
  /**
35
  * A list of keywords that can follow use statements.
36
  *
 
 
37
  * @var array(string => string)
38
  */
39
  protected $validUseNames = array(
@@ -44,6 +47,8 @@ class NewUseConstFunctionSniff extends Sniff
44
  /**
45
  * Returns an array of tokens this test wants to listen for.
46
  *
 
 
47
  * @return array
48
  */
49
  public function register()
@@ -55,6 +60,8 @@ class NewUseConstFunctionSniff extends Sniff
55
  /**
56
  * Processes this test, when one of its tokens is encountered.
57
  *
 
 
58
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
59
  * @param int $stackPtr The position of the current token in the
60
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\UseDeclarations;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect importing constants and functions via a `use` statement.
19
  *
20
+ * The `use` operator has been extended to support importing functions and
21
+ * constants in addition to classes. This is achieved via the `use function`
22
+ * and `use const` constructs, respectively.
23
  *
24
  * PHP version 5.6
25
  *
26
+ * @link https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.use
27
+ * @link https://wiki.php.net/rfc/use_function
28
+ * @link https://www.php.net/manual/en/language.namespaces.importing.php
29
+ *
30
+ * @since 7.1.4
31
  */
32
  class NewUseConstFunctionSniff extends Sniff
33
  {
35
  /**
36
  * A list of keywords that can follow use statements.
37
  *
38
+ * @since 7.1.4
39
+ *
40
  * @var array(string => string)
41
  */
42
  protected $validUseNames = array(
47
  /**
48
  * Returns an array of tokens this test wants to listen for.
49
  *
50
+ * @since 7.1.4
51
+ *
52
  * @return array
53
  */
54
  public function register()
60
  /**
61
  * Processes this test, when one of its tokens is encountered.
62
  *
63
+ * @since 7.1.4
64
+ *
65
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
66
  * @param int $stackPtr The position of the current token in the
67
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Variables\ForbiddenGlobalVariableVariableSniff.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Wim Godden <wim@cu.be>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Variables;
@@ -16,15 +15,13 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Variables\ForbiddenGlobalVariableVariableSniff.
20
- *
21
- * Variable variables are forbidden with global
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Wim Godden <wim@cu.be>
28
  */
29
  class ForbiddenGlobalVariableVariableSniff extends Sniff
30
  {
@@ -32,6 +29,8 @@ class ForbiddenGlobalVariableVariableSniff extends Sniff
32
  /**
33
  * Returns an array of tokens this test wants to listen for.
34
  *
 
 
35
  * @return array
36
  */
37
  public function register()
@@ -42,6 +41,8 @@ class ForbiddenGlobalVariableVariableSniff extends Sniff
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
 
 
45
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
46
  * @param int $stackPtr The position of the current token in the
47
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Variables;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
+ * Detect use of `global` with variable variables, support for which has been removed in PHP 7.0.
 
 
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://wiki.php.net/rfc/uniform_variable_syntax#global_keyword_takes_only_simple_variables
23
+ *
24
+ * @since 7.0.0
25
  */
26
  class ForbiddenGlobalVariableVariableSniff extends Sniff
27
  {
29
  /**
30
  * Returns an array of tokens this test wants to listen for.
31
  *
32
+ * @since 7.0.0
33
+ *
34
  * @return array
35
  */
36
  public function register()
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
44
+ * @since 7.0.0
45
+ *
46
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
  * @param int $stackPtr The position of the current token in the
48
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php CHANGED
@@ -3,7 +3,7 @@
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
- * @copyright 2012-2018 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
@@ -16,11 +16,11 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * Detect using $this in incompatible contexts.
20
  *
21
- * "Whilst $this is considered a special variable in PHP, it lacked proper checks
22
  * to ensure it wasn't used as a variable name or reassigned. This has now been
23
- * rectified to ensure that $this cannot be a user-defined variable, reassigned
24
  * to a different value, or be globalised."
25
  *
26
  * This sniff only addresses those situations which did *not* throw an error prior
@@ -29,20 +29,21 @@ use PHP_CodeSniffer_Tokens as Tokens;
29
  * be sniffed for:
30
  * - Using $this as static variable. (error _message_ change only).
31
  *
32
- * Also, the changes with relation to assigning $this dynamically can not be
33
  * sniffed for reliably, so are not covered by this sniff.
34
- * - Disable ability to re-assign $this indirectly through $$.
35
- * - Disable ability to re-assign $this indirectly through reference.
36
- * - Disable ability to re-assign $this indirectly through extract() and parse_str().
37
  *
38
  * Other changes not (yet) covered:
39
- * - get_defined_vars() always doesn't show value of variable $this.
40
- * - Always show true $this value in magic method __call().
41
  * {@internal This could possibly be covered. Similar logic as "outside object context",
42
- * but with function name check and supportsBelow('7.0').}}
43
  *
44
  * PHP version 7.1
45
  *
 
46
  * @link https://wiki.php.net/rfc/this_var
47
  *
48
  * @since 9.1.0
3
  * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
  * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
  * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
  * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Detect using `$this` in incompatible contexts.
20
  *
21
+ * "Whilst `$this` is considered a special variable in PHP, it lacked proper checks
22
  * to ensure it wasn't used as a variable name or reassigned. This has now been
23
+ * rectified to ensure that `$this` cannot be a user-defined variable, reassigned
24
  * to a different value, or be globalised."
25
  *
26
  * This sniff only addresses those situations which did *not* throw an error prior
29
  * be sniffed for:
30
  * - Using $this as static variable. (error _message_ change only).
31
  *
32
+ * Also, the changes with relation to assigning `$this` dynamically can not be
33
  * sniffed for reliably, so are not covered by this sniff.
34
+ * - Disable ability to re-assign `$this` indirectly through `$$`.
35
+ * - Disable ability to re-assign `$this` indirectly through reference.
36
+ * - Disable ability to re-assign `$this` indirectly through `extract()` and `parse_str()`.
37
  *
38
  * Other changes not (yet) covered:
39
+ * - `get_defined_vars()` always doesn't show value of variable `$this`.
40
+ * - Always show true `$this` value in magic method `__call()`.
41
  * {@internal This could possibly be covered. Similar logic as "outside object context",
42
+ * but with function name check and supportsBelow('7.0').}
43
  *
44
  * PHP version 7.1
45
  *
46
+ * @link https://www.php.net/manual/en/migration71.other-changes.php#migration71.other-changes.inconsistency-fixes-to-this
47
  * @link https://wiki.php.net/rfc/this_var
48
  *
49
  * @since 9.1.0
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/NewUniformVariableSyntaxSniff.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Variables\NewUniformVariableSyntax.
4
  *
5
- * PHP version 7.0
6
- *
7
- * @category PHP
8
- * @package PHPCompatibility
9
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
  */
11
 
12
  namespace PHPCompatibility\Sniffs\Variables;
@@ -16,21 +15,23 @@ use PHP_CodeSniffer_File as File;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
- * \PHPCompatibility\Sniffs\Variables\NewUniformVariableSyntax.
20
- *
21
  * The interpretation of variable variables has changed in PHP 7.0.
22
  *
23
  * PHP version 7.0
24
  *
25
- * @category PHP
26
- * @package PHPCompatibility
27
- * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
 
 
28
  */
29
  class NewUniformVariableSyntaxSniff extends Sniff
30
  {
31
  /**
32
  * Returns an array of tokens this test wants to listen for.
33
  *
 
 
34
  * @return array
35
  */
36
  public function register()
@@ -41,6 +42,8 @@ class NewUniformVariableSyntaxSniff extends Sniff
41
  /**
42
  * Processes this test, when one of its tokens is encountered.
43
  *
 
 
44
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
45
  * @param int $stackPtr The position of the current token
46
  * in the stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
 
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Variables;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
 
 
18
  * The interpretation of variable variables has changed in PHP 7.0.
19
  *
20
  * PHP version 7.0
21
  *
22
+ * @link https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect
23
+ * @link https://wiki.php.net/rfc/uniform_variable_syntax
24
+ *
25
+ * @since 7.1.2
26
+ * @since 9.0.0 Renamed from `VariableVariablesSniff` to `NewUniformVariableSyntaxSniff`.
27
  */
28
  class NewUniformVariableSyntaxSniff extends Sniff
29
  {
30
  /**
31
  * Returns an array of tokens this test wants to listen for.
32
  *
33
+ * @since 7.1.2
34
+ *
35
  * @return array
36
  */
37
  public function register()
42
  /**
43
  * Processes this test, when one of its tokens is encountered.
44
  *
45
+ * @since 7.1.2
46
+ *
47
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
48
  * @param int $stackPtr The position of the current token
49
  * in the stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Variables/RemovedPredefinedGlobalVariablesSniff.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
  /**
3
- * \PHPCompatibility\Sniffs\Variables\RemovedPredefinedGlobalVariablesSniff.
4
  *
5
- * @category PHP
6
- * @package PHPCompatibility
7
- * @author Wim Godden <wim.godden@cu.be>
 
8
  */
9
 
10
  namespace PHPCompatibility\Sniffs\Variables;
@@ -15,13 +16,20 @@ use PHP_CodeSniffer_File as File;
15
  use PHP_CodeSniffer_Tokens as Tokens;
16
 
17
  /**
18
- * \PHPCompatibility\Sniffs\Variables\RemovedPredefinedGlobalVariablesSniff.
19
  *
20
- * Discourages the use of removed global variables. Suggests alternative extensions if available
21
  *
22
- * @category PHP
23
- * @package PHPCompatibility
24
- * @author Wim Godden <wim.godden@cu.be>
 
 
 
 
 
 
 
25
  */
26
  class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
27
  {
@@ -32,7 +40,10 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
32
  * The array lists : version number with false (deprecated) and true (removed).
33
  * If's sufficient to list the first version where the variable was deprecated/removed.
34
  *
35
- * @var array(string|null)
 
 
 
36
  */
37
  protected $removedGlobalVariables = array(
38
  'HTTP_POST_VARS' => array(
@@ -87,6 +98,9 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
87
  /**
88
  * Returns an array of tokens this test wants to listen for.
89
  *
 
 
 
90
  * @return array
91
  */
92
  public function register()
@@ -98,6 +112,9 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
98
  /**
99
  * Processes this test, when one of its tokens is encountered.
100
  *
 
 
 
101
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
102
  * @param int $stackPtr The position of the current token in the
103
  * stack passed in $tokens.
@@ -148,6 +165,8 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
148
  /**
149
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
150
  *
 
 
151
  * @param array $itemInfo Base information about the item.
152
  *
153
  * @return array Version and other information about the item.
@@ -161,6 +180,8 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
161
  /**
162
  * Get the error message template for this sniff.
163
  *
 
 
164
  * @return string
165
  */
166
  protected function getErrorMsgTemplate()
@@ -172,6 +193,8 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
172
  /**
173
  * Filter the error message before it's passed to PHPCS.
174
  *
 
 
175
  * @param string $error The error message which was created.
176
  * @param array $itemInfo Base information about the item this error message applies to.
177
  * @param array $errorInfo Detail information about an item this error message applies to.
@@ -189,6 +212,8 @@ class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
189
  /**
190
  * Run some additional checks for the `$php_errormsg` variable.
191
  *
 
 
192
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
193
  * @param int $stackPtr The position of the current token in the
194
  * stack passed in $tokens.
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
  *
5
+ * @package PHPCompatibility
6
+ * @copyright 2012-2019 PHPCompatibility Contributors
7
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
8
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
9
  */
10
 
11
  namespace PHPCompatibility\Sniffs\Variables;
16
  use PHP_CodeSniffer_Tokens as Tokens;
17
 
18
  /**
19
+ * Detect the use of removed global variables. Suggests alternatives if available.
20
  *
21
+ * PHP version 5.3+
22
  *
23
+ * @link https://wiki.php.net/rfc/deprecations_php_7_2#php_errormsg
24
+ *
25
+ * @since 5.5 Introduced `LongArrays` sniff.
26
+ * @since 7.0 Introduced `RemovedGlobalVariables` sniff.
27
+ * @since 7.0.7 The `LongArrays` sniff now throws a warning for deprecated and an error for removed.
28
+ * Previously the `LongArrays` sniff would always throw a warning.
29
+ * @since 7.1.0 The `RemovedGlobalVariables` sniff now extends the `AbstractNewFeatureSniff`
30
+ * instead of the base `Sniff` class.
31
+ * @since 7.1.3 Merged the `LongArrays` sniff into the `RemovedGlobalVariables` sniff.
32
+ * @since 9.0.0 Renamed from `RemovedGlobalVariablesSniff` to `RemovedPredefinedGlobalVariablesSniff`.
33
  */
34
  class RemovedPredefinedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
35
  {
40
  * The array lists : version number with false (deprecated) and true (removed).
41
  * If's sufficient to list the first version where the variable was deprecated/removed.
42
  *
43
+ * @since 5.5
44
+ * @since 7.0
45
+ *
46
+ * @var array(string => array(string => bool|string))
47
  */
48
  protected $removedGlobalVariables = array(
49
  'HTTP_POST_VARS' => array(
98
  /**
99
  * Returns an array of tokens this test wants to listen for.
100
  *
101
+ * @since 5.5
102
+ * @since 7.0
103
+ *
104
  * @return array
105
  */
106
  public function register()
112
  /**
113
  * Processes this test, when one of its tokens is encountered.
114
  *
115
+ * @since 5.5
116
+ * @since 7.0
117
+ *
118
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
119
  * @param int $stackPtr The position of the current token in the
120
  * stack passed in $tokens.
165
  /**
166
  * Get the relevant sub-array for a specific item from a multi-dimensional array.
167
  *
168
+ * @since 7.1.0
169
+ *
170
  * @param array $itemInfo Base information about the item.
171
  *
172
  * @return array Version and other information about the item.
180
  /**
181
  * Get the error message template for this sniff.
182
  *
183
+ * @since 7.1.0
184
+ *
185
  * @return string
186
  */
187
  protected function getErrorMsgTemplate()
193
  /**
194
  * Filter the error message before it's passed to PHPCS.
195
  *
196
+ * @since 8.1.0
197
+ *
198
  * @param string $error The error message which was created.
199
  * @param array $itemInfo Base information about the item this error message applies to.
200
  * @param array $errorInfo Detail information about an item this error message applies to.
212
  /**
213
  * Run some additional checks for the `$php_errormsg` variable.
214
  *
215
+ * @since 8.1.0
216
+ *
217
  * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
218
  * @param int $stackPtr The position of the current token in the
219
  * stack passed in $tokens.
vendor/phpcompatibility/php-compatibility/README.md CHANGED
@@ -6,55 +6,79 @@ PHP Compatibility Coding Standard for PHP CodeSniffer
6
  [![License](https://poser.pugx.org/phpcompatibility/php-compatibility/license.png)](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/LICENSE)
7
  [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=wimg&url=https://github.com/PHPCompatibility/PHPCompatibility&title=PHPCompatibility&language=&tags=github&category=software)
8
 
9
- [![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibility.png?branch=master)](https://travis-ci.org/PHPCompatibility/PHPCompatibility)
10
- [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/)
11
- [![Coverage Status](https://coveralls.io/repos/github/PHPCompatibility/PHPCompatibility/badge.svg?branch=master)](https://coveralls.io/github/PHPCompatibility/PHPCompatibility?branch=master)
12
 
13
- [![Tested Runtime Badge](http://php-eye.com/badge/phpcompatibility/php-compatibility/tested.svg?branch=dev-master)](http://php-eye.com/package/phpcompatibility/php-compatibility)
 
14
 
15
 
16
- This is a set of sniffs for [PHP CodeSniffer](http://pear.php.net/PHP_CodeSniffer) that checks for PHP version compatibility.
17
  It will allow you to analyse your code for compatibility with higher and lower versions of PHP.
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  PHP Version Support
21
  -------
22
 
23
- The project aims to cover all PHP compatibility changes introduced since PHP 5.0 up to the latest PHP release. This is an ongoing process and coverage is not yet 100% (if, indeed, it ever could be). Progress is tracked on [our Github issue tracker](https://github.com/PHPCompatibility/PHPCompatibility/issues).
24
 
25
  Pull requests that check for compatibility issues in PHP 4 code - in particular between PHP 4 and PHP 5.0 - are very welcome as there are still situations where people need help upgrading legacy systems. However, coverage for changes introduced before PHP 5.1 will remain patchy as sniffs for this are not actively being developed at this time.
26
 
27
  Requirements
28
  -------
29
 
30
- * PHP 5.3+ for use with PHP CodeSniffer 1.x and 2.x.
31
  * PHP 5.4+ for use with PHP CodeSniffer 3.x.
32
 
33
- PHP CodeSniffer: 1.5.6, 2.3.0+ or 3.0.2+.
34
 
35
  The sniffs are designed to give the same results regardless of which PHP version you are using to run PHP CodeSniffer. You should get reasonably consistent results independently of the PHP version used in your test environment, though for the best results it is recommended to run the sniffs on PHP 5.4 or higher.
36
 
37
- PHP CodeSniffer 1.5.6 is required for 90% of the sniffs, PHP CodeSniffer 2.6.0 or later is required for full support, notices may be thrown on older versions.
 
 
 
 
 
 
38
 
39
  As of version 8.0.0, the PHPCompatibility standard can also be used with PHP CodeSniffer 3.x.
40
 
41
- Note: support for PHP CodeSniffer < 2.3.0 will be dropped in the near future.
42
 
43
 
44
  Thank you
45
  ---------
46
  Thanks to all [contributors](https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors) for their valuable contributions.
47
 
48
- [![WPEngine](https://cu.be/img/wpengine.png)](https://wpengine.com)
49
-
50
  Thanks to [WP Engine](https://wpengine.com) for their support on the PHP 7.0 sniffs.
51
 
52
 
53
- :warning: Upgrading to PHPCompatibility 8.0.0 :warning:
54
  --------
55
- As of version 8.0.0, the installation instructions have changed. For most users, this means they will have to run a one-time-only extra command, make a change to their Composer configuration and/or adjust their build scripts.
 
 
56
 
57
- Please read the changelog for version [8.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/8.0.0) carefully before upgrading.
 
 
 
58
 
59
 
60
  Installation in a Composer project (method 1)
@@ -79,7 +103,7 @@ Installation in a Composer project (method 1)
79
 
80
  Just add the Composer plugin you prefer to the `require-dev` section of your `composer.json` file.
81
 
82
- * [DealerDirect/phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer):"^0.4.3"
83
  * [higidi/composer-phpcodesniffer-standards-plugin](https://github.com/higidi/composer-phpcodesniffer-standards-plugin)
84
  * [SimplyAdmire/ComposerPlugins](https://github.com/SimplyAdmire/ComposerPlugins). This plugin *might* still work, but appears to be abandoned.
85
  - As a last alternative in case you use a custom ruleset, _and only if you use PHP CodeSniffer version 2.6.0 or higher_, you can tell PHP CodeSniffer the path to the PHPCompatibility standard by adding the following snippet to your custom ruleset:
@@ -136,20 +160,21 @@ Sniffing your code for compatibility with specific PHP version(s)
136
  * By default the report will be sent to the console, if you want to save the report to a file, add the following to the command line command: `--report-full=path/to/report-file`.
137
  For more information and other reporting options, check the [PHP CodeSniffer wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting).
138
 
139
- More information can be found on Wim Godden's [blog](http://techblog.wimgodden.be/tag/codesniffer).
140
-
141
 
142
- ### Using a framework/CMS specific ruleset
143
 
144
- As of mid 2018, a limited set of framework/CMS specific ruleset(s) is available.
 
 
145
 
146
- These ruleset are hosted in their own repositories:
147
- * PHPCompatibilityJoomla [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityJoomla)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)
148
- * PHPCompatibilityWP [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)
 
149
 
150
- If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the PHPCompatibilityAll package [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityAll)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-all).
151
 
152
- **Note:** Framework/CMS specific ruleset do not set the minimum PHP version for your project, so you will still need to pass a `testVersion` to get the most accurate results.
153
 
154
 
155
  Using a custom ruleset
@@ -178,25 +203,25 @@ You can also set the `testVersion` from within the ruleset:
178
 
179
  Other advanced options, such as changing the message type or severity of select sniffs, as described in the [PHPCS Annotated ruleset](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) wiki page are, of course, also supported.
180
 
181
- #### `testVersion` in the ruleset versus command-line
182
 
183
  In PHPCS 3.2.0 and lower, once you set the `testVersion` in the ruleset, you could not overrule it from the command-line anymore.
184
- Starting with PHPCS 3.3.0, the `testVersion` set via the command-line will overrule the `testVersion` in the ruleset.
185
 
186
  This allows for more flexibility when, for instance, your project needs to comply with PHP `5.5-`, but you have a bootstrap file which needs to be compatible with PHP `5.2-`.
187
 
188
 
189
- #### PHPCompatibility specific options
190
 
191
  At this moment, there is one sniff which has a property which can be set via the ruleset. More custom properties may become available in the future.
192
 
193
- The `PHPCompatibility.PHP.RemovedExtensions` sniff checks for removed extensions based on the function prefix used for these extensions.
194
  This might clash with userland functions using the same function prefix.
195
 
196
  To whitelist userland functions, you can pass a comma-delimited list of function names to the sniff.
197
  ```xml
198
  <!-- Whitelist the mysql_to_rfc3339() and mysql_another_function() functions. -->
199
- <rule ref="PHPCompatibility.PHP.RemovedExtensions">
200
  <properties>
201
  <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function"/>
202
  </properties>
@@ -206,6 +231,19 @@ To whitelist userland functions, you can pass a comma-delimited list of function
206
  This property was added in PHPCompatibility version 7.0.1.
207
  As of PHPCompatibility version 8.0.0, this custom property is only supported in combination with PHP CodeSniffer > 2.6.0 due to an upstream bug (which was fixed in PHPCS 2.6.0).
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  License
211
  -------
6
  [![License](https://poser.pugx.org/phpcompatibility/php-compatibility/license.png)](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/LICENSE)
7
  [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=wimg&url=https://github.com/PHPCompatibility/PHPCompatibility&title=PHPCompatibility&language=&tags=github&category=software)
8
 
9
+ [![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibility.svg?branch=develop)](https://travis-ci.org/PHPCompatibility/PHPCompatibility)
10
+ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/PHPCompatibility/PHPCompatibility/)
11
+ [![Coverage Status](https://coveralls.io/repos/github/PHPCompatibility/PHPCompatibility/badge.svg?branch=develop)](https://coveralls.io/github/PHPCompatibility/PHPCompatibility?branch=develop)
12
 
13
+ [![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcompatibility/php-compatibility.svg?maxAge=3600)](https://packagist.org/packages/phpcompatibility/php-compatibility)
14
+ [![Tested on PHP 5.3 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.3%20|%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20-brightgreen.svg?maxAge=2419200)](https://travis-ci.org/PHPCompatibility/PHPCompatibility)
15
 
16
 
17
+ This is a set of sniffs for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) that checks for PHP cross-version compatibility.
18
  It will allow you to analyse your code for compatibility with higher and lower versions of PHP.
19
 
20
+ * [PHP Version Support](#php-version-support)
21
+ * [Requirements](#requirements)
22
+ * [Thank you](#thank-you)
23
+ * [Upgrading to PHPCompatibility 9.0.0](#warning-upgrading-to-phpcompatibility-900-warning)
24
+ * [Installation in a Composer project (method 1)](#installation-in-a-composer-project-method-1)
25
+ * [Installation via a git check-out to an arbitrary directory (method 2)](#installation-via-a-git-check-out-to-an-arbitrary-directory-method-2)
26
+ * [Sniffing your code for compatibility with specific PHP version(s)](#sniffing-your-code-for-compatibility-with-specific-php-versions)
27
+ + [Using a framework/CMS/polyfill specific ruleset](#using-a-frameworkcmspolyfill-specific-ruleset)
28
+ * [Using a custom ruleset](#using-a-custom-ruleset)
29
+ + [`testVersion` in the ruleset versus command-line](#testversion-in-the-ruleset-versus-command-line)
30
+ + [PHPCompatibility specific options](#phpcompatibility-specific-options)
31
+ * [Projects extending PHPCompatibility](#projects-extending-phpcompatibility)
32
+ * [Contributing](#contributing)
33
+ * [License](#license)
34
 
35
  PHP Version Support
36
  -------
37
 
38
+ The project aims to cover all PHP compatibility changes introduced since PHP 5.0 up to the latest PHP release. This is an ongoing process and coverage is not yet 100% (if, indeed, it ever could be). Progress is tracked on [our GitHub issue tracker](https://github.com/PHPCompatibility/PHPCompatibility/issues).
39
 
40
  Pull requests that check for compatibility issues in PHP 4 code - in particular between PHP 4 and PHP 5.0 - are very welcome as there are still situations where people need help upgrading legacy systems. However, coverage for changes introduced before PHP 5.1 will remain patchy as sniffs for this are not actively being developed at this time.
41
 
42
  Requirements
43
  -------
44
 
45
+ * PHP 5.3+ for use with PHP CodeSniffer 2.x.
46
  * PHP 5.4+ for use with PHP CodeSniffer 3.x.
47
 
48
+ PHP CodeSniffer: 2.3.0+ or 3.0.2+.
49
 
50
  The sniffs are designed to give the same results regardless of which PHP version you are using to run PHP CodeSniffer. You should get reasonably consistent results independently of the PHP version used in your test environment, though for the best results it is recommended to run the sniffs on PHP 5.4 or higher.
51
 
52
+ PHP CodeSniffer 2.3.0 is required for 90% of the sniffs, PHP CodeSniffer 2.6.0 or later is required for full support, notices may be thrown on older versions.
53
+
54
+ For running the sniffs on PHP 7.3, it is recommended to use PHP_CodeSniffer 3.3.1+, or, if needs be, PHP_CodeSniffer 2.9.2.
55
+ PHP_CodeSniffer < 2.9.2/3.3.1 is not fully compatible with PHP 7.3, which effectively means that PHPCompatibility can't be either.
56
+ While the sniffs will still work in _most_ cases, you can expect PHP warnings to be thrown.
57
+
58
+ For running the sniffs on PHP 7.4, it is recommended to use PHP_CodeSniffer 3.5.0+.
59
 
60
  As of version 8.0.0, the PHPCompatibility standard can also be used with PHP CodeSniffer 3.x.
61
 
62
+ As of version 9.0.0, support for PHP CodeSniffer 1.5.x and low 2.x versions < 2.3.0 has been dropped.
63
 
64
 
65
  Thank you
66
  ---------
67
  Thanks to all [contributors](https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors) for their valuable contributions.
68
 
 
 
69
  Thanks to [WP Engine](https://wpengine.com) for their support on the PHP 7.0 sniffs.
70
 
71
 
72
+ :warning: Upgrading to PHPCompatibility 9.0.0 :warning:
73
  --------
74
+ This library has been reorganized. All sniffs have been placed in categories and a significant number of sniffs have been renamed.
75
+
76
+ If you use the complete `PHPCompatibility` standard without `exclude` directives in a custom ruleset and do not (yet) use the new-style PHP_CodeSniffer annotation as introduced in [PHP_CodeSniffer 3.2.0](https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.2.0), this will have no noticeable effect and everything should work as before.
77
 
78
+ However, if you do use `exclude` directives for PHPCompatibility sniffs in a custom ruleset or if you use the [new-style PHP_CodeSniffer inline annotations](https://github.com/squizlabs/PHP_CodeSniffer/releases/3.2.0), you will need to update these when upgrading. This should be a one-time only change.
79
+ The changelog contains detailed information about all the sniff renames.
80
+
81
+ Please read the changelog for version [9.0.0](https://github.com/PHPCompatibility/PHPCompatibility/releases/tag/9.0.0) carefully before upgrading.
82
 
83
 
84
  Installation in a Composer project (method 1)
103
 
104
  Just add the Composer plugin you prefer to the `require-dev` section of your `composer.json` file.
105
 
106
+ * [DealerDirect/phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer):"^0.5.0"
107
  * [higidi/composer-phpcodesniffer-standards-plugin](https://github.com/higidi/composer-phpcodesniffer-standards-plugin)
108
  * [SimplyAdmire/ComposerPlugins](https://github.com/SimplyAdmire/ComposerPlugins). This plugin *might* still work, but appears to be abandoned.
109
  - As a last alternative in case you use a custom ruleset, _and only if you use PHP CodeSniffer version 2.6.0 or higher_, you can tell PHP CodeSniffer the path to the PHPCompatibility standard by adding the following snippet to your custom ruleset:
160
  * By default the report will be sent to the console, if you want to save the report to a file, add the following to the command line command: `--report-full=path/to/report-file`.
161
  For more information and other reporting options, check the [PHP CodeSniffer wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting).
162
 
 
 
163
 
164
+ ### Using a framework/CMS/polyfill specific ruleset
165
 
166
+ As of mid 2018, a limited set of framework/CMS specific rulesets is available. These rulesets are hosted in their own repositories.
167
+ * `PHPCompatibilityJoomla` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityJoomla) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)
168
+ * `PHPCompatibilityWP` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityWP) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)
169
 
170
+ Since the autumn of 2018, there are also a number of PHP polyfill specific rulesets available:
171
+ * `PHPCompatibilityPasswordCompat` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat): accounts for @ircmaxell's [`password_compat`](https://github.com/ircmaxell/password_compat) polyfill library.
172
+ * `PHPCompatibilityParagonie` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie): contains two rulesets which account for the Paragonie [`random_compat`](https://github.com/paragonie/random_compat) and [`sodium_compat`](https://github.com/paragonie/sodium_compat) polyfill libraries respectively.
173
+ * `PHPCompatibilitySymfony` [GitHub](https://github.com/PHPCompatibility/PHPCompatibilitySymfony) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony): contains a number of rulesets which account for various PHP polyfill libraries offered by the Symfony project. For more details about the available rulesets, please check out the [README of the PHPCompatibilitySymfony](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/blob/master/README.md) repository.
174
 
175
+ If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the `PHPCompatibilityAll` package [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityAll) | [Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-all).
176
 
177
+ **IMPORTANT:** Framework/CMS/Polyfill specific rulesets do not set the minimum PHP version for your project, so you will still need to pass a `testVersion` to get the most accurate results.
178
 
179
 
180
  Using a custom ruleset
203
 
204
  Other advanced options, such as changing the message type or severity of select sniffs, as described in the [PHPCS Annotated ruleset](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml) wiki page are, of course, also supported.
205
 
206
+ ### `testVersion` in the ruleset versus command-line
207
 
208
  In PHPCS 3.2.0 and lower, once you set the `testVersion` in the ruleset, you could not overrule it from the command-line anymore.
209
+ Starting with PHPCS 3.3.0, a `testVersion` set via the command-line will overrule the `testVersion` in the ruleset.
210
 
211
  This allows for more flexibility when, for instance, your project needs to comply with PHP `5.5-`, but you have a bootstrap file which needs to be compatible with PHP `5.2-`.
212
 
213
 
214
+ ### PHPCompatibility specific options
215
 
216
  At this moment, there is one sniff which has a property which can be set via the ruleset. More custom properties may become available in the future.
217
 
218
+ The `PHPCompatibility.Extensions.RemovedExtensions` sniff checks for removed extensions based on the function prefix used for these extensions.
219
  This might clash with userland functions using the same function prefix.
220
 
221
  To whitelist userland functions, you can pass a comma-delimited list of function names to the sniff.
222
  ```xml
223
  <!-- Whitelist the mysql_to_rfc3339() and mysql_another_function() functions. -->
224
+ <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
225
  <properties>
226
  <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function"/>
227
  </properties>
231
  This property was added in PHPCompatibility version 7.0.1.
232
  As of PHPCompatibility version 8.0.0, this custom property is only supported in combination with PHP CodeSniffer > 2.6.0 due to an upstream bug (which was fixed in PHPCS 2.6.0).
233
 
234
+ Projects extending PHPCompatibility
235
+ --------------------------------------
236
+ There are hundreds of public projects using PHPCompatibility or extending on top of it. A short list of some that you might know or have a look at :
237
+ * [adamculp/php-code-quality](https://github.com/adamculp/php-code-quality) - a Docker image doing a lot of code quality checks
238
+ * [VFAC/PHP7Compatibility](https://vfac.fr/projects/php7compatibility) - a Docker container to check PHP7 Compatibility
239
+ * [grumphp-php-compatibility](https://github.com/wunderio/grumphp-php-compatibility) - A plugin for [GrumPHP](https://github.com/phpro/grumphp)
240
+ * PHPCompatibility Checker WordPress plugin : [Wordpress site](https://wordpress.org/plugins/php-compatibility-checker/) and [Github](https://github.com/wpengine/phpcompat/)
241
+ * [WordPress Tide project](https://wptide.org/)
242
+ * [PHPStorm has built-in support for PHPCompatibility](https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html#788c81b6)
243
+
244
+ Contributing
245
+ -------
246
+ Contributions are very welcome. Please read the [CONTRIBUTING](.github/CONTRIBUTING.md) documentation to get started.
247
 
248
  License
249
  -------
vendor/phpcompatibility/php-compatibility/phpunit-bootstrap.php CHANGED
@@ -1,8 +1,15 @@
1
  <?php
2
  /**
 
 
3
  * Bootstrap file for tests.
4
  *
5
- * @package PHPCompatibility
 
 
 
 
 
6
  */
7
 
8
  if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
1
  <?php
2
  /**
3
+ * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
+ *
5
  * Bootstrap file for tests.
6
  *
7
+ * @package PHPCompatibility
8
+ * @copyright 2012-2019 PHPCompatibility Contributors
9
+ * @license https://opensource.org/licenses/LGPL-3.0 LGPL3
10
+ * @link https://github.com/PHPCompatibility/PHPCompatibility
11
+ *
12
+ * @since 5.5
13
  */
14
 
15
  if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat/ruleset.xml CHANGED
@@ -20,18 +20,26 @@
20
  <exclude name="PHPCompatibility.Classes.NewClasses.sodiumexceptionFound"/>
21
 
22
  <!-- https://github.com/paragonie/sodium_compat/blob/master/lib/php72compat.php -->
23
- <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_keybytesFound"/>
24
- <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_nsecbytesFound"/>
25
- <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_npubbytesFound"/>
26
- <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_abytesFound"/>
27
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_keybytesFound"/>
28
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_nsecbytesFound"/>
29
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_npubbytesFound"/>
30
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_abytesFound"/>
 
 
 
 
31
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_keybytesFound"/>
32
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_nsecbytesFound"/>
33
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_npubbytesFound"/>
34
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_abytesFound"/>
 
 
 
 
35
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_bytesFound"/>
36
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_keybytesFound"/>
37
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_sealbytesFound"/>
@@ -41,10 +49,16 @@
41
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_macbytesFound"/>
42
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_noncebytesFound"/>
43
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_seedbytesFound"/>
 
 
 
 
44
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_bytesFound"/>
 
45
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_publickeybytesFound"/>
46
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_secretkeybytesFound"/>
47
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_seedbytesFound"/>
 
48
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytesFound"/>
49
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_minFound"/>
50
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_maxFound"/>
@@ -61,8 +75,21 @@
61
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_moderateFound"/>
62
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_memlimit_sensitiveFound"/>
63
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_sensitiveFound"/>
 
 
 
 
 
 
64
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_bytesFound"/>
65
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_scalarbytesFound"/>
 
 
 
 
 
 
 
66
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_bytesFound"/>
67
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_keybytesFound"/>
68
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_keybytesFound"/>
@@ -75,6 +102,12 @@
75
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_keypairbytesFound"/>
76
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_keybytesFound"/>
77
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_noncebytesFound"/>
 
 
 
 
 
 
78
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2hexFound"/>
79
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_compareFound"/>
80
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_decryptFound"/>
@@ -107,8 +140,17 @@
107
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_initFound"/>
108
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_keygenFound"/>
109
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_updateFound"/>
 
 
110
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kxFound"/>
 
 
 
 
 
 
111
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_strFound"/>
 
112
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_verifyFound"/>
113
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256Found"/>
114
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256_strFound"/>
@@ -118,11 +160,18 @@
118
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretboxFound"/>
119
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_keygenFound"/>
120
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_openFound"/>
 
 
 
 
 
 
121
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthashFound"/>
122
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthash_keygenFound"/>
123
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_signFound"/>
124
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_detachedFound"/>
125
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypairFound"/>
 
126
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_openFound"/>
127
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickeyFound"/>
128
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickey_from_secretkeyFound"/>
@@ -136,13 +185,60 @@
136
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_stream_xorFound"/>
137
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_hex2binFound"/>
138
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_incrementFound"/>
 
139
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_majorFound"/>
140
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_minorFound"/>
141
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_version_stringFound"/>
142
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_memcmpFound"/>
 
143
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_bufFound"/>
144
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_uniformFound"/>
145
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_random16Found"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  </rule>
147
 
148
  </ruleset>
20
  <exclude name="PHPCompatibility.Classes.NewClasses.sodiumexceptionFound"/>
21
 
22
  <!-- https://github.com/paragonie/sodium_compat/blob/master/lib/php72compat.php -->
23
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_originalFound"/>
24
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_original_no_paddingFound"/>
25
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_urlsafeFound"/>
26
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_base64_variant_urlsafe_no_paddingFound"/>
27
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_keybytesFound"/>
28
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_nsecbytesFound"/>
29
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_npubbytesFound"/>
30
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_aes256gcm_abytesFound"/>
31
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_keybytesFound"/>
32
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_nsecbytesFound"/>
33
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_npubbytesFound"/>
34
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_abytesFound"/>
35
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_keybytesFound"/>
36
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_nsecbytesFound"/>
37
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_npubbytesFound"/>
38
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_chacha20poly1305_ietf_abytesFound"/>
39
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_keybytesFound"/>
40
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_nsecbytesFound"/>
41
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_npubbytesFound"/>
42
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_aead_xchacha20poly1305_ietf_abytesFound"/>
43
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_bytesFound"/>
44
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_auth_keybytesFound"/>
45
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_sealbytesFound"/>
49
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_macbytesFound"/>
50
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_noncebytesFound"/>
51
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_box_seedbytesFound"/>
52
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_bytes_minFound"/>
53
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_bytes_maxFound"/>
54
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_contextbytesFound"/>
55
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kdf_keybytesFound"/>
56
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_bytesFound"/>
57
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_keypairbytesFound"/>
58
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_publickeybytesFound"/>
59
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_secretkeybytesFound"/>
60
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_seedbytesFound"/>
61
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_kx_sessionkeybytesFound"/>
62
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytesFound"/>
63
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_minFound"/>
64
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_generichash_bytes_maxFound"/>
75
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_moderateFound"/>
76
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_memlimit_sensitiveFound"/>
77
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_opslimit_sensitiveFound"/>
78
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_saltbytesFound"/>
79
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_strprefixFound"/>
80
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_opslimit_interactiveFound"/>
81
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_memlimit_interactiveFound"/>
82
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitiveFound"/>
83
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitiveFound"/>
84
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_bytesFound"/>
85
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_scalarmult_scalarbytesFound"/>
86
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_abytesFound"/>
87
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_headerbytesFound"/>
88
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_keybytesFound"/>
89
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_messagebytes_maxFound"/>
90
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_pushFound"/>
91
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_rekeyFound"/>
92
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretstream_xchacha20poly1305_tag_finalFound"/>
93
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_bytesFound"/>
94
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_shorthash_keybytesFound"/>
95
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_secretbox_keybytesFound"/>
102
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_sign_keypairbytesFound"/>
103
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_keybytesFound"/>
104
  <exclude name="PHPCompatibility.Constants.NewConstants.sodium_crypto_stream_noncebytesFound"/>
105
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_versionFound"/>
106
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_major_versionFound"/>
107
+ <exclude name="PHPCompatibility.Constants.NewConstants.sodium_library_minor_versionFound"/>
108
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_addFound"/>
109
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_base642binFound"/>
110
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2base64Found"/>
111
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_bin2hexFound"/>
112
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_compareFound"/>
113
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_aead_aes256gcm_decryptFound"/>
140
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_initFound"/>
141
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_keygenFound"/>
142
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_generichash_updateFound"/>
143
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_derive_from_keyFound"/>
144
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kdf_keygenFound"/>
145
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kxFound"/>
146
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_client_session_keysFound"/>
147
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_keypairFound"/>
148
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_publickeyFound"/>
149
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_secretkeyFound"/>
150
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_seed_keypairFound"/>
151
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_kx_server_session_keysFound"/>
152
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_strFound"/>
153
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_needs_rehashFound"/>
154
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_str_verifyFound"/>
155
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256Found"/>
156
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhash_scryptsalsa208sha256_strFound"/>
160
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretboxFound"/>
161
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_keygenFound"/>
162
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretbox_openFound"/>
163
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_keygenFound"/>
164
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pullFound"/>
165
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_init_pushFound"/>
166
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pullFound"/>
167
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_pushFound"/>
168
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_secretstream_xchacha20poly1305_rekeyFound"/>
169
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthashFound"/>
170
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_shorthash_keygenFound"/>
171
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_signFound"/>
172
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_detachedFound"/>
173
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypairFound"/>
174
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_keypair_from_secretkey_and_publickeyFound"/>
175
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_openFound"/>
176
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickeyFound"/>
177
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_sign_publickey_from_secretkeyFound"/>
185
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_stream_xorFound"/>
186
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_hex2binFound"/>
187
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_incrementFound"/>
188
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_versionFound"/>
189
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_majorFound"/>
190
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_library_version_minorFound"/>
191
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_version_stringFound"/>
192
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_memcmpFound"/>
193
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_padFound"/>
194
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_bufFound"/>
195
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_uniformFound"/>
196
  <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_randombytes_random16Found"/>
197
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.sodium_unpadFound"/>
198
+ </rule>
199
+
200
+ <!-- Prevent false positives being thrown when run over the code of sodium_compat itself. -->
201
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.assert_descriptionFound">
202
+ <exclude-pattern>/sodium_compat/autoload\.php$</exclude-pattern>
203
+ </rule>
204
+ <rule ref="PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__debuginfoFound">
205
+ <exclude-pattern>/sodium_compat/src/Core(32)?/Curve25519/Fe\.php$</exclude-pattern>
206
+ </rule>
207
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound">
208
+ <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern>
209
+ </rule>
210
+ <rule ref="PHPCompatibility.ParameterValues.NewPackFormat.NewFormatFound">
211
+ <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern>
212
+ </rule>
213
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_ivFound">
214
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
215
+ </rule>
216
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_tagFound">
217
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
218
+ </rule>
219
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_decrypt_aadFound">
220
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
221
+ </rule>
222
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_ivFound">
223
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
224
+ </rule>
225
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_tagFound">
226
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
227
+ </rule>
228
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctionParameters.openssl_encrypt_aadFound">
229
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
230
+ </rule>
231
+ <rule ref="PHPCompatibility.Constants.NewConstants.openssl_raw_dataFound">
232
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
233
+ </rule>
234
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_crypto_pwhashFound">
235
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
236
+ </rule>
237
+ <rule ref="PHPCompatibility.FunctionUse.NewFunctions.sodium_memzeroFound">
238
+ <exclude-pattern>/sodium_compat/src/Compat\.php$</exclude-pattern>
239
+ </rule>
240
+ <rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated">
241
+ <exclude-pattern>/sodium_compat/src/Core/Util\.php$</exclude-pattern>
242
  </rule>
243
 
244
  </ruleset>
vendor/phpcompatibility/phpcompatibility-paragonie/README.md CHANGED
@@ -1,7 +1,7 @@
1
  [![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)
2
  [![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)
3
  [![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/blob/master/LICENSE)
4
- [![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibilityParagonie.svg?branch=master)](https://travis-ci.org/PHPCompatibility/PHPCompatibilityParagonie)
5
 
6
  # PHPCompatibilityParagonie
7
 
@@ -42,7 +42,7 @@ The only supported installation method is via [Composer](https://getcomposer.org
42
 
43
  If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line:
44
  ```bash
45
- composer require --dev dealerdirect/phpcodesniffer-composer-installer:^0.4.4 phpcompatibility/phpcompatibility-paragonie:*
46
  composer install
47
  ```
48
 
@@ -98,12 +98,37 @@ All code within the PHPCompatibility organisation is released under the GNU Less
98
 
99
  ## Changelog
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  ### 1.0.1 - 2018-12-16
102
 
103
- * Prevent false positives when the ruleset is run over the code of the `RandomCompat` polyfill itself.
104
  * The rulesets are now also tested against PHP 7.3.
105
  Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
106
 
107
  ### 1.0.0 - 2018-10-07
108
 
109
  Initial release of PHPCompatibilityParagonie containing rulesets covering the `random_compat` and `sodium_compat` polyfill libraries.
 
 
1
  [![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)
2
  [![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-paragonie)
3
  [![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-paragonie/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/blob/master/LICENSE)
4
+ [![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityParagonie/actions)
5
 
6
  # PHPCompatibilityParagonie
7
 
42
 
43
  If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line:
44
  ```bash
45
+ composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-paragonie:*
46
  composer install
47
  ```
48
 
98
 
99
  ## Changelog
100
 
101
+ ### 1.3.1 - 2021-02-15
102
+
103
+ - The recommended version of the [Composer PHPCS plugin] is now `^0.7.0`, which offers compatibility with Composer 2.0.
104
+ - The rulesets are now also tested against PHP 7.4 and 8.0.
105
+ Note: full PHP 7.4 support is only available in combination with PHP_CodeSniffer 3.5.6.
106
+ Note: runtime PHP 8.0 support is only available in combination with PHP_CodeSniffer 3.5.7, full support is expected in PHP_CodeSniffer 3.6.0.
107
+
108
+ ### 1.3.0 - 2019-11-04
109
+
110
+ * Ruleset update for full compatibility with version [`1.12.0` of `sodium_compat`](https://github.com/paragonie/sodium_compat/releases/tag/v1.12.0).
111
+
112
+ ### 1.2.0 - 2019-10-16
113
+
114
+ * Ruleset update for full compatibility with version [`1.11.0` of `sodium_compat`](https://github.com/paragonie/sodium_compat/releases/tag/v1.11.0).
115
+
116
+ ### 1.1.0 - 2019-08-29
117
+
118
+ * The `PHPCompatibilityParagonieSodiumCompat` ruleset has been updated to account for the latest changes in the `sodium_compat` polyfill.
119
+ * Prevent false positives when the ruleset is run over the code of the `sodium_compat` polyfill itself.
120
+ * Composer: The recommended version of the [Composer PHPCS plugin] has been upped to `^0.5.0`.
121
+ * CI: Improved integration test for the `SodiumCompat` ruleset.
122
+ * CI: Added early warning system for false positives due to changes in the polyfill libraries themselves.
123
+
124
  ### 1.0.1 - 2018-12-16
125
 
126
+ * Prevent false positives when the ruleset is run over the code of the `random_compat` polyfill itself.
127
  * The rulesets are now also tested against PHP 7.3.
128
  Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
129
 
130
  ### 1.0.0 - 2018-10-07
131
 
132
  Initial release of PHPCompatibilityParagonie containing rulesets covering the `random_compat` and `sodium_compat` polyfill libraries.
133
+
134
+ [Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/
vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml CHANGED
@@ -3,48 +3,66 @@
3
  <description>WordPress specific ruleset which checks for PHP cross version compatibility.</description>
4
 
5
  <!--
6
- The WordPress minimum PHP requirement is PHP 5.2.4.
7
- Add the following in your project PHPCS ruleset to enforce this:
8
- <config name="testVersion" value="5.2-"/>
9
-
 
10
  This directive is not included in this ruleset as individual projects may use
11
  a different (higher) minimum PHP version.
12
  -->
13
 
14
  <rule ref="PHPCompatibility">
15
- <!-- Contained in /wp-includes/compat.php. -->
16
- <exclude name="PHPCompatibility.PHP.NewFunctions.hash_hmacFound"/>
17
- <exclude name="PHPCompatibility.PHP.NewFunctions.json_encodeFound"/>
18
- <exclude name="PHPCompatibility.PHP.NewFunctions.json_decodeFound"/>
19
- <exclude name="PHPCompatibility.PHP.NewFunctions.hash_equalsFound"/>
20
- <exclude name="PHPCompatibility.PHP.NewConstants.json_pretty_printFound"/>
21
- <exclude name="PHPCompatibility.PHP.NewFunctions.json_last_error_msgFound"/>
22
- <exclude name="PHPCompatibility.PHP.NewInterfaces.jsonserializableFound"/>
23
- <exclude name="PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound"/>
24
- <exclude name="PHPCompatibility.PHP.NewFunctions.is_iterableFound"/>
25
- <exclude name="PHPCompatibility.PHP.NewFunctions.is_countableFound"/>
26
-
27
- <!-- Contained in /wp-includes/spl-autoload-compat.php. -->
28
- <exclude name="PHPCompatibility.PHP.NewFunctions.spl_autoload_registerFound"/>
29
- <exclude name="PHPCompatibility.PHP.NewFunctions.spl_autoload_unregisterFound"/>
30
- <exclude name="PHPCompatibility.PHP.NewFunctions.spl_autoload_functionsFound"/>
31
-
32
- <!-- Contained in /wp-includes/random_compat/random.php. -->
33
- <exclude name="PHPCompatibility.PHP.NewConstants.php_version_idFound"/>
34
-
35
- <!-- Contained in /wp-includes/random_compat/*.php (various files). -->
36
- <exclude name="PHPCompatibility.PHP.NewFunctions.random_bytesFound"/>
37
-
38
- <!-- Contained in /wp-includes/random_compat/random_int.php. -->
39
- <exclude name="PHPCompatibility.PHP.NewFunctions.random_intFound"/>
40
-
41
- <!-- Contained in /wp-includes/random_compat/error_polyfill.php. -->
42
- <exclude name="PHPCompatibility.PHP.NewClasses.errorFound"/>
43
- <exclude name="PHPCompatibility.PHP.NewClasses.typeerrorFound"/>
 
 
 
 
 
 
 
 
 
44
  </rule>
45
 
 
 
 
 
 
 
 
 
46
  <!-- Whitelist the WP Core mysql_to_rfc3339() function. -->
47
- <rule ref="PHPCompatibility.PHP.RemovedExtensions">
48
  <properties>
49
  <!-- Contained in /wp-includes/functions.php. -->
50
  <property name="functionWhitelist" type="array" value="mysql_to_rfc3339"/>
3
  <description>WordPress specific ruleset which checks for PHP cross version compatibility.</description>
4
 
5
  <!--
6
+ The WordPress minimum PHP requirement was 5.2.4 up to WP 5.1.
7
+ As of WP 5.2, the new minimum PHP requirement is PHP 5.6.20.
8
+ Add the following in your project PHP_CodeSniffer ruleset to enforce this:
9
+ <config name="testVersion" value="5.6-"/>
10
+
11
  This directive is not included in this ruleset as individual projects may use
12
  a different (higher) minimum PHP version.
13
  -->
14
 
15
  <rule ref="PHPCompatibility">
16
+ <!--
17
+ Contained in /wp-includes/compat.php.
18
+
19
+ History of the polyfills in WP:
20
+ * hash_hmac(): since WP 3.2.0.
21
+ * json_encode() and json_decode(): since unknown.
22
+ * hash_equals(): since WP 3.9.2.
23
+ * JSON_PRETTY_PRINT: since WP 4.1.0.
24
+ * json_last_error_msg(): since WP 4.4.0.
25
+ * JsonSerializable: since WP 4.4.0.
26
+ * array_replace_recursive(): since WP 4.5.3 up to 5.2.x. The polyfill was removed in WP 5.3.
27
+ * is_iterable(): since WP 4.9.6
28
+ * is_countable(): since WP 4.9.6
29
+ * IMAGETYPE_WEBP and IMG_WEBP: since WP 5.8.0.
30
+ -->
31
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_hmacFound"/>
32
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_encodeFound"/>
33
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_decodeFound"/>
34
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.hash_equalsFound"/>
35
+ <exclude name="PHPCompatibility.Constants.NewConstants.json_pretty_printFound"/>
36
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.json_last_error_msgFound"/>
37
+ <exclude name="PHPCompatibility.Interfaces.NewInterfaces.jsonserializableFound"/>
38
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound"/>
39
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_iterableFound"/>
40
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.is_countableFound"/>
41
+ <exclude name="PHPCompatibility.Constants.NewConstants.imagetype_webpFound"/>
42
+ <exclude name="PHPCompatibility.Constants.NewConstants.img_webpFound"/>
43
+
44
+ <!--
45
+ Contained in /wp-includes/spl-autoload-compat.php.
46
+
47
+ History of the polyfills in WP:
48
+ * spl_autoload_register(), spl_autoload_unregister() and spl_autoload_functions() were
49
+ introduced in WP 4.6.0 and available up to WP 5.2.x. The polyfills were removed in WP 5.3.
50
+ -->
51
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_registerFound"/>
52
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_unregisterFound"/>
53
+ <exclude name="PHPCompatibility.FunctionUse.NewFunctions.spl_autoload_functionsFound"/>
54
  </rule>
55
 
56
+ <!--
57
+ The ParagonieSodiumCompat ruleset includes the ParagonieRandomCompat ruleset.
58
+
59
+ RancomCompat is contained in /wp-includes/random_compat/ since WP 4.4.0
60
+ SodiumCompat is contained in /wp-includes/sodium_compat/ since WP 5.2.0
61
+ -->
62
+ <rule ref="PHPCompatibilityParagonieSodiumCompat"/>
63
+
64
  <!-- Whitelist the WP Core mysql_to_rfc3339() function. -->
65
+ <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
66
  <properties>
67
  <!-- Contained in /wp-includes/functions.php. -->
68
  <property name="functionWhitelist" type="array" value="mysql_to_rfc3339"/>
vendor/phpcompatibility/phpcompatibility-wp/README.md CHANGED
@@ -1,16 +1,16 @@
1
- [![Latest Stable Version](https://poser.pugx.org/PHPCompatibility/phpcompatibility-wp/v/stable.png)](https://packagist.org/packages/PHPCompatibility/phpcompatibility-wp)
2
- [![Latest Unstable Version](https://poser.pugx.org/PHPCompatibility/phpcompatibility-wp/v/unstable.png)](https://packagist.org/packages/PHPCompatibility/phpcompatibility-wp)
3
- [![License](https://poser.pugx.org/PHPCompatibility/phpcompatibility-wp/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityWP/blob/master/LICENSE)
4
- [![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibilityWP.png?branch=master)](https://travis-ci.org/PHPCompatibility/PHPCompatibilityWP)
5
 
6
  # PHPCompatibilityWP
7
 
8
- Using the PHPCompatibilityWP standard, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility.
9
 
10
 
11
  ## What's in this repo ?
12
 
13
- A PHPCompatibility ruleset for projects based on the WordPress CMS.
14
 
15
  This WordPress specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by WordPress.
16
 
@@ -22,23 +22,24 @@ This WordPress specific ruleset prevents false positives from the [PHPCompatibil
22
  * PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) 3.0.2+.
23
 
24
  Use the latest stable release of PHP_CodeSniffer for the best results.
25
- The minimum _recommended_ version of PHP_CodeSniffer is PHPCS 2.6.0.
26
- * [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility).
 
27
 
28
 
29
  ## Installation instructions
30
 
31
- ### Installation instructions using Composer
32
 
33
  If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line:
34
  ```bash
35
- composer require --dev dealerdirect/phpcodesniffer-composer-installer:^0.4.3 phpcompatibility/phpcompatibility-wp:*
36
  composer install
37
  ```
38
 
39
- If you already have a Composer PHPCS plugin installed, run:
40
  ```bash
41
- composer require --dev phpcompatibility/phpcompatibility-wp:*
42
  composer install
43
  ```
44
 
@@ -46,25 +47,7 @@ Next, run:
46
  ```bash
47
  vendor/bin/phpcs -i
48
  ```
49
- If all went well, you will now see that the PHPCompatibility and PHPCompatibilityWP standards are installed for PHP_CodeSniffer.
50
-
51
- ### Installation instructions without Composer (unsupported)
52
-
53
- * Install [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation).
54
-
55
- PHP CodeSniffer offers a variety of installation methods to suit your work-flow: Composer, [PEAR](http://pear.php.net/PHP_CodeSniffer), a Phar file, zipped/tarred release archives or checking the repository out using Git.
56
-
57
- * Install [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) by [cloning the PHPCompatibility repository](https://github.com/PHPCompatibility/PHPCompatibility#installation-via-a-git-check-out-to-an-arbitrary-directory-method-2).
58
-
59
- * Install [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP) by cloning this repository.
60
-
61
- * Add the paths to the directories in which you placed your copies of the PHPCompatibility repo and the PHPCompatibilityWP repo to the PHP CodeSniffer configuration using the below command from the command line:
62
- ```bash
63
- phpcs --config-set installed_paths /path/to/PHPCompatibility,/path/to/PHPCompatibilityWP
64
- ```
65
- For more information, see the PHP CodeSniffer wiki on the [`installed_paths` configuration variable](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths).
66
-
67
- * Verify that the PHPCompatibility standard is registered correctly by running `phpcs -i` on the command line. PHPCompatibility should be listed as one of the available standards.
68
 
69
 
70
  ## How to use
@@ -72,20 +55,30 @@ If all went well, you will now see that the PHPCompatibility and PHPCompatibilit
72
  Now you can use the following command to inspect your code:
73
  ```bash
74
  ./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP
75
-
76
- # Or if you installed without using Composer:
77
- phpcs -p . --standard=PHPCompatibilityWP
78
  ```
79
 
80
  By default, you will only receive notifications about deprecated and/or removed PHP features.
81
 
82
  To get the most out of the PHPCompatibilityWP standard, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features.
83
 
84
- The minimum PHP requirement of the WordPress project at this time is PHP 5.2.4. If you want to enforce this, either add `--runtime-set testVersion 5.2-` to your command-line command or add `<config name="testVersion" value="5.2-"/>` to your [custom ruleset](https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset).
 
 
 
 
 
 
85
 
86
  For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard.
87
 
88
 
 
 
 
 
 
 
 
89
  ## License
90
 
91
  All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/copyleft/lesser.html
@@ -93,6 +86,36 @@ All code within the PHPCompatibility organisation is released under the GNU Less
93
 
94
  ## Changelog
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  ### 1.0.0 - 2018-07-17
97
 
98
  Initial release of the PHPCompatibilityWP ruleset.
 
 
1
+ [![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)
2
+ [![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)
3
+ [![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-wp/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityWP/blob/master/LICENSE)
4
+ [![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityWP/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityWP/actions)
5
 
6
  # PHPCompatibilityWP
7
 
8
+ Using PHPCompatibilityWP, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility.
9
 
10
 
11
  ## What's in this repo ?
12
 
13
+ A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects based on the WordPress CMS.
14
 
15
  This WordPress specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by WordPress.
16
 
22
  * PHP 5.4+ for use with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) 3.0.2+.
23
 
24
  Use the latest stable release of PHP_CodeSniffer for the best results.
25
+ The minimum _recommended_ version of PHP_CodeSniffer is version 2.6.0.
26
+ * [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) 9.0.0+.
27
+ * [PHPCompatibilityParagonie](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) 1.0.0+.
28
 
29
 
30
  ## Installation instructions
31
 
32
+ The only supported installation method is via [Composer](https://getcomposer.org/).
33
 
34
  If you don't have a Composer plugin installed to manage the `installed_paths` setting for PHP_CodeSniffer, run the following from the command-line:
35
  ```bash
36
+ composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-wp:"*"
37
  composer install
38
  ```
39
 
40
+ If you already have a Composer PHP_CodeSniffer plugin installed, run:
41
  ```bash
42
+ composer require --dev phpcompatibility/phpcompatibility-wp:"*"
43
  composer install
44
  ```
45
 
47
  ```bash
48
  vendor/bin/phpcs -i
49
  ```
50
+ If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityWP` and some more PHPCompatibility standards are installed for PHP_CodeSniffer.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
 
53
  ## How to use
55
  Now you can use the following command to inspect your code:
56
  ```bash
57
  ./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP
 
 
 
58
  ```
59
 
60
  By default, you will only receive notifications about deprecated and/or removed PHP features.
61
 
62
  To get the most out of the PHPCompatibilityWP standard, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features.
63
 
64
+ The minimum PHP requirement of the WordPress project up to WP 5.1 was 5.2.4. As of WP 5.2 it will be PHP 5.6.20. If you want to enforce this, either add `--runtime-set testVersion 5.6-` to your command-line command or add `<config name="testVersion" value="5.6-"/>` to your [custom ruleset](https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset).
65
+
66
+ For example:
67
+ ```bash
68
+ # For a project which should be compatible with PHP 5.6 and higher:
69
+ ./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --runtime-set testVersion 5.6-
70
+ ```
71
 
72
  For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard.
73
 
74
 
75
+ ### Testing PHP files only
76
+
77
+ By default PHP_CodeSniffer will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP_CodeSniffer to only check PHP files, like so:
78
+ ```bash
79
+ ./vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6-
80
+ ```
81
+
82
  ## License
83
 
84
  All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/copyleft/lesser.html
86
 
87
  ## Changelog
88
 
89
+ ### 2.1.2 - 2021-07-20
90
+
91
+ - Ruleset: Updated for compatibility with WordPress 5.8.
92
+ - Documentation: improved installation instructions. Props [Andy Fragen](https://github.com/afragen).
93
+
94
+ ### 2.1.1 - 2021-02-15
95
+
96
+ - The recommended version of the [Composer PHPCS plugin] is now `^0.7.0`, which offers compatibility with Composer 2.0.
97
+ - The ruleset is now also tested against PHP 7.4 and 8.0.
98
+ Note: full PHP 7.4 support is only available in combination with PHP_CodeSniffer >= 3.5.6.
99
+ Note: runtime PHP 8.0 support is only available in combination with PHP_CodeSniffer >= 3.5.7, full support is expected in PHP_CodeSniffer 3.6.0.
100
+
101
+ ### 2.1.0 - 2019-08-29
102
+
103
+ - Ruleset: Updated for the Sodium_Compat polyfill which is included in WordPress 5.2.
104
+ - Composer: The recommended version of the [Composer PHPCS plugin] has been upped to `^0.5.0`.
105
+ - Documentation: Updated the ruleset inline documentation and the Readme to reflect the change in minimum PHP requirements for WordPress as of WP 5.2.
106
+ - Documentation: Updated the ruleset inline documentation to include information on when each polyfill was added to/removed from WordPress.
107
+ - CI: The rulesets are now also tested against PHP 7.3.
108
+ Note: full PHP 7.3 support is only available in combination with PHP_CodeSniffer 2.9.2 or 3.3.1+ due to an incompatibility within PHP_CodeSniffer itself.
109
+
110
+ ### 2.0.0 - 2018-10-07
111
+
112
+ - Ruleset: Updated for compatibility with PHPCompatibility 9.0+.
113
+ - Composer: Added dependency for a dedicated polyfill-based PHPCompatibility ruleset.
114
+ - CI: Added a test for the ruleset.
115
+ - Readme: Removed the installation instructions for a non-Composer based install.
116
+
117
  ### 1.0.0 - 2018-07-17
118
 
119
  Initial release of the PHPCompatibilityWP ruleset.
120
+
121
+ [Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/
vendor/squizlabs/php_codesniffer/CodeSniffer.conf CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
  $phpCodeSnifferConfig = array (
3
- 'installed_paths' => '../../phpcompatibility/php-compatibility/,../../phpcompatibility/phpcompatibility-wp/,../../phpcompatibility/phpcompatibility-paragonie/',
4
  )
5
  ?>
1
  <?php
2
  $phpCodeSnifferConfig = array (
3
+ 'installed_paths' => '../../phpcompatibility/php-compatibility,../../phpcompatibility/phpcompatibility-paragonie,../../phpcompatibility/phpcompatibility-wp',
4
  )
5
  ?>
vendor/squizlabs/php_codesniffer/CodeSniffer.php CHANGED
@@ -73,7 +73,7 @@ class PHP_CodeSniffer
73
  *
74
  * @var string
75
  */
76
- const VERSION = '2.9.1';
77
 
78
  /**
79
  * Package stability; either stable, beta or alpha.
73
  *
74
  * @var string
75
  */
76
+ const VERSION = '2.9.2';
77
 
78
  /**
79
  * Package stability; either stable, beta or alpha.
vendor/squizlabs/php_codesniffer/CodeSniffer/File.php CHANGED
@@ -1763,7 +1763,7 @@ class PHP_CodeSniffer_File
1763
  }
1764
  break;
1765
  default:
1766
- continue;
1767
  }//end switch
1768
  }//end for
1769
 
@@ -2880,7 +2880,7 @@ class PHP_CodeSniffer_File
2880
  // If it's null, then there must be no parameters for this
2881
  // method.
2882
  if ($currVar === null) {
2883
- continue;
2884
  }
2885
 
2886
  $vars[$paramCount] = array();
1763
  }
1764
  break;
1765
  default:
1766
+ continue 2;
1767
  }//end switch
1768
  }//end for
1769
 
2880
  // If it's null, then there must be no parameters for this
2881
  // method.
2882
  if ($currVar === null) {
2883
+ continue 2;
2884
  }
2885
 
2886
  $vars[$paramCount] = array();
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php CHANGED
@@ -50,7 +50,9 @@ class Generic_Sniffs_CodeAnalysis_EmptyStatementSniff implements PHP_CodeSniffer
50
  public function register()
51
  {
52
  return array(
 
53
  T_CATCH,
 
54
  T_DO,
55
  T_ELSE,
56
  T_ELSEIF,
@@ -98,7 +100,7 @@ class Generic_Sniffs_CodeAnalysis_EmptyStatementSniff implements PHP_CodeSniffer
98
  // Get token identifier.
99
  $name = strtoupper($token['content']);
100
  $error = 'Empty %s statement detected';
101
- $phpcsFile->addError($error, $stackPtr, 'Detected'.$name, array($name));
102
 
103
  }//end process()
104
 
50
  public function register()
51
  {
52
  return array(
53
+ T_TRY,
54
  T_CATCH,
55
+ T_FINALLY,
56
  T_DO,
57
  T_ELSE,
58
  T_ELSEIF,
100
  // Get token identifier.
101
  $name = strtoupper($token['content']);
102
  $error = 'Empty %s statement detected';
103
+ $phpcsFile->addError($error, $stackPtr, 'Detected'.ucfirst(strtolower($name)), array($name));
104
 
105
  }//end process()
106
 
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/ControlStructures/ControlSignatureSniff.php CHANGED
@@ -47,6 +47,7 @@ class Squiz_Sniffs_ControlStructures_ControlSignatureSniff implements PHP_CodeSn
47
  return array(
48
  T_TRY,
49
  T_CATCH,
 
50
  T_DO,
51
  T_WHILE,
52
  T_FOR,
47
  return array(
48
  T_TRY,
49
  T_CATCH,
50
+ T_FINALLY,
51
  T_DO,
52
  T_WHILE,
53
  T_FOR,
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/PHP/EmbeddedPhpSniff.php CHANGED
@@ -384,6 +384,10 @@ class Squiz_Sniffs_PHP_EmbeddedPhpSniff implements PHP_CodeSniffer_Sniff
384
  $trailingSpace = 0;
385
  if ($tokens[($closeTag - 1)]['code'] === T_WHITESPACE) {
386
  $trailingSpace = strlen($tokens[($closeTag - 1)]['content']);
 
 
 
 
387
  }
388
 
389
  if ($trailingSpace !== 1) {
@@ -393,6 +397,8 @@ class Squiz_Sniffs_PHP_EmbeddedPhpSniff implements PHP_CodeSniffer_Sniff
393
  if ($fix === true) {
394
  if ($trailingSpace === 0) {
395
  $phpcsFile->fixer->addContentBefore($closeTag, ' ');
 
 
396
  } else {
397
  $phpcsFile->fixer->replaceToken(($closeTag - 1), ' ');
398
  }
384
  $trailingSpace = 0;
385
  if ($tokens[($closeTag - 1)]['code'] === T_WHITESPACE) {
386
  $trailingSpace = strlen($tokens[($closeTag - 1)]['content']);
387
+ } else if ($tokens[($closeTag - 1)]['code'] === T_COMMENT
388
+ && substr($tokens[($closeTag - 1)]['content'], -1) === ' '
389
+ ) {
390
+ $trailingSpace = (strlen($tokens[($closeTag - 1)]['content']) - strlen(rtrim($tokens[($closeTag - 1)]['content'])));
391
  }
392
 
393
  if ($trailingSpace !== 1) {
397
  if ($fix === true) {
398
  if ($trailingSpace === 0) {
399
  $phpcsFile->fixer->addContentBefore($closeTag, ' ');
400
+ } else if ($tokens[($closeTag - 1)]['code'] === T_COMMENT) {
401
+ $phpcsFile->fixer->replaceToken(($closeTag - 1), rtrim($tokens[($closeTag - 1)]['content']).' ');
402
  } else {
403
  $phpcsFile->fixer->replaceToken(($closeTag - 1), ' ');
404
  }
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php CHANGED
@@ -138,6 +138,7 @@ class Squiz_Sniffs_Strings_DoubleQuoteUsageSniff implements PHP_CodeSniffer_Snif
138
  $phpcsFile->fixer->beginChangeset();
139
  $innerContent = substr($workingString, 1, -1);
140
  $innerContent = str_replace('\"', '"', $innerContent);
 
141
  $phpcsFile->fixer->replaceToken($stackPtr, "'$innerContent'");
142
  while ($lastStringToken !== $stackPtr) {
143
  $phpcsFile->fixer->replaceToken($lastStringToken, '');
138
  $phpcsFile->fixer->beginChangeset();
139
  $innerContent = substr($workingString, 1, -1);
140
  $innerContent = str_replace('\"', '"', $innerContent);
141
+ $innerContent = str_replace('\\$', '$', $innerContent);
142
  $phpcsFile->fixer->replaceToken($stackPtr, "'$innerContent'");
143
  while ($lastStringToken !== $stackPtr) {
144
  $phpcsFile->fixer->replaceToken($lastStringToken, '');
vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacingSniff.php CHANGED
@@ -59,6 +59,7 @@ class Squiz_Sniffs_WhiteSpace_ControlStructureSpacingSniff implements PHP_CodeSn
59
  T_ELSEIF,
60
  T_TRY,
61
  T_CATCH,
 
62
  );
63
 
64
  }//end register()
@@ -301,6 +302,7 @@ class Squiz_Sniffs_WhiteSpace_ControlStructureSpacingSniff implements PHP_CodeSn
301
  } else if ($tokens[$trailingContent]['code'] !== T_ELSE
302
  && $tokens[$trailingContent]['code'] !== T_ELSEIF
303
  && $tokens[$trailingContent]['code'] !== T_CATCH
 
304
  && $tokens[$trailingContent]['line'] === ($tokens[$scopeCloser]['line'] + 1)
305
  ) {
306
  $error = 'No blank line found after control structure';
59
  T_ELSEIF,
60
  T_TRY,
61
  T_CATCH,
62
+ T_FINALLY,
63
  );
64
 
65
  }//end register()
302
  } else if ($tokens[$trailingContent]['code'] !== T_ELSE
303
  && $tokens[$trailingContent]['code'] !== T_ELSEIF
304
  && $tokens[$trailingContent]['code'] !== T_CATCH
305
+ && $tokens[$trailingContent]['code'] !== T_FINALLY
306
  && $tokens[$trailingContent]['line'] === ($tokens[$scopeCloser]['line'] + 1)
307
  ) {
308
  $error = 'No blank line found after control structure';
vendor/squizlabs/php_codesniffer/CodeSniffer/Tokenizers/CSS.php CHANGED
@@ -390,7 +390,7 @@ class PHP_CodeSniffer_Tokenizers_CSS extends PHP_CodeSniffer_Tokenizers_PHP
390
 
391
  // Needs to be in the format "url(" for it to be a URL.
392
  if ($finalTokens[$x]['code'] !== T_OPEN_PARENTHESIS) {
393
- continue;
394
  }
395
 
396
  // Make sure the content isn't empty.
@@ -401,7 +401,7 @@ class PHP_CodeSniffer_Tokenizers_CSS extends PHP_CodeSniffer_Tokenizers_PHP
401
  }
402
 
403
  if ($finalTokens[$y]['code'] === T_CLOSE_PARENTHESIS) {
404
- continue;
405
  }
406
 
407
  if (PHP_CODESNIFFER_VERBOSITY > 1) {
390
 
391
  // Needs to be in the format "url(" for it to be a URL.
392
  if ($finalTokens[$x]['code'] !== T_OPEN_PARENTHESIS) {
393
+ continue 2;
394
  }
395
 
396
  // Make sure the content isn't empty.
401
  }
402
 
403
  if ($finalTokens[$y]['code'] === T_CLOSE_PARENTHESIS) {
404
+ continue 2;
405
  }
406
 
407
  if (PHP_CODESNIFFER_VERBOSITY > 1) {
wpengine-phpcompat.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin URI: https://wpengine.com
11
  * Description: Make sure your plugins and themes are compatible with newer PHP versions.
12
  * Author: WP Engine
13
- * Version: 1.5.0
14
  * Author URI: https://wpengine.com
15
  * Text Domain: php-compatibility-checker
16
  */
@@ -111,33 +111,14 @@ class WPEngine_PHPCompat {
111
  function get_phpversions() {
112
 
113
  $versions = array(
 
114
  'PHP 7.2' => '7.2',
115
  'PHP 7.1' => '7.1',
116
  'PHP 7.0' => '7.0',
117
  );
118
 
119
- if ( version_compare( phpversion(), '5.3', '>=' ) ) {
120
- $versions = array( 'PHP 7.3' => '7.3' ) + $versions;
121
- }
122
-
123
- $old_versions = array( '5.6', '5.5', '5.4', '5.3' );
124
-
125
- while ( ! empty( $old_versions ) ) {
126
- $oldest = array_pop( $old_versions );
127
-
128
- if ( version_compare( phpversion(), $oldest, '<' ) ) {
129
- array_push( $old_versions, $oldest );
130
-
131
- foreach ( $old_versions as $old_version ) {
132
- $old_version_label = "PHP {$old_version}";
133
-
134
- $versions[ $old_version_label ] = $old_version;
135
- }
136
- break;
137
- }
138
- }
139
-
140
  return apply_filters( 'phpcompat_phpversions', $versions );
 
141
  }
142
 
143
  /**
10
  * Plugin URI: https://wpengine.com
11
  * Description: Make sure your plugins and themes are compatible with newer PHP versions.
12
  * Author: WP Engine
13
+ * Version: 1.5.2
14
  * Author URI: https://wpengine.com
15
  * Text Domain: php-compatibility-checker
16
  */
111
  function get_phpversions() {
112
 
113
  $versions = array(
114
+ 'PHP 7.3' => '7.3',
115
  'PHP 7.2' => '7.2',
116
  'PHP 7.1' => '7.1',
117
  'PHP 7.0' => '7.0',
118
  );
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  return apply_filters( 'phpcompat_phpversions', $versions );
121
+
122
  }
123
 
124
  /**