PHP Compatibility Checker - Version 1.4.6

Version Description

  • Switched to new PHPCompatibilityWP library to help prevent false positives.
Download this release

Release Info

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

Code changes from version 1.4.5 to 1.4.6

Files changed (137) hide show
  1. php52/composer.json +22 -0
  2. php52/composer.lock +171 -0
  3. php52/vendor/autoload.php +1 -1
  4. php52/vendor/autoload_52.php +1 -1
  5. php52/vendor/composer/ClassLoader.php +2 -2
  6. php52/vendor/composer/autoload_real.php +4 -4
  7. php52/vendor/composer/autoload_real_52.php +3 -3
  8. php52/vendor/composer/autoload_static.php +5 -5
  9. php52/vendor/squizlabs/php_codesniffer/.gitattributes +13 -0
  10. php52/vendor/squizlabs/php_codesniffer/.gitignore +6 -0
  11. php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/.gitignore +5 -0
  12. php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/.travis.yml +107 -0
  13. php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/composer.json +26 -0
  14. php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/phpunit-travis.xml +16 -0
  15. php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/phpunit.xml +10 -0
  16. php52/vendor/squizlabs/php_codesniffer/composer.json +67 -0
  17. php52/vendor/wimg/php-compatibility/.gitignore +5 -0
  18. php52/vendor/wimg/php-compatibility/.travis.yml +107 -0
  19. php52/vendor/wimg/php-compatibility/composer.json +26 -0
  20. php52/vendor/wimg/php-compatibility/phpunit-travis.xml +16 -0
  21. php52/vendor/wimg/php-compatibility/phpunit.xml +10 -0
  22. php52/vendor/xrstf/composer-php52/.gitignore +1 -0
  23. php52/vendor/xrstf/composer-php52/composer.json +26 -0
  24. readme.txt +9 -7
  25. src/js/run.js +15 -4
  26. src/wpephpcompat.php +1 -0
  27. vendor/autoload.php +1 -1
  28. vendor/composer/ClassLoader.php +2 -2
  29. vendor/composer/autoload_namespaces.php +0 -1
  30. vendor/composer/autoload_psr4.php +2 -1
  31. vendor/composer/autoload_real.php +4 -4
  32. vendor/composer/autoload_static.php +11 -14
  33. vendor/composer/installed.json +170 -106
  34. vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md +21 -0
  35. vendor/dealerdirect/phpcodesniffer-composer-installer/README.md +221 -0
  36. vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json +51 -0
  37. vendor/dealerdirect/phpcodesniffer-composer-installer/phpcs.xml.dist +17 -0
  38. vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php +441 -0
  39. vendor/phpcompatibility/php-compatibility/.gitattributes +28 -0
  40. vendor/phpcompatibility/php-compatibility/.gitignore +7 -0
  41. vendor/phpcompatibility/php-compatibility/CHANGELOG.md +1019 -0
  42. vendor/phpcompatibility/php-compatibility/LICENSE +165 -0
  43. vendor/phpcompatibility/php-compatibility/PHPCSAliases.php +73 -0
  44. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php +132 -0
  45. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php +177 -0
  46. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php +108 -0
  47. vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php +148 -0
  48. vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php +77 -0
  49. vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php +573 -0
  50. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php +1842 -0
  51. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ArgumentFunctionsUsageSniff.php +163 -0
  52. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/CaseSensitiveKeywordsSniff.php +72 -0
  53. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ConstantArraysUsingConstSniff.php +77 -0
  54. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ConstantArraysUsingDefineSniff.php +96 -0
  55. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php +904 -0
  56. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php +338 -0
  57. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedMagicAutoloadSniff.php +80 -0
  58. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedNewReferenceSniff.php +78 -0
  59. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php +116 -0
  60. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedTypeCastsSniff.php +129 -0
  61. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DiscouragedSwitchContinueSniff.php +235 -0
  62. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DynamicAccessToStaticSniff.php +84 -0
  63. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/EmptyNonVariableSniff.php +164 -0
  64. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php +111 -0
  65. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueVariableArgumentsSniff.php +102 -0
  66. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php +233 -0
  67. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenClosureUseVariableNamesSniff.php +119 -0
  68. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenEmptyListAssignmentSniff.php +113 -0
  69. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenFunctionParametersWithSameNameSniff.php +88 -0
  70. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenGlobalVariableVariableSniff.php +122 -0
  71. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php +253 -0
  72. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php +189 -0
  73. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php +413 -0
  74. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNegativeBitshiftSniff.php +105 -0
  75. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php +80 -0
  76. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/InternalInterfacesSniff.php +95 -0
  77. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/LateStaticBindingSniff.php +81 -0
  78. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php +118 -0
  79. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewAnonymousClassesSniff.php +88 -0
  80. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewArrayStringDereferencingSniff.php +108 -0
  81. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClassMemberAccessSniff.php +121 -0
  82. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClassesSniff.php +818 -0
  83. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClosureSniff.php +238 -0
  84. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstVisibilitySniff.php +79 -0
  85. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstantScalarExpressionsSniff.php +565 -0
  86. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstantsSniff.php +3012 -0
  87. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewExecutionDirectivesSniff.php +336 -0
  88. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionArrayDereferencingSniff.php +94 -0
  89. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php +991 -0
  90. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php +1816 -0
  91. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewGeneratorReturnSniff.php +124 -0
  92. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewGroupUseDeclarationsSniff.php +104 -0
  93. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewHashAlgorithmsSniff.php +170 -0
  94. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewHeredocInitializeSniff.php +88 -0
  95. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewIniDirectivesSniff.php +627 -0
  96. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewInterfacesSniff.php +331 -0
  97. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewKeywordsSniff.php +372 -0
  98. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewLanguageConstructsSniff.php +306 -0
  99. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMagicClassConstantSniff.php +73 -0
  100. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMagicMethodsSniff.php +197 -0
  101. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMultiCatchSniff.php +77 -0
  102. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewNullableTypesSniff.php +163 -0
  103. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewReturnTypeDeclarationsSniff.php +174 -0
  104. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php +196 -0
  105. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewTrailingCommaSniff.php +123 -0
  106. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewTypeCastsSniff.php +199 -0
  107. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewUseConstFunctionSniff.php +101 -0
  108. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NonStaticMagicMethodsSniff.php +186 -0
  109. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/OptionalRequiredFunctionParametersSniff.php +162 -0
  110. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/PCRENewModifiersSniff.php +115 -0
  111. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ParameterShadowSuperGlobalsSniff.php +78 -0
  112. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php +218 -0
  113. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedAlternativePHPTagsSniff.php +169 -0
  114. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedConstantsSniff.php +343 -0
  115. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedExtensionsSniff.php +312 -0
  116. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php +214 -0
  117. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedGlobalVariablesSniff.php +305 -0
  118. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedHashAlgorithmsSniff.php +114 -0
  119. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RequiredOptionalFunctionParametersSniff.php +243 -0
  120. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ReservedFunctionNamesSniff.php +141 -0
  121. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ShortArraySniff.php +75 -0
  122. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/TernaryOperatorsSniff.php +72 -0
  123. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ValidIntegersSniff.php +222 -0
  124. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/VariableVariablesSniff.php +113 -0
  125. vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php +170 -0
  126. vendor/phpcompatibility/php-compatibility/PHPCompatibility/ruleset.xml +7 -0
  127. vendor/phpcompatibility/php-compatibility/README.md +212 -0
  128. vendor/phpcompatibility/php-compatibility/composer.json +39 -0
  129. vendor/phpcompatibility/phpcompatibility-wp/LICENSE +165 -0
  130. vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml +54 -0
  131. vendor/phpcompatibility/phpcompatibility-wp/README.md +98 -0
  132. vendor/phpcompatibility/phpcompatibility-wp/composer.json +28 -0
  133. vendor/squizlabs/php_codesniffer/.gitattributes +13 -0
  134. vendor/squizlabs/php_codesniffer/.gitignore +6 -0
  135. vendor/squizlabs/php_codesniffer/CodeSniffer.conf +1 -1
  136. vendor/squizlabs/php_codesniffer/composer.json +67 -0
  137. wpengine-phpcompat.php +14 -1
php52/composer.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "require": {
3
+ "squizlabs/php_codesniffer": "2.9.*",
4
+ "wimg/php-compatibility": "7.1.5",
5
+ "xrstf/composer-php52": "1.*"
6
+ },
7
+ "scripts": {
8
+ "post-update-cmd": [
9
+ "xrstf\\Composer52\\Generator::onPostInstallCmd",
10
+ "vendor/bin/phpcs --config-delete installed_paths",
11
+ "rm -rf vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; cp -rp vendor/wimg/php-compatibility vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility"
12
+ ],
13
+ "post-install-cmd": [
14
+ "xrstf\\Composer52\\Generator::onPostInstallCmd",
15
+ "vendor/bin/phpcs --config-delete installed_paths",
16
+ "rm -rf vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; cp -rp vendor/wimg/php-compatibility vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility"
17
+ ],
18
+ "post-autoload-dump": [
19
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
20
+ ]
21
+ }
22
+ }
php52/composer.lock ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "937367a108bb97c748a6156b5d542002",
8
+ "packages": [
9
+ {
10
+ "name": "squizlabs/php_codesniffer",
11
+ "version": "2.9.1",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
15
+ "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62",
20
+ "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "ext-simplexml": "*",
25
+ "ext-tokenizer": "*",
26
+ "ext-xmlwriter": "*",
27
+ "php": ">=5.1.2"
28
+ },
29
+ "require-dev": {
30
+ "phpunit/phpunit": "~4.0"
31
+ },
32
+ "bin": [
33
+ "scripts/phpcs",
34
+ "scripts/phpcbf"
35
+ ],
36
+ "type": "library",
37
+ "extra": {
38
+ "branch-alias": {
39
+ "dev-master": "2.x-dev"
40
+ }
41
+ },
42
+ "autoload": {
43
+ "classmap": [
44
+ "CodeSniffer.php",
45
+ "CodeSniffer/CLI.php",
46
+ "CodeSniffer/Exception.php",
47
+ "CodeSniffer/File.php",
48
+ "CodeSniffer/Fixer.php",
49
+ "CodeSniffer/Report.php",
50
+ "CodeSniffer/Reporting.php",
51
+ "CodeSniffer/Sniff.php",
52
+ "CodeSniffer/Tokens.php",
53
+ "CodeSniffer/Reports/",
54
+ "CodeSniffer/Tokenizers/",
55
+ "CodeSniffer/DocGenerators/",
56
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
57
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
58
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
59
+ "CodeSniffer/Standards/IncorrectPatternException.php",
60
+ "CodeSniffer/Standards/Generic/Sniffs/",
61
+ "CodeSniffer/Standards/MySource/Sniffs/",
62
+ "CodeSniffer/Standards/PEAR/Sniffs/",
63
+ "CodeSniffer/Standards/PSR1/Sniffs/",
64
+ "CodeSniffer/Standards/PSR2/Sniffs/",
65
+ "CodeSniffer/Standards/Squiz/Sniffs/",
66
+ "CodeSniffer/Standards/Zend/Sniffs/"
67
+ ]
68
+ },
69
+ "notification-url": "https://packagist.org/downloads/",
70
+ "license": [
71
+ "BSD-3-Clause"
72
+ ],
73
+ "authors": [
74
+ {
75
+ "name": "Greg Sherwood",
76
+ "role": "lead"
77
+ }
78
+ ],
79
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
80
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
81
+ "keywords": [
82
+ "phpcs",
83
+ "standards"
84
+ ],
85
+ "time": "2017-05-22T02:43:20+00:00"
86
+ },
87
+ {
88
+ "name": "wimg/php-compatibility",
89
+ "version": "7.1.5",
90
+ "source": {
91
+ "type": "git",
92
+ "url": "https://github.com/wimg/PHPCompatibility.git",
93
+ "reference": "1649732fb1a2115608dfe805a644e4405fb6444b"
94
+ },
95
+ "dist": {
96
+ "type": "zip",
97
+ "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/1649732fb1a2115608dfe805a644e4405fb6444b",
98
+ "reference": "1649732fb1a2115608dfe805a644e4405fb6444b",
99
+ "shasum": ""
100
+ },
101
+ "require": {
102
+ "ext-tokenizer": "*",
103
+ "php": ">=5.1.2",
104
+ "squizlabs/php_codesniffer": "^2.0"
105
+ },
106
+ "type": "phpcodesniffer-standard",
107
+ "autoload": {
108
+ "psr-4": {
109
+ "PHPCompatibility\\": ""
110
+ }
111
+ },
112
+ "notification-url": "https://packagist.org/downloads/",
113
+ "license": [
114
+ "LGPL-3.0"
115
+ ],
116
+ "authors": [
117
+ {
118
+ "name": "Wim Godden",
119
+ "role": "lead"
120
+ }
121
+ ],
122
+ "description": "This is a set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
123
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
124
+ "keywords": [
125
+ "compatibility",
126
+ "phpcs",
127
+ "standards"
128
+ ],
129
+ "time": "2017-07-15T23:03:53+00:00"
130
+ },
131
+ {
132
+ "name": "xrstf/composer-php52",
133
+ "version": "v1.0.20",
134
+ "source": {
135
+ "type": "git",
136
+ "url": "https://github.com/composer-php52/composer-php52.git",
137
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
138
+ },
139
+ "dist": {
140
+ "type": "zip",
141
+ "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
142
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
143
+ "shasum": ""
144
+ },
145
+ "type": "library",
146
+ "extra": {
147
+ "branch-alias": {
148
+ "dev-default": "1.x-dev"
149
+ }
150
+ },
151
+ "autoload": {
152
+ "psr-0": {
153
+ "xrstf\\Composer52": "lib/"
154
+ }
155
+ },
156
+ "notification-url": "https://packagist.org/downloads/",
157
+ "license": [
158
+ "MIT"
159
+ ],
160
+ "time": "2016-04-16T21:52:24+00:00"
161
+ }
162
+ ],
163
+ "packages-dev": [],
164
+ "aliases": [],
165
+ "minimum-stability": "stable",
166
+ "stability-flags": [],
167
+ "prefer-stable": false,
168
+ "prefer-lowest": false,
169
+ "platform": [],
170
+ "platform-dev": []
171
+ }
php52/vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit9822e31ee142ea70a5a882638b9cf0bf::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit86b8ad330e39a59baeaf1244fe586115::getLoader();
php52/vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInita4ae2997dc6cca14c59c813063e62e17::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitae6f84bfc58da458e326cb01eed119a8::getLoader();
php52/vendor/composer/ClassLoader.php CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
php52/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit9822e31ee142ea70a5a882638b9cf0bf
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit9822e31ee142ea70a5a882638b9cf0bf
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit9822e31ee142ea70a5a882638b9cf0bf', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit9822e31ee142ea70a5a882638b9cf0bf', '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\ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf::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 ComposerAutoloaderInit86b8ad330e39a59baeaf1244fe586115
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit86b8ad330e39a59baeaf1244fe586115', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit86b8ad330e39a59baeaf1244fe586115', '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\ComposerStaticInit86b8ad330e39a59baeaf1244fe586115::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
php52/vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInita4ae2997dc6cca14c59c813063e62e17 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInita4ae2997dc6cca14c59c813063e62e17 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInita4ae2997dc6cca14c59c813063e62e17', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInita4ae2997dc6cca14c59c813063e62e17', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInitae6f84bfc58da458e326cb01eed119a8 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitae6f84bfc58da458e326cb01eed119a8', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitae6f84bfc58da458e326cb01eed119a8', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
php52/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -288,10 +288,10 @@ class ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf
288
  public static function getInitializer(ClassLoader $loader)
289
  {
290
  return \Closure::bind(function () use ($loader) {
291
- $loader->prefixLengthsPsr4 = ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf::$prefixLengthsPsr4;
292
- $loader->prefixDirsPsr4 = ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf::$prefixDirsPsr4;
293
- $loader->prefixesPsr0 = ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf::$prefixesPsr0;
294
- $loader->classMap = ComposerStaticInit9822e31ee142ea70a5a882638b9cf0bf::$classMap;
295
 
296
  }, null, ClassLoader::class);
297
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit86b8ad330e39a59baeaf1244fe586115
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
288
  public static function getInitializer(ClassLoader $loader)
289
  {
290
  return \Closure::bind(function () use ($loader) {
291
+ $loader->prefixLengthsPsr4 = ComposerStaticInit86b8ad330e39a59baeaf1244fe586115::$prefixLengthsPsr4;
292
+ $loader->prefixDirsPsr4 = ComposerStaticInit86b8ad330e39a59baeaf1244fe586115::$prefixDirsPsr4;
293
+ $loader->prefixesPsr0 = ComposerStaticInit86b8ad330e39a59baeaf1244fe586115::$prefixesPsr0;
294
+ $loader->classMap = ComposerStaticInit86b8ad330e39a59baeaf1244fe586115::$classMap;
295
 
296
  }, null, ClassLoader::class);
297
  }
php52/vendor/squizlabs/php_codesniffer/.gitattributes ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /tests export-ignore
2
+ /CodeSniffer/Standards/Generic/Tests export-ignore
3
+ /CodeSniffer/Standards/MySource/Tests export-ignore
4
+ /CodeSniffer/Standards/PEAR/Tests export-ignore
5
+ /CodeSniffer/Standards/PSR1/Tests export-ignore
6
+ /CodeSniffer/Standards/PSR2/Tests export-ignore
7
+ /CodeSniffer/Standards/Squiz/Tests export-ignore
8
+ /CodeSniffer/Standards/Zend/Tests export-ignore
9
+ .travis.yml export-ignore
10
+ package.xml export-ignore
11
+ phpunit.xml.dist export-ignore
12
+ php5-testingConfig.ini export-ignore
13
+ php7-testingConfig.ini export-ignore
php52/vendor/squizlabs/php_codesniffer/.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /CodeSniffer.conf
2
+ /phpcs.xml
3
+ /phpunit.xml
4
+ .idea/*
5
+ /vendor/
6
+ composer.lock
php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .idea/*
2
+ /vendor/
3
+ composer.phar
4
+ composer.lock
5
+ *~
php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/.travis.yml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sudo: false
2
+
3
+ language: php
4
+
5
+ matrix:
6
+ fast_finish: true
7
+ include:
8
+
9
+ - php: 5.2
10
+ env: PHPCS_VERSION="1.5.6"
11
+ - php: 5.2
12
+ env: PHPCS_VERSION="2.9"
13
+
14
+ - php: 5.3
15
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="~1.0"
16
+ - php: 5.3
17
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="~1.0"
18
+
19
+ - php: 5.4
20
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="~1.0"
21
+ - php: 5.4
22
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="~1.0"
23
+
24
+ - php: 5.5
25
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
26
+ - php: 5.5
27
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
28
+ - php: 5.5
29
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
30
+
31
+ - php: 5.6
32
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
33
+ - php: 5.6
34
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
35
+ - php: 5.6
36
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
37
+
38
+ - php: 7.0
39
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
40
+ - php: 7.0
41
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
42
+ - php: 7.0
43
+ env: PHPCS_VERSION="2.9.x-dev" SNIFF=1 COVERALLS_VERSION="dev-master"
44
+
45
+ - php: 7.1
46
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
47
+ - php: 7.1
48
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
49
+ - php: 7.1
50
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
51
+
52
+ - php: nightly
53
+ env: PHPCS_VERSION=">=1.5.1,<2.0"
54
+ - php: nightly
55
+ env: PHPCS_VERSION=">=2.0,<3.0"
56
+ - php: nightly
57
+ env: PHPCS_VERSION="2.9.x-dev"
58
+
59
+ - php: hhvm
60
+ dist: trusty
61
+ env: PHPCS_VERSION=">=1.5.1,<2.0"
62
+ - php: hhvm
63
+ dist: trusty
64
+ env: PHPCS_VERSION="2.9.x-dev"
65
+
66
+ allow_failures:
67
+ # Allow failures for unstable builds.
68
+ - php: nightly
69
+ - php: hhvm
70
+
71
+ before_install:
72
+ - export XMLLINT_INDENT=" "
73
+ # PHP 5.3+: set up test environment using Composer.
74
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer self-update; fi
75
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" && $COVERALLS_VERSION ]]; then composer require --dev satooshi/php-coveralls:${COVERALLS_VERSION};fi
76
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer require squizlabs/php_codesniffer:${PHPCS_VERSION}; fi
77
+ - if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then composer require phpunit/phpunit:~4.0; fi
78
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer install; fi
79
+ # PHP 5.2: set up test environment using git cloning.
80
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then export PHPCS_DIR=/tmp/phpcs; fi
81
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then export PHPCS_BIN=$PHPCS_DIR/scripts/phpcs; fi
82
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then mkdir -p $PHPCS_DIR && git clone --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git -b $PHPCS_VERSION $PHPCS_DIR; fi
83
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then $PHPCS_BIN --config-set installed_paths "$(dirname "$(pwd)")"; fi
84
+
85
+ before_script:
86
+ - if [[ $COVERALLS_VERSION ]]; then mkdir -p build/logs; fi
87
+ - phpenv rehash
88
+
89
+ script:
90
+ # Lint all PHP files against parse errors.
91
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then ln -s `pwd` vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; fi
92
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
93
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./Tests/PHPUnit6Compat.php -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
94
+ # Check the code style of the code base.
95
+ - if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs . --standard=./phpcs.xml --runtime-set ignore_warnings_on_exit 1; fi
96
+ # Run the unit tests.
97
+ - if [[ $COVERALLS_VERSION ]]; then phpunit --configuration phpunit-travis.xml --coverage-clover build/logs/clover.xml; fi
98
+ - if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpunit --configuration phpunit.xml; fi
99
+ - if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then vendor/bin/phpunit --configuration phpunit.xml; fi
100
+ # Validate the xml file.
101
+ # @link http://xmlsoft.org/xmllint.html
102
+ - if [[ "$SNIFF" == "1" ]]; then xmllint --noout ./ruleset.xml; fi
103
+ # Check the code-style consistency of the xml files.
104
+ - if [[ "$SNIFF" == "1" ]]; then diff -B ./ruleset.xml <(xmllint --format "./ruleset.xml"); fi
105
+
106
+ after_success:
107
+ - if [[ $COVERALLS_VERSION ]]; then php vendor/bin/coveralls -v -x build/logs/clover.xml; fi
php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name" : "wimg/php-compatibility",
3
+ "description" : "This is a set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
4
+ "require" : {
5
+ "php" : ">=5.1.2",
6
+ "ext-tokenizer" : "*",
7
+ "squizlabs/php_codesniffer" : "^2.0"
8
+ },
9
+ "license" : "LGPL-3.0",
10
+ "keywords" : [ "compatibility", "phpcs", "standards" ],
11
+ "autoload" : {
12
+ "psr-4" : {
13
+ "PHPCompatibility\\" : ""
14
+ }
15
+ },
16
+ "type" : "phpcodesniffer-standard",
17
+ "support" : {
18
+ "issues" : "https://github.com/wimg/PHPCompatibility/issues",
19
+ "source" : "https://github.com/wimg/PHPCompatibility"
20
+ },
21
+ "authors" : [ {
22
+ "name" : "Wim Godden",
23
+ "role" : "lead"
24
+ } ],
25
+ "homepage" : "http://techblog.wimgodden.be/tag/codesniffer/"
26
+ }
php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/phpunit-travis.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit bootstrap="Tests/bootstrap.php" colors="true" backupGlobals="true">
4
+ <testsuites>
5
+ <testsuite name="PHPCompatibility Sniffs Tests">
6
+ <directory>./Tests/</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ <filter>
10
+ <whitelist addUncoveredFilesFromWhitelist="true">
11
+ <directory>./Sniffs/</directory>
12
+ </whitelist>
13
+ </filter>
14
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
15
+ </phpunit>
16
+
php52/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility/phpunit.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit bootstrap="Tests/bootstrap.php" colors="true" backupGlobals="true">
4
+ <testsuites>
5
+ <testsuite name="PHPCompatibility Sniffs Tests">
6
+ <directory>./Tests/</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ </phpunit>
10
+
php52/vendor/squizlabs/php_codesniffer/composer.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "squizlabs/php_codesniffer",
3
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
4
+ "type": "library",
5
+ "keywords": [
6
+ "phpcs",
7
+ "standards"
8
+ ],
9
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
10
+ "license": "BSD-3-Clause",
11
+ "authors": [
12
+ {
13
+ "name": "Greg Sherwood",
14
+ "role": "lead"
15
+ }
16
+ ],
17
+ "support": {
18
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
19
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
20
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer"
21
+ },
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "2.x-dev"
25
+ }
26
+ },
27
+ "autoload": {
28
+ "classmap": [
29
+ "CodeSniffer.php",
30
+ "CodeSniffer/CLI.php",
31
+ "CodeSniffer/Exception.php",
32
+ "CodeSniffer/File.php",
33
+ "CodeSniffer/Fixer.php",
34
+ "CodeSniffer/Report.php",
35
+ "CodeSniffer/Reporting.php",
36
+ "CodeSniffer/Sniff.php",
37
+ "CodeSniffer/Tokens.php",
38
+ "CodeSniffer/Reports/",
39
+ "CodeSniffer/Tokenizers/",
40
+ "CodeSniffer/DocGenerators/",
41
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
42
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
43
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
44
+ "CodeSniffer/Standards/IncorrectPatternException.php",
45
+ "CodeSniffer/Standards/Generic/Sniffs/",
46
+ "CodeSniffer/Standards/MySource/Sniffs/",
47
+ "CodeSniffer/Standards/PEAR/Sniffs/",
48
+ "CodeSniffer/Standards/PSR1/Sniffs/",
49
+ "CodeSniffer/Standards/PSR2/Sniffs/",
50
+ "CodeSniffer/Standards/Squiz/Sniffs/",
51
+ "CodeSniffer/Standards/Zend/Sniffs/"
52
+ ]
53
+ },
54
+ "require": {
55
+ "php": ">=5.1.2",
56
+ "ext-tokenizer": "*",
57
+ "ext-xmlwriter": "*",
58
+ "ext-simplexml": "*"
59
+ },
60
+ "require-dev": {
61
+ "phpunit/phpunit": "~4.0"
62
+ },
63
+ "bin": [
64
+ "scripts/phpcs",
65
+ "scripts/phpcbf"
66
+ ]
67
+ }
php52/vendor/wimg/php-compatibility/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ .idea/*
2
+ /vendor/
3
+ composer.phar
4
+ composer.lock
5
+ *~
php52/vendor/wimg/php-compatibility/.travis.yml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sudo: false
2
+
3
+ language: php
4
+
5
+ matrix:
6
+ fast_finish: true
7
+ include:
8
+
9
+ - php: 5.2
10
+ env: PHPCS_VERSION="1.5.6"
11
+ - php: 5.2
12
+ env: PHPCS_VERSION="2.9"
13
+
14
+ - php: 5.3
15
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="~1.0"
16
+ - php: 5.3
17
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="~1.0"
18
+
19
+ - php: 5.4
20
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="~1.0"
21
+ - php: 5.4
22
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="~1.0"
23
+
24
+ - php: 5.5
25
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
26
+ - php: 5.5
27
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
28
+ - php: 5.5
29
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
30
+
31
+ - php: 5.6
32
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
33
+ - php: 5.6
34
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
35
+ - php: 5.6
36
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
37
+
38
+ - php: 7.0
39
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
40
+ - php: 7.0
41
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
42
+ - php: 7.0
43
+ env: PHPCS_VERSION="2.9.x-dev" SNIFF=1 COVERALLS_VERSION="dev-master"
44
+
45
+ - php: 7.1
46
+ env: PHPCS_VERSION=">=1.5.1,<2.0" COVERALLS_VERSION="dev-master"
47
+ - php: 7.1
48
+ env: PHPCS_VERSION=">=2.0,<3.0" COVERALLS_VERSION="dev-master"
49
+ - php: 7.1
50
+ env: PHPCS_VERSION="2.9.x-dev" COVERALLS_VERSION="dev-master"
51
+
52
+ - php: nightly
53
+ env: PHPCS_VERSION=">=1.5.1,<2.0"
54
+ - php: nightly
55
+ env: PHPCS_VERSION=">=2.0,<3.0"
56
+ - php: nightly
57
+ env: PHPCS_VERSION="2.9.x-dev"
58
+
59
+ - php: hhvm
60
+ dist: trusty
61
+ env: PHPCS_VERSION=">=1.5.1,<2.0"
62
+ - php: hhvm
63
+ dist: trusty
64
+ env: PHPCS_VERSION="2.9.x-dev"
65
+
66
+ allow_failures:
67
+ # Allow failures for unstable builds.
68
+ - php: nightly
69
+ - php: hhvm
70
+
71
+ before_install:
72
+ - export XMLLINT_INDENT=" "
73
+ # PHP 5.3+: set up test environment using Composer.
74
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer self-update; fi
75
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" && $COVERALLS_VERSION ]]; then composer require --dev satooshi/php-coveralls:${COVERALLS_VERSION};fi
76
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer require squizlabs/php_codesniffer:${PHPCS_VERSION}; fi
77
+ - if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then composer require phpunit/phpunit:~4.0; fi
78
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then composer install; fi
79
+ # PHP 5.2: set up test environment using git cloning.
80
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then export PHPCS_DIR=/tmp/phpcs; fi
81
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then export PHPCS_BIN=$PHPCS_DIR/scripts/phpcs; fi
82
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then mkdir -p $PHPCS_DIR && git clone --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git -b $PHPCS_VERSION $PHPCS_DIR; fi
83
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then $PHPCS_BIN --config-set installed_paths "$(dirname "$(pwd)")"; fi
84
+
85
+ before_script:
86
+ - if [[ $COVERALLS_VERSION ]]; then mkdir -p build/logs; fi
87
+ - phpenv rehash
88
+
89
+ script:
90
+ # Lint all PHP files against parse errors.
91
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then ln -s `pwd` vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility; fi
92
+ - if [[ $TRAVIS_PHP_VERSION > "5.2" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
93
+ - if [[ $TRAVIS_PHP_VERSION < "5.3" ]]; then find -L . -path ./Tests/sniff-examples -prune -o -path ./Tests/PHPUnit6Compat.php -prune -o -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l; fi
94
+ # Check the code style of the code base.
95
+ - if [[ "$SNIFF" == "1" ]]; then vendor/bin/phpcs . --standard=./phpcs.xml --runtime-set ignore_warnings_on_exit 1; fi
96
+ # Run the unit tests.
97
+ - if [[ $COVERALLS_VERSION ]]; then phpunit --configuration phpunit-travis.xml --coverage-clover build/logs/clover.xml; fi
98
+ - if [[ $TRAVIS_PHP_VERSION == "5.2" || $TRAVIS_PHP_VERSION == "nightly" ]]; then phpunit --configuration phpunit.xml; fi
99
+ - if [[ $TRAVIS_PHP_VERSION == hhv* ]]; then vendor/bin/phpunit --configuration phpunit.xml; fi
100
+ # Validate the xml file.
101
+ # @link http://xmlsoft.org/xmllint.html
102
+ - if [[ "$SNIFF" == "1" ]]; then xmllint --noout ./ruleset.xml; fi
103
+ # Check the code-style consistency of the xml files.
104
+ - if [[ "$SNIFF" == "1" ]]; then diff -B ./ruleset.xml <(xmllint --format "./ruleset.xml"); fi
105
+
106
+ after_success:
107
+ - if [[ $COVERALLS_VERSION ]]; then php vendor/bin/coveralls -v -x build/logs/clover.xml; fi
php52/vendor/wimg/php-compatibility/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name" : "wimg/php-compatibility",
3
+ "description" : "This is a set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
4
+ "require" : {
5
+ "php" : ">=5.1.2",
6
+ "ext-tokenizer" : "*",
7
+ "squizlabs/php_codesniffer" : "^2.0"
8
+ },
9
+ "license" : "LGPL-3.0",
10
+ "keywords" : [ "compatibility", "phpcs", "standards" ],
11
+ "autoload" : {
12
+ "psr-4" : {
13
+ "PHPCompatibility\\" : ""
14
+ }
15
+ },
16
+ "type" : "phpcodesniffer-standard",
17
+ "support" : {
18
+ "issues" : "https://github.com/wimg/PHPCompatibility/issues",
19
+ "source" : "https://github.com/wimg/PHPCompatibility"
20
+ },
21
+ "authors" : [ {
22
+ "name" : "Wim Godden",
23
+ "role" : "lead"
24
+ } ],
25
+ "homepage" : "http://techblog.wimgodden.be/tag/codesniffer/"
26
+ }
php52/vendor/wimg/php-compatibility/phpunit-travis.xml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit bootstrap="Tests/bootstrap.php" colors="true" backupGlobals="true">
4
+ <testsuites>
5
+ <testsuite name="PHPCompatibility Sniffs Tests">
6
+ <directory>./Tests/</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ <filter>
10
+ <whitelist addUncoveredFilesFromWhitelist="true">
11
+ <directory>./Sniffs/</directory>
12
+ </whitelist>
13
+ </filter>
14
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
15
+ </phpunit>
16
+
php52/vendor/wimg/php-compatibility/phpunit.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit bootstrap="Tests/bootstrap.php" colors="true" backupGlobals="true">
4
+ <testsuites>
5
+ <testsuite name="PHPCompatibility Sniffs Tests">
6
+ <directory>./Tests/</directory>
7
+ </testsuite>
8
+ </testsuites>
9
+ </phpunit>
10
+
php52/vendor/xrstf/composer-php52/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ /vendor/
php52/vendor/xrstf/composer-php52/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "xrstf/composer-php52",
3
+ "license": "MIT",
4
+ "support": {
5
+ "source": "https://github.com/composer-php52/composer-php52",
6
+ "issues": "https://github.com/composer-php52/composer-php52/issues"
7
+ },
8
+ "autoload": {
9
+ "psr-0": {
10
+ "xrstf\\Composer52": "lib/"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "post-install-cmd": [
15
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
16
+ ],
17
+ "post-update-cmd": [
18
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
19
+ ]
20
+ },
21
+ "extra": {
22
+ "branch-alias": {
23
+ "dev-default": "1.x-dev"
24
+ }
25
+ }
26
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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: 4.9
6
- Stable tag: 1.4.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -21,8 +21,8 @@ This plugin will lint theme and plugin code inside your WordPress file system an
21
 
22
  **This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site's WP-Cron isn't running correctly. Please see the [FAQ](https://wordpress.org/plugins/php-compatibility-checker/faq/) for more information.**
23
 
24
- = Update to PHP 7 =
25
- * Use this plugin to check your site for compatibility for PHP 7!
26
  * As of [November 2016](https://wordpress.org/about/stats/), 52.9% of WordPress websites run a PHP version less PHP 5.5.
27
  * These versions of PHP have been deprecated and unsupported for over 9 months.
28
  * Only 3.4% of WordPress websites run PHP 7, the current main version of PHP.
@@ -64,7 +64,7 @@ PHP Compatibility Checker includes WP-CLI command support:
64
  - active
65
  - all
66
  `
67
- Example: `wp phpcompat 7.0 --scan=active`
68
 
69
 
70
  == Frequently Asked Questions ==
@@ -114,6 +114,9 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
114
 
115
  == Changelog ==
116
 
 
 
 
117
  = 1.4.5 =
118
  - Use plugin version number to enqueue scripts and styles.
119
 
@@ -201,6 +204,5 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
201
 
202
  == Upgrade Notice ==
203
 
204
- = 1.4.1 =
205
- - Updated PHP_CodeSniffer to fix a security advisory.
206
- - Whitelisted a number of plugins.
3
  Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
+ Stable tag: 1.4.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
21
 
22
  **This plugin relies on WP-Cron to scan files in the background. The scan will get stuck if the site's WP-Cron isn't running correctly. Please see the [FAQ](https://wordpress.org/plugins/php-compatibility-checker/faq/) for more information.**
23
 
24
+ = Update to PHP 7.2 =
25
+ * Use this plugin to check your site for compatibility up to PHP 7.2!
26
  * As of [November 2016](https://wordpress.org/about/stats/), 52.9% of WordPress websites run a PHP version less PHP 5.5.
27
  * These versions of PHP have been deprecated and unsupported for over 9 months.
28
  * Only 3.4% of WordPress websites run PHP 7, the current main version of PHP.
64
  - active
65
  - all
66
  `
67
+ Example: `wp phpcompat 7.2 --scan=active`
68
 
69
 
70
  == Frequently Asked Questions ==
114
 
115
  == Changelog ==
116
 
117
+ = 1.4.6 =
118
+ - Switched to new PHPCompatibilityWP library to help prevent false positives.
119
+
120
  = 1.4.5 =
121
  - Use plugin version number to enqueue scripts and styles.
122
 
204
 
205
  == Upgrade Notice ==
206
 
207
+ = 1.4.6 =
208
+ - Switched to new PHPCompatibilityWP library to help prevent false positives.
 
src/js/run.js CHANGED
@@ -58,6 +58,14 @@ jQuery( document ).ready(function($) {
58
  });
59
 
60
  });
 
 
 
 
 
 
 
 
61
  /**
62
  * Check the scan status and display results if scan is done.
63
  */
@@ -68,6 +76,12 @@ function checkStatus() {
68
 
69
  var obj;
70
  jQuery.post( ajaxurl, data, function( obj ) {
 
 
 
 
 
 
71
  /*
72
  * Status false: the test is not running and has not been run yet
73
  * Status 1: the test is currently running
@@ -101,10 +115,7 @@ function checkStatus() {
101
  // Display the object being scanned.
102
  jQuery( '#wpe-progress-active' ).html( '<strong>Now scanning:</strong> ' + obj.activeJob );
103
 
104
- // Requeue the checkStatus call.
105
- timer = setTimeout(function() {
106
- checkStatus();
107
- }, 5000);
108
  }
109
  }, 'json' ).fail(function ( xhr, status, error )
110
  {
58
  });
59
 
60
  });
61
+
62
+ function startTimer() {
63
+ // Requeue the checkStatus call.
64
+ timer = setTimeout(function() {
65
+ checkStatus();
66
+ }, 5000);
67
+ }
68
+
69
  /**
70
  * Check the scan status and display results if scan is done.
71
  */
76
 
77
  var obj;
78
  jQuery.post( ajaxurl, data, function( obj ) {
79
+ // TODO: Without jQuery migrate an empty response can throw a JSON parse error.
80
+ // So we should do the parsing manually.
81
+ if ( !obj ) {
82
+ startTimer();
83
+ return;
84
+ }
85
  /*
86
  * Status false: the test is not running and has not been run yet
87
  * Status 1: the test is currently running
115
  // Display the object being scanned.
116
  jQuery( '#wpe-progress-active' ).html( '<strong>Now scanning:</strong> ' + obj.activeJob );
117
 
118
+ startTimer();
 
 
 
119
  }
120
  }, 'json' ).fail(function ( xhr, status, error )
121
  {
src/wpephpcompat.php CHANGED
@@ -91,6 +91,7 @@ class WPEPHPCompat {
91
  '*/give/*' => '7.0', // https://github.com/wpengine/phpcompat/issues/148
92
  '*/woocommerce-pdf-invoices-packing-slips/*' => '7.0', // https://github.com/wpengine/phpcompat/issues/160
93
  '*/iwp-client/*' => '7.0', // https://wordpress.org/support/topic/iwp-client-and-php-7-compatibility/
 
94
  );
95
 
96
  /**
91
  '*/give/*' => '7.0', // https://github.com/wpengine/phpcompat/issues/148
92
  '*/woocommerce-pdf-invoices-packing-slips/*' => '7.0', // https://github.com/wpengine/phpcompat/issues/160
93
  '*/iwp-client/*' => '7.0', // https://wordpress.org/support/topic/iwp-client-and-php-7-compatibility/
94
+ '*/health-check/*' => '7.2', // https://github.com/wpengine/phpcompat/issues/179
95
  );
96
 
97
  /**
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit6569350c290f3ede4f21d455ef891fb8::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit57cc78f2f1c527f7b3892d3c7f254998::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
vendor/composer/autoload_namespaces.php CHANGED
@@ -6,5 +6,4 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'SimplyAdmire\\ComposerPlugins' => array($vendorDir . '/simplyadmire/composer-plugins'),
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
vendor/composer/autoload_psr4.php CHANGED
@@ -6,5 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
- 'PHPCompatibility\\' => array($vendorDir . '/wimg/php-compatibility/PHPCompatibility'),
 
10
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'PHPCompatibility\\' => array($vendorDir . '/phpcompatibility/php-compatibility/PHPCompatibility'),
10
+ 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array($vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src'),
11
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit6569350c290f3ede4f21d455ef891fb8
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit6569350c290f3ede4f21d455ef891fb8
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit6569350c290f3ede4f21d455ef891fb8', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit6569350c290f3ede4f21d455ef891fb8', '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\ComposerStaticInit6569350c290f3ede4f21d455ef891fb8::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 ComposerAutoloaderInit57cc78f2f1c527f7b3892d3c7f254998
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit57cc78f2f1c527f7b3892d3c7f254998', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit57cc78f2f1c527f7b3892d3c7f254998', '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\ComposerStaticInit57cc78f2f1c527f7b3892d3c7f254998::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,29 +4,27 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit6569350c290f3ede4f21d455ef891fb8
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
11
  array (
12
  'PHPCompatibility\\' => 17,
13
  ),
 
 
 
 
14
  );
15
 
16
  public static $prefixDirsPsr4 = array (
17
  'PHPCompatibility\\' =>
18
  array (
19
- 0 => __DIR__ . '/..' . '/wimg/php-compatibility/PHPCompatibility',
20
  ),
21
- );
22
-
23
- public static $prefixesPsr0 = array (
24
- 'S' =>
25
  array (
26
- 'SimplyAdmire\\ComposerPlugins' =>
27
- array (
28
- 0 => __DIR__ . '/..' . '/simplyadmire/composer-plugins',
29
- ),
30
  ),
31
  );
32
 
@@ -288,10 +286,9 @@ class ComposerStaticInit6569350c290f3ede4f21d455ef891fb8
288
  public static function getInitializer(ClassLoader $loader)
289
  {
290
  return \Closure::bind(function () use ($loader) {
291
- $loader->prefixLengthsPsr4 = ComposerStaticInit6569350c290f3ede4f21d455ef891fb8::$prefixLengthsPsr4;
292
- $loader->prefixDirsPsr4 = ComposerStaticInit6569350c290f3ede4f21d455ef891fb8::$prefixDirsPsr4;
293
- $loader->prefixesPsr0 = ComposerStaticInit6569350c290f3ede4f21d455ef891fb8::$prefixesPsr0;
294
- $loader->classMap = ComposerStaticInit6569350c290f3ede4f21d455ef891fb8::$classMap;
295
 
296
  }, null, ClassLoader::class);
297
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit57cc78f2f1c527f7b3892d3c7f254998
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
11
  array (
12
  'PHPCompatibility\\' => 17,
13
  ),
14
+ 'D' =>
15
+ array (
16
+ 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 55,
17
+ ),
18
  );
19
 
20
  public static $prefixDirsPsr4 = array (
21
  'PHPCompatibility\\' =>
22
  array (
23
+ 0 => __DIR__ . '/..' . '/phpcompatibility/php-compatibility/PHPCompatibility',
24
  ),
25
+ 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' =>
 
 
 
26
  array (
27
+ 0 => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src',
 
 
 
28
  ),
29
  );
30
 
286
  public static function getInitializer(ClassLoader $loader)
287
  {
288
  return \Closure::bind(function () use ($loader) {
289
+ $loader->prefixLengthsPsr4 = ComposerStaticInit57cc78f2f1c527f7b3892d3c7f254998::$prefixLengthsPsr4;
290
+ $loader->prefixDirsPsr4 = ComposerStaticInit57cc78f2f1c527f7b3892d3c7f254998::$prefixDirsPsr4;
291
+ $loader->classMap = ComposerStaticInit57cc78f2f1c527f7b3892d3c7f254998::$classMap;
 
292
 
293
  }, null, ClassLoader::class);
294
  }
vendor/composer/installed.json CHANGED
@@ -1,189 +1,253 @@
1
  [
2
  {
3
- "name": "squizlabs/php_codesniffer",
4
- "version": "2.9.1",
5
- "version_normalized": "2.9.1.0",
6
  "source": {
7
  "type": "git",
8
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
9
- "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62",
14
- "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62",
15
  "shasum": ""
16
  },
17
  "require": {
18
- "ext-simplexml": "*",
19
- "ext-tokenizer": "*",
20
- "ext-xmlwriter": "*",
21
- "php": ">=5.1.2"
22
  },
23
  "require-dev": {
24
- "phpunit/phpunit": "~4.0"
 
25
  },
26
- "time": "2017-05-22T02:43:20+00:00",
27
- "bin": [
28
- "scripts/phpcs",
29
- "scripts/phpcbf"
30
- ],
31
- "type": "library",
32
  "extra": {
33
- "branch-alias": {
34
- "dev-master": "2.x-dev"
35
- }
36
  },
37
  "installation-source": "dist",
38
  "autoload": {
39
- "classmap": [
40
- "CodeSniffer.php",
41
- "CodeSniffer/CLI.php",
42
- "CodeSniffer/Exception.php",
43
- "CodeSniffer/File.php",
44
- "CodeSniffer/Fixer.php",
45
- "CodeSniffer/Report.php",
46
- "CodeSniffer/Reporting.php",
47
- "CodeSniffer/Sniff.php",
48
- "CodeSniffer/Tokens.php",
49
- "CodeSniffer/Reports/",
50
- "CodeSniffer/Tokenizers/",
51
- "CodeSniffer/DocGenerators/",
52
- "CodeSniffer/Standards/AbstractPatternSniff.php",
53
- "CodeSniffer/Standards/AbstractScopeSniff.php",
54
- "CodeSniffer/Standards/AbstractVariableSniff.php",
55
- "CodeSniffer/Standards/IncorrectPatternException.php",
56
- "CodeSniffer/Standards/Generic/Sniffs/",
57
- "CodeSniffer/Standards/MySource/Sniffs/",
58
- "CodeSniffer/Standards/PEAR/Sniffs/",
59
- "CodeSniffer/Standards/PSR1/Sniffs/",
60
- "CodeSniffer/Standards/PSR2/Sniffs/",
61
- "CodeSniffer/Standards/Squiz/Sniffs/",
62
- "CodeSniffer/Standards/Zend/Sniffs/"
63
- ]
64
  },
65
  "notification-url": "https://packagist.org/downloads/",
66
  "license": [
67
- "BSD-3-Clause"
68
  ],
69
  "authors": [
70
  {
71
- "name": "Greg Sherwood",
72
- "role": "lead"
 
 
73
  }
74
  ],
75
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
76
- "homepage": "http://www.squizlabs.com/php-codesniffer",
77
  "keywords": [
 
 
 
 
 
 
78
  "phpcs",
79
- "standards"
 
 
 
 
 
 
 
80
  ]
81
  },
82
  {
83
- "name": "simplyadmire/composer-plugins",
84
- "version": "dev-master",
85
- "version_normalized": "9999999-dev",
86
  "source": {
87
  "type": "git",
88
- "url": "https://github.com/SimplyAdmire/ComposerPlugins.git",
89
- "reference": "d8380f670694c1c2330b22591ca74adc82cffe19"
90
  },
91
  "dist": {
92
  "type": "zip",
93
- "url": "https://api.github.com/repos/SimplyAdmire/ComposerPlugins/zipball/d8380f670694c1c2330b22591ca74adc82cffe19",
94
- "reference": "d8380f670694c1c2330b22591ca74adc82cffe19",
95
  "shasum": ""
96
  },
97
  "require": {
98
- "composer-plugin-api": "^1.0",
99
- "squizlabs/php_codesniffer": "*"
100
  },
101
- "time": "2016-05-12T11:58:38+00:00",
102
- "type": "composer-plugin",
103
- "extra": {
104
- "class": [
105
- "SimplyAdmire\\ComposerPlugins\\PhpCodesnifferStandardInstallerPlugin"
106
- ]
107
  },
108
- "installation-source": "source",
 
 
 
 
 
 
109
  "autoload": {
110
- "psr-0": {
111
- "SimplyAdmire\\ComposerPlugins": ""
112
  }
113
  },
114
  "notification-url": "https://packagist.org/downloads/",
115
  "license": [
116
- "LGPL-3.0+"
117
  ],
118
  "authors": [
119
  {
120
- "name": "Rens Admiraal",
121
- "email": "rens@simplyadmire.com",
122
  "role": "lead"
123
  }
124
  ],
125
- "description": "Composer plugin for installing PHP_CodeSniffer standards",
 
126
  "keywords": [
127
- "PHP_CodeSniffer",
128
- "TYPO3 CMS",
129
- "TYPO3 Flow",
130
- "TYPO3 Neos",
131
  "phpcs",
132
- "standards",
133
- "typo3"
134
- ],
135
- "abandoned": true
136
  },
137
  {
138
- "name": "wimg/php-compatibility",
139
- "version": "8.1.0",
140
- "version_normalized": "8.1.0.0",
141
  "source": {
142
  "type": "git",
143
- "url": "https://github.com/wimg/PHPCompatibility.git",
144
- "reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e"
145
  },
146
  "dist": {
147
  "type": "zip",
148
- "url": "https://api.github.com/repos/wimg/PHPCompatibility/zipball/4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
149
- "reference": "4ac01e4fe8faaa4f8d3b3cd06ea92e5418ce472e",
150
  "shasum": ""
151
  },
152
  "require": {
153
- "php": ">=5.3",
154
- "squizlabs/php_codesniffer": "^2.2 || ^3.0.2"
155
  },
156
- "conflict": {
157
- "squizlabs/php_codesniffer": "2.6.2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  },
159
  "require-dev": {
160
- "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
161
  },
162
- "suggest": {
163
- "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
 
 
 
 
 
 
 
 
164
  },
165
- "time": "2017-12-27T21:58:38+00:00",
166
- "type": "phpcodesniffer-standard",
167
  "installation-source": "dist",
168
  "autoload": {
169
- "psr-4": {
170
- "PHPCompatibility\\": "PHPCompatibility/"
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  },
173
  "notification-url": "https://packagist.org/downloads/",
174
  "license": [
175
- "LGPL-3.0"
176
  ],
177
  "authors": [
178
  {
179
- "name": "Wim Godden",
180
  "role": "lead"
181
  }
182
  ],
183
- "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
184
- "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
185
  "keywords": [
186
- "compatibility",
187
  "phpcs",
188
  "standards"
189
  ]
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": "8.2.0",
75
+ "version_normalized": "8.2.0.0",
76
  "source": {
77
  "type": "git",
78
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
79
+ "reference": "eaf613c1a8265bcfd7b0ab690783f2aef519f78a"
80
  },
81
  "dist": {
82
  "type": "zip",
83
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/eaf613c1a8265bcfd7b0ab690783f2aef519f78a",
84
+ "reference": "eaf613c1a8265bcfd7b0ab690783f2aef519f78a",
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.4.3 || 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": "2018-07-17T13:42:26+00:00",
102
+ "type": "phpcodesniffer-standard",
103
+ "installation-source": "dist",
104
  "autoload": {
105
+ "psr-4": {
106
+ "PHPCompatibility\\": "PHPCompatibility/"
107
  }
108
  },
109
  "notification-url": "https://packagist.org/downloads/",
110
  "license": [
111
+ "LGPL-3.0-or-later"
112
  ],
113
  "authors": [
114
  {
115
+ "name": "Wim Godden",
 
116
  "role": "lead"
117
  }
118
  ],
119
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
120
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
121
  "keywords": [
122
+ "compatibility",
 
 
 
123
  "phpcs",
124
+ "standards"
125
+ ]
 
 
126
  },
127
  {
128
+ "name": "phpcompatibility/phpcompatibility-wp",
129
+ "version": "1.0.0",
130
+ "version_normalized": "1.0.0.0",
131
  "source": {
132
  "type": "git",
133
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
134
+ "reference": "b26c84df3ec1d4850d0f22264a4a16482a171996"
135
  },
136
  "dist": {
137
  "type": "zip",
138
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b26c84df3ec1d4850d0f22264a4a16482a171996",
139
+ "reference": "b26c84df3ec1d4850d0f22264a4a16482a171996",
140
  "shasum": ""
141
  },
142
  "require": {
143
+ "phpcompatibility/php-compatibility": "^8.1"
 
144
  },
145
+ "suggest": {
146
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
147
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
148
+ },
149
+ "time": "2018-07-16T22:10:02+00:00",
150
+ "type": "phpcodesniffer-standard",
151
+ "installation-source": "dist",
152
+ "notification-url": "https://packagist.org/downloads/",
153
+ "license": [
154
+ "LGPL-3.0-or-later"
155
+ ],
156
+ "authors": [
157
+ {
158
+ "name": "Wim Godden",
159
+ "role": "lead"
160
+ },
161
+ {
162
+ "name": "Juliette Reinders Folmer",
163
+ "role": "lead"
164
+ }
165
+ ],
166
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility for WordPress projects.",
167
+ "homepage": "http://phpcompatibility.com/",
168
+ "keywords": [
169
+ "compatibility",
170
+ "phpcs",
171
+ "standards",
172
+ "wordpress"
173
+ ]
174
+ },
175
+ {
176
+ "name": "squizlabs/php_codesniffer",
177
+ "version": "2.9.1",
178
+ "version_normalized": "2.9.1.0",
179
+ "source": {
180
+ "type": "git",
181
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
182
+ "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62"
183
+ },
184
+ "dist": {
185
+ "type": "zip",
186
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62",
187
+ "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62",
188
+ "shasum": ""
189
+ },
190
+ "require": {
191
+ "ext-simplexml": "*",
192
+ "ext-tokenizer": "*",
193
+ "ext-xmlwriter": "*",
194
+ "php": ">=5.1.2"
195
  },
196
  "require-dev": {
197
+ "phpunit/phpunit": "~4.0"
198
  },
199
+ "time": "2017-05-22T02:43:20+00:00",
200
+ "bin": [
201
+ "scripts/phpcs",
202
+ "scripts/phpcbf"
203
+ ],
204
+ "type": "library",
205
+ "extra": {
206
+ "branch-alias": {
207
+ "dev-master": "2.x-dev"
208
+ }
209
  },
 
 
210
  "installation-source": "dist",
211
  "autoload": {
212
+ "classmap": [
213
+ "CodeSniffer.php",
214
+ "CodeSniffer/CLI.php",
215
+ "CodeSniffer/Exception.php",
216
+ "CodeSniffer/File.php",
217
+ "CodeSniffer/Fixer.php",
218
+ "CodeSniffer/Report.php",
219
+ "CodeSniffer/Reporting.php",
220
+ "CodeSniffer/Sniff.php",
221
+ "CodeSniffer/Tokens.php",
222
+ "CodeSniffer/Reports/",
223
+ "CodeSniffer/Tokenizers/",
224
+ "CodeSniffer/DocGenerators/",
225
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
226
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
227
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
228
+ "CodeSniffer/Standards/IncorrectPatternException.php",
229
+ "CodeSniffer/Standards/Generic/Sniffs/",
230
+ "CodeSniffer/Standards/MySource/Sniffs/",
231
+ "CodeSniffer/Standards/PEAR/Sniffs/",
232
+ "CodeSniffer/Standards/PSR1/Sniffs/",
233
+ "CodeSniffer/Standards/PSR2/Sniffs/",
234
+ "CodeSniffer/Standards/Squiz/Sniffs/",
235
+ "CodeSniffer/Standards/Zend/Sniffs/"
236
+ ]
237
  },
238
  "notification-url": "https://packagist.org/downloads/",
239
  "license": [
240
+ "BSD-3-Clause"
241
  ],
242
  "authors": [
243
  {
244
+ "name": "Greg Sherwood",
245
  "role": "lead"
246
  }
247
  ],
248
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
249
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
250
  "keywords": [
 
251
  "phpcs",
252
  "standards"
253
  ]
vendor/dealerdirect/phpcodesniffer-composer-installer/LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
vendor/dealerdirect/phpcodesniffer-composer-installer/README.md ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
17
+ the `phpcs` configuration.
18
+
19
+ _Note: This plugin is compatible with both version 2.x and 3.x of_ [PHP_CodeSniffer][codesniffer]
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
27
+ ```
28
+
29
+ That's it.
30
+
31
+ ### How it works
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
+
39
+ ### Example project
40
+
41
+ The following is an example Composer project and has included
42
+ multiple `phpcodesniffer-standard` packages.
43
+
44
+ ```json
45
+ {
46
+ "name": "dealerdirect/example-project",
47
+ "description": "Just an example project",
48
+ "type": "project",
49
+ "require": {},
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
+ }
57
+ ```
58
+
59
+ After running `composer install` PHP_CodeSniffer just works:
60
+
61
+ ```bash
62
+ $ ./vendor/bin/phpcs -i
63
+ The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz, Zend, PHPCompatibility, WordPress,
64
+ WordPress-Core, WordPress-Docs, WordPress-Extra and WordPress-VIP
65
+ ```
66
+
67
+ ### Calling the plugin directly
68
+
69
+ In some circumstances, it is desirable to call this plugin's functionality
70
+ directly. For instance, during development or in [CI][definition-ci] environments.
71
+
72
+ As the plugin requires Composer to work, direct calls need to be wired through a
73
+ project's `composer.json`.
74
+
75
+ This is done by adding a call to the `Plugin::run` function in the `script`
76
+ section of the `composer.json`:
77
+
78
+ ```json
79
+ {
80
+ "scripts": {
81
+ "install-codestandards": [
82
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
83
+ ]
84
+ }
85
+ }
86
+
87
+ ```
88
+
89
+ The command can then be called using `composer run-script install-codestandards` or
90
+ referenced from other script configurations, as follows:
91
+
92
+ ```json
93
+ {
94
+ "scripts": {
95
+ "install-codestandards": [
96
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
97
+ ],
98
+ "post-install-cmd": [
99
+ "@install-codestandards"
100
+ ]
101
+ }
102
+ }
103
+
104
+ ```
105
+
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
+
118
+ Coding standard can be developed normally, as documented by [PHP_CodeSniffer][codesniffer], in the [Coding Standard Tutorial][tutorial].
119
+
120
+ Create a composer package of your coding standard by adding a `composer.json` file.
121
+
122
+ ```json
123
+ {
124
+ "name" : "acme/phpcodesniffer-our-standards",
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
+ }
132
+ ```
133
+
134
+ Requirements:
135
+ * The repository may contain one or more standards.
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
142
+ using the [GitHub releases][changelog] functionality.
143
+
144
+ ## Contributing
145
+
146
+ This is an active open-source project. We are always open to people who want to
147
+ use the code or contribute to it.
148
+
149
+ We've set up a separate document for our [contribution guidelines][contributing-guidelines].
150
+
151
+ Thank you for being involved! :heart_eyes:
152
+
153
+ ## Authors & contributors
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
179
+ in the Software without restriction, including without limitation the rights
180
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
181
+ copies of the Software, and to permit persons to whom the Software is
182
+ furnished to do so, subject to the following conditions:
183
+
184
+ The above copyright notice and this permission notice shall be included in
185
+ all copies or substantial portions of the Software.
186
+
187
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
188
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
189
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
190
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
191
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
192
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
193
+ 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
211
+ [packagist]: https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
212
+ [project-stage-shield]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg
213
+ [scrutinizer-shield]: https://img.shields.io/scrutinizer/g/dealerdirect/phpcodesniffer-composer-installer.svg
214
+ [scrutinizer]: https://scrutinizer-ci.com/g/dealerdirect/phpcodesniffer-composer-installer/
215
+ [travis-shield]: https://img.shields.io/travis/Dealerdirect/phpcodesniffer-composer-installer.svg
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
vendor/dealerdirect/phpcodesniffer-composer-installer/composer.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
3
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
4
+ "type": "composer-plugin",
5
+ "keywords": [
6
+ "composer", "installer", "plugin",
7
+ "phpcs", "codesniffer", "phpcodesniffer", "php_codesniffer",
8
+ "standard", "standards", "style guide", "stylecheck",
9
+ "qa", "quality", "code quality", "tests"
10
+ ],
11
+ "homepage": "http://workingatdealerdirect.eu",
12
+ "license": "MIT",
13
+ "authors": [
14
+ {
15
+ "name": "Franck Nijhof",
16
+ "email": "f.nijhof@dealerdirect.nl",
17
+ "homepage": "http://workingatdealerdirect.eu",
18
+ "role": "Developer"
19
+ }
20
+ ],
21
+ "support": {
22
+ "email": "opensource@dealerdirect.nl",
23
+ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
24
+ "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
25
+ },
26
+ "require": {
27
+ "php": "^5.3|^7",
28
+ "composer-plugin-api": "^1.0",
29
+ "squizlabs/php_codesniffer": "*"
30
+ },
31
+ "require-dev": {
32
+ "composer/composer": "*",
33
+ "wimg/php-compatibility": "^8.0"
34
+ },
35
+ "suggest": {
36
+ "dealerdirect/qa-tools": "All the PHP QA tools you'll need"
37
+ },
38
+ "autoload": {
39
+ "psr-4": {
40
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
41
+ }
42
+ },
43
+ "extra": {
44
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
45
+ },
46
+ "scripts": {
47
+ "install-codestandards": [
48
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
49
+ ]
50
+ }
51
+ }
vendor/dealerdirect/phpcodesniffer-composer-installer/phpcs.xml.dist ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="phpcodesniffer-composer-installer">
3
+ <description>Coding standards for PHP_CodeSniffer Standards Composer Installer Plugin</description>
4
+
5
+ <arg name="extensions" value="php"/>
6
+ <!-- Show sniff codes in all reports, and progress when running -->
7
+ <arg value="sp"/>
8
+
9
+ <file>.</file>
10
+ <exclude-pattern>*/.github/*</exclude-pattern>
11
+ <exclude-pattern>*/vendor/*</exclude-pattern>
12
+
13
+ <rule ref="PHPCompatibility"/>
14
+ <config name="testVersion" value="5.3-"/>
15
+
16
+ <rule ref="PSR2"/>
17
+ </ruleset>
vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
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
+
11
+ namespace Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer;
12
+
13
+ use Composer\Composer;
14
+ 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
56
+ */
57
+ private $installedPaths;
58
+
59
+ /**
60
+ * @var ProcessBuilder
61
+ */
62
+ private $processBuilder;
63
+
64
+ /**
65
+ * Triggers the plugin's main functionality.
66
+ *
67
+ * Makes it possible to run the plugin as a custom command.
68
+ *
69
+ * @param Event $event
70
+ *
71
+ * @throws \InvalidArgumentException
72
+ * @throws \RuntimeException
73
+ * @throws LogicException
74
+ * @throws ProcessFailedException
75
+ * @throws RuntimeException
76
+ */
77
+ public static function run(Event $event)
78
+ {
79
+ $io = $event->getIO();
80
+ $composer = $event->getComposer();
81
+
82
+ $instance = new static();
83
+
84
+ $instance->io = $io;
85
+ $instance->composer = $composer;
86
+ $instance->init();
87
+ $instance->onDependenciesChangedEvent();
88
+ }
89
+
90
+ /**
91
+ * {@inheritDoc}
92
+ *
93
+ * @throws \RuntimeException
94
+ * @throws LogicException
95
+ * @throws RuntimeException
96
+ * @throws ProcessFailedException
97
+ */
98
+ public function activate(Composer $composer, IOInterface $io)
99
+ {
100
+ $this->composer = $composer;
101
+ $this->io = $io;
102
+
103
+ $this->init();
104
+ }
105
+
106
+ /**
107
+ * Prepares the plugin so it's main functionality can be run.
108
+ *
109
+ * @throws \RuntimeException
110
+ * @throws LogicException
111
+ * @throws ProcessFailedException
112
+ * @throws RuntimeException
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
+ /**
125
+ * {@inheritDoc}
126
+ */
127
+ public static function getSubscribedEvents()
128
+ {
129
+ return array(
130
+ ScriptEvents::POST_INSTALL_CMD => array(
131
+ array('onDependenciesChangedEvent', 0),
132
+ ),
133
+ ScriptEvents::POST_UPDATE_CMD => array(
134
+ array('onDependenciesChangedEvent', 0),
135
+ ),
136
+ );
137
+ }
138
+
139
+ /**
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
+ }
194
+
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(
209
+ 'PHP CodeSniffer Config <info>%s</info> <comment>set to</comment> <info>%s</info>',
210
+ self::PHPCS_CONFIG_KEY,
211
+ $paths
212
+ );
213
+ } else {
214
+ // Delete the installed paths if none were found.
215
+ $arguments = array('--config-delete', self::PHPCS_CONFIG_KEY);
216
+ $configMessage = sprintf(
217
+ 'PHP CodeSniffer Config <info>%s</info> <comment>delete</comment>',
218
+ self::PHPCS_CONFIG_KEY
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
+ /**
237
+ * Iterate trough all known paths and check if they are still valid.
238
+ *
239
+ * If path does not exists, is not an directory or isn't readable, the path
240
+ * is removed from the list.
241
+ *
242
+ * @return bool True if changes where made, false otherwise
243
+ */
244
+ private function cleanInstalledPaths()
245
+ {
246
+ $changes = false;
247
+ foreach ($this->installedPaths as $key => $path) {
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]);
255
+ $changes = true;
256
+ }
257
+ }
258
+ return $changes;
259
+ }
260
+
261
+ /**
262
+ * Check all installed packages (including the root package) against
263
+ * the installed paths from PHP_CodeSniffer and add the missing ones.
264
+ *
265
+ * @return bool True if changes where made, false otherwise
266
+ *
267
+ * @throws \InvalidArgumentException
268
+ * @throws \RuntimeException
269
+ */
270
+ private function updateInstalledPaths()
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.
308
+ if (in_array($standardsPath, $this->installedPaths, true) === false) {
309
+ $this->installedPaths[] = $standardsPath;
310
+ $changes = true;
311
+ }
312
+ }
313
+
314
+ return $changes;
315
+ }
316
+
317
+ /**
318
+ * Iterates through Composers' local repository looking for valid Coding
319
+ * Standard packages.
320
+ *
321
+ * If the package is the RootPackage (the one the plugin is installed into),
322
+ * the package is ignored for now since it needs a different install path logic.
323
+ *
324
+ * @return array Composer packages containing coding standard(s)
325
+ */
326
+ private function getPHPCodingStandardPackages()
327
+ {
328
+ $codingStandardPackages = array_filter(
329
+ $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(),
330
+ function (PackageInterface $package) {
331
+ if ($package instanceof AliasPackage) {
332
+ return false;
333
+ }
334
+ return $package->getType() === Plugin::PACKAGE_TYPE;
335
+ }
336
+ );
337
+
338
+ if (! $this->composer->getPackage() instanceof RootpackageInterface
339
+ && $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
340
+ ) {
341
+ $codingStandardPackages[] = $this->composer->getPackage();
342
+ }
343
+
344
+ return $codingStandardPackages;
345
+ }
346
+
347
+ /**
348
+ * Searches for the installed PHP_CodeSniffer Composer package
349
+ *
350
+ * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
351
+ *
352
+ * @return PackageInterface|null
353
+ */
354
+ private function getPHPCodeSnifferPackage($versionConstraint = null)
355
+ {
356
+ $packages = $this
357
+ ->composer
358
+ ->getRepositoryManager()
359
+ ->getLocalRepository()
360
+ ->findPackages(self::PACKAGE_NAME, $versionConstraint);
361
+
362
+ return array_shift($packages);
363
+ }
364
+
365
+ /**
366
+ * Returns the path to the PHP_CodeSniffer package installation location
367
+ *
368
+ * @return string
369
+ */
370
+ private function getPHPCodeSnifferInstallPath()
371
+ {
372
+ return $this->composer->getInstallationManager()->getInstallPath($this->getPHPCodeSnifferPackage());
373
+ }
374
+
375
+ /**
376
+ * Simple check if PHP_CodeSniffer is installed.
377
+ *
378
+ * @param null|string|\Composer\Semver\Constraint\ConstraintInterface $versionConstraint to match against
379
+ *
380
+ * @return bool Whether PHP_CodeSniffer is installed
381
+ */
382
+ private function isPHPCodeSnifferInstalled($versionConstraint = null)
383
+ {
384
+ return ($this->getPHPCodeSnifferPackage($versionConstraint) !== null);
385
+ }
386
+
387
+ /**
388
+ * Test if composer is running "global"
389
+ * This check kinda dirty, but it is the "Composer Way"
390
+ *
391
+ * @return bool Whether Composer is running "globally"
392
+ *
393
+ * @throws \RuntimeException
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
+ }
vendor/phpcompatibility/php-compatibility/.gitattributes ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # Exclude these files from release archives.
3
+ # This will also make them unavailable when using Composer with `--prefer-dist`.
4
+ # If you develop for PHPCompatibility using Composer, use `--prefer-source`.
5
+ # https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production
6
+ # https://blog.madewithlove.be/post/gitattributes/
7
+ #
8
+ /.coveralls.yml export-ignore
9
+ /.scrutinizer.yml export-ignore
10
+ /.travis.yml export-ignore
11
+ /phpcs.xml.dist export-ignore
12
+ /phpunit.xml.dist export-ignore
13
+ /phpunit-travis.xml export-ignore
14
+ /.github export-ignore
15
+ /bin export-ignore
16
+ /PHPCompatibility/Tests export-ignore
17
+
18
+ #
19
+ # Auto detect text files and perform LF normalization
20
+ # http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
21
+ #
22
+ * text=auto
23
+
24
+ #
25
+ # The above will handle all files NOT found below
26
+ #
27
+ *.md text
28
+ *.php text
vendor/phpcompatibility/php-compatibility/.gitignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .idea/*
2
+ /vendor/
3
+ composer.phar
4
+ composer.lock
5
+ phpcs.xml
6
+ phpunit.xml
7
+ *~
vendor/phpcompatibility/php-compatibility/CHANGELOG.md ADDED
@@ -0,0 +1,1019 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log for the PHPCompatibility standard for PHP Codesniffer
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
6
+
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
+
15
+ ## [Unreleased]
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].
22
+
23
+ ### Important changes
24
+
25
+ #### The repository has moved
26
+ As of July 13 2018, the PHPCompatibility repository has moved from the personal account of Wim Godden `wimg` to its own organization `PHPCompatibility`.
27
+ Composer users are advised to update their `composer.json`. The dependency is now called `phpcompatibility/php-compatibility`.
28
+
29
+ #### Framework/CMS specific PHPCompatibility rulesets
30
+ Within this new organization, hosting will be offered for framework/CMS specific PHPCompatibility rulesets.
31
+
32
+ The first two such repositories have been created and are now available for use:
33
+ * PHPCompatibilityJoomla [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityJoomla)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-joomla)
34
+ * PHPCompatibilityWP [GitHub](https://github.com/PHPCompatibility/PHPCompatibilityWP)|[Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)
35
+
36
+ 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).
37
+
38
+ For more information, see the [Readme](https://github.com/PHPCompatibility/PHPCompatibility#using-a-frameworkcms-specific-ruleset) and [Contributing guidelines](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/.github/CONTRIBUTING.md#frameworkcms-specific-rulesets).
39
+
40
+ #### Changes expected in PHPCompatibility 9.0.0
41
+ The next version of PHPCompatibility will include a major directory layout restructuring which means that the sniff codes of all sniffs will change.
42
+
43
+ In this same release, support for PHP_CodeSniffer 1.5.x will be dropped. The new minimum supported PHPCS version will be 2.3.0.
44
+
45
+ For more information about these upcoming changes, please read the [announcement](https://github.com/PHPCompatibility/PHPCompatibility/issues/688).
46
+
47
+ The `9.0.0` release is expected to be ready later this summer.
48
+
49
+
50
+ ### Added
51
+ - :star2: New `ArgumentFunctionsUsage` sniff to detect usage of the `func_get_args()`, `func_get_arg()` and `func_num_args()` functions and the changes regarding these functions introduced in PHP 5.3. [#596](https://github.com/PHPCompatibility/PHPCompatibility/pull/596). Fixes [#372](https://github.com/PHPCompatibility/PHPCompatibility/issues/372).
52
+ - :star2: New `DiscouragedSwitchContinue` sniff to detect `continue` targetting a `switch` control structure for which `E_WARNINGS` will be thrown as of PHP 7.3. [#687](https://github.com/PHPCompatibility/PHPCompatibility/pull/687)
53
+ - :star2: New `NewClassMemberAccess` sniff to detect class member access on instantiation as added in PHP 5.4 and class member access on cloning as added in PHP 7.0. [#619](https://github.com/PHPCompatibility/PHPCompatibility/pull/619). Fixes [#53](https://github.com/PHPCompatibility/PHPCompatibility/issues/53).
54
+ - :star2: New `NewConstantScalarExpressions` sniff to detect PHP 5.6 scalar expression in contexts where PHP previously only allowed static values. [#617](https://github.com/PHPCompatibility/PHPCompatibility/pull/617). Fixes [#399](https://github.com/PHPCompatibility/PHPCompatibility/issues/399).
55
+ - :star2: New `NewGeneratorReturn` sniff to detect `return` statements within generators as introduced in PHP 7.0. [#618](https://github.com/PHPCompatibility/PHPCompatibility/pull/618)
56
+ - :star2: New `PCRENewModifiers` sniff to initially detect the new `J` regex modifier as introduced in PHP 7.2. [#600](https://github.com/PHPCompatibility/PHPCompatibility/pull/600). Fixes [#556](https://github.com/PHPCompatibility/PHPCompatibility/issues/556).
57
+ - :star2: New `ReservedFunctionNames` sniff to report on double underscore prefixed functions and methods. This was previously reported via an upstream sniff. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581)
58
+ - :star2: New `NewTrailingComma` sniff to detect trailing comma's in function calls, method calls, `isset()` and `unset()` as will be introduced in PHP 7.3. [#632](https://github.com/PHPCompatibility/PHPCompatibility/pull/632)
59
+ - :star2: New `Upgrade/LowPHPCS` sniff to give users of old PHP_CodeSniffer versions advance warning when support will be dropped in the near future. [#693](https://github.com/PHPCompatibility/PHPCompatibility/pull/693)
60
+ - :star: `NewClasses` sniff: check for some 40+ additional PHP native classes added in various PHP versions. [#573](https://github.com/PHPCompatibility/PHPCompatibility/pull/573)
61
+ - :star: `NewClosure` sniff: check for usage of `self`/`parent`/`static::` being used within closures, support for which was only added in PHP 5.4. [#669](https://github.com/PHPCompatibility/PHPCompatibility/pull/669). Fixes [#668](https://github.com/PHPCompatibility/PHPCompatibility/pull/668).
62
+ - :star: `NewConstants` sniff: recognize constants added by the PHP 5.5+ password extension. [#626](https://github.com/PHPCompatibility/PHPCompatibility/pull/626)
63
+ - :star: `NewFunctionParameters` sniff: recognize a number of additional function parameters added in PHP 7.0, 7.1 and 7.2. [#602](https://github.com/PHPCompatibility/PHPCompatibility/pull/602)
64
+ - :star: `NewFunctions` sniff: recognize the PHP 5.1 SPL extension functions, the PHP 5.1.1 `hash_hmac()` function, the PHP 5.6 `pg_lo_truncate()` function, more PHP 7.2 Sodium functions and the new PHP 7.3 `is_countable()` function. [#606](https://github.com/PHPCompatibility/PHPCompatibility/pull/606), [#625](https://github.com/PHPCompatibility/PHPCompatibility/pull/625), [#640](https://github.com/PHPCompatibility/PHPCompatibility/pull/640), [#651](https://github.com/PHPCompatibility/PHPCompatibility/pull/651)
65
+ - :star: `NewHashAlgorithms` sniff: recognize the new hash algorithms which were added in PHP 7.1. [#599](https://github.com/PHPCompatibility/PHPCompatibility/pull/599)
66
+ - :star: `NewInterfaces` sniff: check for the PHP 5.0 `Reflector` interface. [#572](https://github.com/PHPCompatibility/PHPCompatibility/pull/572)
67
+ - :star: `OptionalRequiredFunctionParameters` sniff: detect missing `$salt` parameter in calls to the `crypt()` function (PHP 5.6+). [#605](https://github.com/PHPCompatibility/PHPCompatibility/pull/605)
68
+ - :star: `RequiredOptionalFunctionParameters` sniff: recognize that the `$varname` parameter of `getenv()` and the `$scale` parameter of `bcscale()` have become optional as of PHP 7.1 and 7.3 respectively. [#598](https://github.com/PHPCompatibility/PHPCompatibility/pull/598), [#612](https://github.com/PHPCompatibility/PHPCompatibility/pull/612)
69
+ - :star: New `AbstractFunctionCallParameterSniff` to be used as a basis for sniffs examining function call parameters. [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636)
70
+ - :star: New `getReturnTypeHintName()` utility method to the `PHPCompatibility\Sniff` class. [#578](https://github.com/PHPCompatibility/PHPCompatibility/pull/578), [#642](https://github.com/PHPCompatibility/PHPCompatibility/pull/642)
71
+ - :star: New `isNumber()`, `isPositiveNumber()` and `isNegativeNumber()` utility methods to the `PHPCompatibility\Sniff` class. [#610](https://github.com/PHPCompatibility/PHPCompatibility/pull/610), [#650](https://github.com/PHPCompatibility/PHPCompatibility/pull/650)
72
+ - :star: New `isShortList()` utility method to the `PHPCompatibility\Sniff` class. [#635](https://github.com/PHPCompatibility/PHPCompatibility/pull/635)
73
+ - :star: New `getCommandLineData()` method to the `PHPCompatibility\PHPCSHelper` class to provide PHPCS cross-version compatible access to command line info at run time. [#693](https://github.com/PHPCompatibility/PHPCompatibility/pull/693)
74
+ - :star: Duplicate of upstream `findEndOfStatement()` method to the `PHPCompatibility\PHPCSHelper` class to allow for PHPCS cross-version usage of that method. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614)
75
+ - :umbrella: additional unit test to confirm that the `PHPCompatibility\Sniff::isUseOfGlobalConstant()` method handles multi-constant declarations correctly. [#587](https://github.com/PHPCompatibility/PHPCompatibility/pull/587)
76
+ - :umbrella: additional unit tests to confirm that the `PHPCompatibility\Sniff::isClassProperty()` method handles multi-property declarations correctly. [#583](https://github.com/PHPCompatibility/PHPCompatibility/pull/583)
77
+ - :books: [Readme](https://github.com/PHPCompatibility/PHPCompatibility#using-a-frameworkcms-specific-ruleset) & [Contributing](https://github.com/PHPCompatibility/PHPCompatibility/blob/master/.github/CONTRIBUTING.md#frameworkcms-specific-rulesets): add information about the framework/CMS specific rulesets. Related PRs: [#615](https://github.com/PHPCompatibility/PHPCompatibility/pull/615), [#624](https://github.com/PHPCompatibility/PHPCompatibility/pull/624), [#648](https://github.com/PHPCompatibility/PHPCompatibility/pull/648), [#674](https://github.com/PHPCompatibility/PHPCompatibility/pull/674), [#685](https://github.com/PHPCompatibility/PHPCompatibility/pull/685), [#694](https://github.com/PHPCompatibility/PHPCompatibility/pull/694). Related to issue [#530](https://github.com/PHPCompatibility/PHPCompatibility/issues/530).
78
+ - :books: Readme: information about the PHPCS 3.3.0 change which allows for a `testVersion` in a custom ruleset to be overruled by the command-line. [#607](https://github.com/PHPCompatibility/PHPCompatibility/pull/607)
79
+
80
+ ### Changed
81
+ - :books: Adjusted references to the old repository location throughout the codebase to reflect the move to a GitHub organization. [#689](https://github.com/PHPCompatibility/PHPCompatibility/pull/689)
82
+ This repository will now live in [https://github.com/PHPCompatibility/PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) and the Packagist reference will now be `phpcompatibility/php-compatibility`.
83
+ - :white_check_mark: The `getReturnTypeHintToken()` utility method has been made compatible with the changes in the PHPCS tokenizer which were introduced in PHP_CodeSniffer 3.3.0. [#642](https://github.com/PHPCompatibility/PHPCompatibility/pull/642). Fixes [#639](https://github.com/PHPCompatibility/PHPCompatibility/issues/639).
84
+ - :pushpin: `ConstantArrayUsingConst`: improved handling of multi-constant declarations. [#593](https://github.com/PHPCompatibility/PHPCompatibility/pull/593)
85
+ - :pushpin: `NewHeredocInitialize`: improved handling of constant declarations using the `const` keyword.
86
+ The sniff will now also report on multi-declarations for variables, constants and class properties and on using heredoc as a function parameter default. [#641](https://github.com/PHPCompatibility/PHPCompatibility/pull/641)
87
+ - :pushpin: `ForbiddenEmptyListAssignment`: this sniff will now also report on empty list assignments when the PHP 7.1 short list syntax is used. [#653](https://github.com/PHPCompatibility/PHPCompatibility/pull/653)
88
+ - :pushpin: The `ForbiddenNegativeBitshift` sniff would previously only report on "bitshift right". As of this version, "bitshift left" and bitshift assignments will also be recognized. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614)
89
+ - :pushpin: The `NewClasses` and `NewInterfaces` sniffs will now also report on new classes/interfaces when used as _return type_ declarations. [#578](https://github.com/PHPCompatibility/PHPCompatibility/pull/578)
90
+ - :pushpin: The `NewScalarTypeDeclarations` sniff will now recognize `parent` as a valid type declaration.
91
+ The sniff will now also throw an error about using `self` and `parent` when PHP < 5.2 needs to be supported as PHP 5.1 and lower would presume these to be class names instead of keywords. [#595](https://github.com/PHPCompatibility/PHPCompatibility/pull/595)
92
+ - :pushpin: The `PregReplaceEModifier` sniff - and the `PCRENewModifiers` sniff by extension - will now correctly examine and report on modifiers in regexes passed via calls to `preg_replace_callback_array()`. [#600](https://github.com/PHPCompatibility/PHPCompatibility/pull/600), [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636)
93
+ - :pushpin: `getReturnTypeHintToken()` utility method: improved support for interface methods and abstract function declarations. [#652](https://github.com/PHPCompatibility/PHPCompatibility/pull/652)
94
+ - :pushpin: The `findExtendedClassName()`, `findImplementedInterfaceNames()`, `getMethodParameters()` utility methods which are duplicates of upstream PHPCS methods, have been moved from the `PHPCompatibility\Sniff` class to the `PHPCompatibility\PHPCSHelper` class and have become static methods. [#613](https://github.com/PHPCompatibility/PHPCompatibility/pull/613)
95
+ - :white_check_mark: `getReturnTypeHintToken()` utility method: align returned `$stackPtr` with native PHPCS behaviour by returning the last token of the type declaration. [#575](https://github.com/PHPCompatibility/PHPCompatibility/pull/575)
96
+ - :white_check_mark: PHPCS cross-version compatibility: sync `getMethodParameters()` method with improved upstream version. [#643](https://github.com/PHPCompatibility/PHPCompatibility/pull/643)
97
+ - :pencil2: The `MbstringReplaceEModifier`, `PregReplaceEModifier` and the `PregReplaceEModifier` sniffs now `extend` the new `AbstractFunctionCallParameterSniff` class. This should yield more accurate results when checking whether one of the target PHP functions was called. [#636](https://github.com/PHPCompatibility/PHPCompatibility/pull/636)
98
+ - :pencil2: `DeprecatedNewReference` sniff: minor change to the error text and code - was `Forbidden`, now `Removed` -. Custom rulesets which explicitly excluded this error code will need to be updated. [#594](https://github.com/PHPCompatibility/PHPCompatibility/pull/594)
99
+ - :pencil2: `NewScalarTypeDeclarations` sniff: minor change to the error message text.[#644](https://github.com/PHPCompatibility/PHPCompatibility/pull/644)
100
+ - :umbrella: The unit test framework now allows for sniffs in categories other than `PHP`. [#634](https://github.com/PHPCompatibility/PHPCompatibility/pull/634)
101
+ - :umbrella: Boyscouting: fixed up some (non-relevant) parse errors in a unit test case file. [#576](https://github.com/PHPCompatibility/PHPCompatibility/pull/576)
102
+ - :green_heart: Travis: build tests are now also being run against the lowest supported PHPCS 3.x version. Previously only the highest supported PHPCS 3.x version was tested against. [#633](https://github.com/PHPCompatibility/PHPCompatibility/pull/633)
103
+ - :books: Readme: Improved Composer install instructions. [#690](https://github.com/PHPCompatibility/PHPCompatibility/pull/690)
104
+ - :books: Minor documentation fixes. [#672](https://github.com/PHPCompatibility/PHPCompatibility/pull/672)
105
+ - :wrench: Minor performance optimizations and code simplifications. [#592](https://github.com/PHPCompatibility/PHPCompatibility/pull/592), [#630](https://github.com/PHPCompatibility/PHPCompatibility/pull/630), [#671](https://github.com/PHPCompatibility/PHPCompatibility/pull/671)
106
+ - :wrench: Composer: Various improvements, including improved information about the suggested packages, suggesting `roave/security-advisories`, allowing for PHPUnit 7.x. [#604](https://github.com/PHPCompatibility/PHPCompatibility/pull/604/files), [#616](https://github.com/PHPCompatibility/PHPCompatibility/pull/616), [#622](https://github.com/PHPCompatibility/PHPCompatibility/pull/622), [#646](https://github.com/PHPCompatibility/PHPCompatibility/pull/646)
107
+ - :wrench: Various Travis build script improvements, including tweaks for faster build time, validation of the `composer.json` file, validation of the framework specific rulesets. [#570](https://github.com/PHPCompatibility/PHPCompatibility/pull/570), [#571](https://github.com/PHPCompatibility/PHPCompatibility/pull/571), [#579](https://github.com/PHPCompatibility/PHPCompatibility/pull/579), [#621](https://github.com/PHPCompatibility/PHPCompatibility/pull/621), [#631](https://github.com/PHPCompatibility/PHPCompatibility/pull/631)
108
+ - :wrench: Build/PHPCS: made some more CS conventions explicit and start using PHPCS 3.x options for the PHPCompatibility native ruleset. [#586](https://github.com/PHPCompatibility/PHPCompatibility/pull/586), [#667](https://github.com/PHPCompatibility/PHPCompatibility/pull/667), [#673](https://github.com/PHPCompatibility/PHPCompatibility/pull/673)
109
+ - :wrench: Some code style clean up and start using the new inline PHPCS 3.2+ annotations where applicable. [#586](https://github.com/PHPCompatibility/PHPCompatibility/pull/586), [#591](https://github.com/PHPCompatibility/PHPCompatibility/pull/591), [#620](https://github.com/PHPCompatibility/PHPCompatibility/pull/620), [#673](https://github.com/PHPCompatibility/PHPCompatibility/pull/673)
110
+
111
+ ### Removed
112
+ - :no_entry_sign: PHPCompatibility no longer explicitly supports PHP_CodeSniffer 2.2.0. [#687](https://github.com/PHPCompatibility/PHPCompatibility/pull/687), [#690](https://github.com/PHPCompatibility/PHPCompatibility/pull/690)
113
+ - :no_entry_sign: The PHPCompatibility ruleset no longer includes the PHPCS native `Generic.NamingConventions.CamelCapsFunctionName`. Double underscore prefixed function names are now being reported on by a new dedicated sniff. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581)
114
+ - :no_entry_sign: PHPCompatibility no longer explicitly supports HHVM and builds are no longer tested against HHVM.
115
+ For now, running PHPCompatibility on HHVM to test PHP code may still work for a little while, but HHVM has announced they are [dropping PHP support](https://hhvm.com/blog/2017/09/18/the-future-of-hhvm.html). [#623](https://github.com/PHPCompatibility/PHPCompatibility/pull/623). Fixes [#603](https://github.com/PHPCompatibility/PHPCompatibility/issues/603).
116
+ - :books: Readme: badges from services which are no longer supported or inaccurate. [#609](https://github.com/PHPCompatibility/PHPCompatibility/pull/609), [#628](https://github.com/PHPCompatibility/PHPCompatibility/pull/628)
117
+
118
+ ### Fixed
119
+ - :bug: Previously, the PHPCS native `Generic.NamingConventions.CamelCapsFunctionName` sniff was included in PHPCompatibility. Some error codes of this sniff were excluded, as well as some error messages changed (via the ruleset).
120
+ If/when PHPCompatibility would be used in combination with a code style-type ruleset, this could inadvertently lead to underreporting of issues which the CS-type ruleset intends to have reported - i.e. the error codes excluded by PHPCompatibility -. This has now been fixed. [#581](https://github.com/PHPCompatibility/PHPCompatibility/pull/581)
121
+ - :bug: The `ForbiddenNegativeBitshift` sniff would incorrectly throw an error when a bitshift was based on a calculation which included a negative number, but would not necessarily result in a negative number. [#614](https://github.com/PHPCompatibility/PHPCompatibility/pull/614). Fixes [#294](https://github.com/PHPCompatibility/PHPCompatibility/issues/294), [#466](https://github.com/PHPCompatibility/PHPCompatibility/issues/466).
122
+ - :bug: The `NewClosure` sniff would report the same issue twice when the issue was encountered in a nested closure. [#669](https://github.com/PHPCompatibility/PHPCompatibility/pull/669)
123
+ - :bug: The `NewKeywords` sniff would underreport on non-lowercase keywords. [#627](https://github.com/PHPCompatibility/PHPCompatibility/pull/627)
124
+ - :bug: The `NewKeywords` sniff would incorrectly report on the use of class constants and class properties using the same name as a keyword. [#627](https://github.com/PHPCompatibility/PHPCompatibility/pull/627)
125
+ - :bug: The `NewNullableTypes` sniff would potentially underreport when comments where interspersed in the (return) type declarations. [#577](https://github.com/PHPCompatibility/PHPCompatibility/pull/577)
126
+ - :bug: The `Sniff::getFunctionCallParameters()` utility method would in rare cases return incorrect results when it encountered a closure as a parameter. [#682](https://github.com/PHPCompatibility/PHPCompatibility/pull/682)
127
+ - :bug: The `Sniff::getReturnTypeHintToken()` utility method would not always return a `$stackPtr`. [#645](https://github.com/PHPCompatibility/PHPCompatibility/pull/645)
128
+ - :bug: Minor miscellanous other bugfixes. [#670](https://github.com/PHPCompatibility/PHPCompatibility/pull/670)
129
+ - :umbrella: `PHPCompatibility\Tests\BaseClass\MethodTestFrame::getTargetToken()` could potentially not find the correct token to run a test against. [#588](https://github.com/PHPCompatibility/PHPCompatibility/pull/588)
130
+
131
+ ### Credits
132
+ Thanks go out to [Michael Babker] and [Juliette Reinders Folmer] for their contributions to this version. :clap:
133
+
134
+
135
+ ## [8.1.0] - 2017-12-27
136
+
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:
178
+
179
+
180
+ ## [8.0.1] - 2017-08-07
181
+
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:
202
+
203
+
204
+
205
+ ## [8.0.0] - 2017-08-03
206
+
207
+ **IMPORTANT**: This release contains a **breaking change**. Please read the below information carefully before upgrading!
208
+
209
+ The directory layout of the PHPCompatibility standard has been changed for improved compatibility with Composer.
210
+ This means that the PHPCompatibility standard no longer extends from the root directory of the repository, but now lives in its own subdirectory `/PHPCompatibility`.
211
+
212
+ This release also bring compatibility with PHPCS 3.x to the PHPCompatibility standard.
213
+
214
+ There are two things you will need to be aware of:
215
+ * The path to the PHPCompatibility standard has changed.
216
+ * If you intend to upgrade to PHPCS 3.x, the path to the `phpcs` script has changed (upstream change).
217
+
218
+ Please follow the below upgrade instructions carefully. This should be a one-time only action.
219
+
220
+ ### Upgrade instructions
221
+
222
+ ### Before upgrading
223
+
224
+ If you had previously made accommodations for the old directory layout, you should remove any such _"hacks"_ (meant in the kindest of ways) now.
225
+
226
+ By this we mean: symlinks for the PHPCompatibility install to the `PHP_CodeSniffer/CodeSniffer/Standards` directory, scripts to move the sniffs files to the PHPCS directory, scripts which made symlinks etc.
227
+
228
+ So, please remove those first.
229
+
230
+ > **Side-note**:
231
+ >
232
+ > If you had previously forked this repository to solve this issue, please consider reverting your fork to the official version or removing it all together.
233
+
234
+ ### Upgrading: re-registering PHPCompatibility with PHP CodeSniffer
235
+
236
+ External PHP CodeSniffer standards need to be registered with PHP CodeSniffer. You have probably done this the first time you used PHPCompatibility or have a script or Composer plugin in place to do this for you.
237
+
238
+ As the directory layout of PHPCompatibility has changed, the path previously registered with PHP CodeSniffer will no longer work and running `phpcs -i` will **_not_** list PHPCompatibility as one of the registered standards.
239
+
240
+ #### Using a Composer plugin
241
+
242
+ If you use Composer, we recommend you use a Composer plugin to sort this out. In previous install instructions we recommended the SimplyAdmin plugin for this. This plugin has since been abandoned. We now recommend the DealerDirect plugin.
243
+ ```bash
244
+ composer remove --dev simplyadmire/composer-plugins
245
+ composer require --dev dealerdirect/phpcodesniffer-composer-installer:^0.4.3
246
+ composer install
247
+ composer update phpcompatibility/php-compatibility squizlabs/php_codesniffer
248
+ vendor/bin/phpcs -i
249
+ ```
250
+ If all went well, you should now see PHPCompatibility listed again in the list of installed standards.
251
+
252
+ #### Manually re-registering PHPCompatibility
253
+
254
+ 1. First run `phpcs --config-show` to check which path(s) are currently registered with PHP CodeSniffer for external standards.
255
+ 2. Check in the below table what the new path for PHPCompatibility will be - the path should point to the root directory of your PHPCompatibility install (not to the sub-directory of the same name):
256
+
257
+ Install type | Old path | New path
258
+ ------------ | -------- | ---------
259
+ Composer | `vendor/wimg` | `vendor/phpcompatibility/php-compatibility`
260
+ Unzipped release to arbitrary directory | `path/to/dir/abovePHPCompatibility` | `path/to/dir/abovePHPCompatibility/PHPCompatibility`
261
+ Git checkout | `path/to/dir/abovePHPCompatibility` | `path/to/dir/abovePHPCompatibility/PHPCompatibility`
262
+ PEAR | If the old install instruction has been followed, not registered. | `path/to/PHPCompatibility`
263
+
264
+ > **Side-note**:
265
+ >
266
+ > If you used the old install instructions for a PEAR install, i.e. checking out the latest release to the `PHP/CodeSniffer/Standards/PHPCompatibility` directory, and you intend to upgrade to PHP CodeSniffer 3.x, it is recommended you move the PHPCompatibility folder out of the PEAR directory now, as the layout of the PHPCS directory has changed with PHPCS 3.x and you may otherwise lose your PHPCompatibility install when you upgrade PHP CodeSniffer via PEAR.
267
+
268
+ 3. There are two ways in which you can register the new `installed_paths` value with PHP CodeSniffer. Choose your preferred method:
269
+ * Run `phpcs --config-set installed_paths ...` and include all previously installed paths including the _adjusted_ path for the PHPCompatibility standard.
270
+
271
+ For example, if the previous value of `installed_paths` was
272
+
273
+ `/path/to/MyStandard,/path/to/dir/abovePHPCompatibility`
274
+
275
+ you should now set it using
276
+
277
+ `phpcs --config-set installed_paths /path/to/MyStandard,/path/to/PHPCompatibility`
278
+
279
+ * If you use a custom ruleset in combination with PHPCS 2.6.0 or higher, you can pass the value to PHPCS from your custom ruleset:
280
+ ```xml
281
+ <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" />
282
+ ```
283
+ 4. Run `phpcs -i` to verify that the PHPCompatibility standard is now listed again in the list of installed standards.
284
+
285
+
286
+ ### Upgrading to PHPCS 3.x
287
+
288
+ The path to the `phpcs` script has changed in PHPCS 3.x which will impact how you call PHPCS.
289
+
290
+ Version | PHPCS 2.x | PHPCS 3.x
291
+ ------- | --------- | ---------
292
+ Generic `phpcs` Command | `path/to/PHP_CodeSniffer/scripts/phpcs ....` | `path/to/PHP_CodeSniffer/bin/phpcs ....`
293
+ Composer command | `vendor/bin/phpcs ...` | `vendor/bin/phpcs ...`
294
+
295
+ So, for Composer users, nothing changes. For everyone else, you may want to add the `path/to/PHP_CodeSniffer/bin/phpcs` path to your PATH environment variable or adjust any scripts - like build scripts - which call PHPCS.
296
+
297
+
298
+ ### Upgrading a Travis build script
299
+
300
+ If you run PHPCompatibility against your code as part of your Travis build:
301
+ * If you use Composer to install PHP CodeSniffer and PHPCompatibility on the travis image and you've made the above mentioned changes, your build should pass again.
302
+ * If you use `git clone` to install PHP CodeSniffer and PHPCompatibility on the travis image, your build will fail until you make the following changes:
303
+ 1. Check which branch of PHPCS is being checked out. If you previously fixed this to a pre-PHPCS 3.x branch or tag, you can now change this (back) to `master` or a PHPCS 3 tag.
304
+ 2. Check to which path PHPCompatibility is being cloned and adjust the path if necessary.
305
+ 3. Adjust the `phpcs --config-set installed_paths` command as described above to point to the root of the cloned PHPCompatibility repo.
306
+ 4. If you switched to using PHPCS 3.x, adjust the call to PHPCS.
307
+
308
+
309
+
310
+ ### Changelog for version 8.0.0
311
+
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:
336
+
337
+
338
+ ## [7.1.5] - 2017-07-17
339
+
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:
372
+
373
+
374
+ ## [7.1.4] - 2017-05-06
375
+
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:
431
+
432
+
433
+ ## [7.1.3] - 2017-04-02
434
+
435
+ See all related issues and PRs in the [7.1.3 milestone].
436
+
437
+ ### Added
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:
473
+
474
+
475
+ ## [7.1.2] - 2017-02-17
476
+
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:
519
+
520
+
521
+ ## [7.1.1] - 2016-12-14
522
+
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:
533
+
534
+
535
+ ## [7.1.0] - 2016-12-14
536
+
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:
551
+
552
+
553
+ ## [7.0.8] - 2016-10-31 - :ghost: Spooky! :jack_o_lantern:
554
+
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:
583
+
584
+
585
+ ## [7.0.7] - 2016-10-20
586
+
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:
626
+
627
+
628
+ ## [7.0.6] - 2016-09-23
629
+
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:
657
+
658
+
659
+ ## [7.0.5] - 2016-09-08
660
+
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:
697
+
698
+
699
+ ## [7.0.4] - 2016-08-20
700
+
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:
733
+
734
+
735
+ ## [7.0.3] - 2016-08-18
736
+
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
802
+ Thanks go out to [Juliette Reinders Folmer] for her contributions to this version. :clap:
803
+
804
+
805
+ ## [7.0.2] - 2016-08-03
806
+
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:
820
+
821
+
822
+ ## [7.0.1] - 2016-08-02
823
+
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
842
+ Thanks go out to [Jason Stallings], [Juliette Reinders Folmer] and [Ryan Neufeld] for their contributions to this version. :clap:
843
+
844
+
845
+ ## [7.0] - 2016-07-02
846
+
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:
904
+
905
+
906
+ ## [5.6] - 2015-09-14
907
+
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:
940
+
941
+
942
+ ## 5.5 - 2014-04-04
943
+
944
+ First tagged release.
945
+
946
+ 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
996
+ [Declan Kelly]: https://github.com/declank
997
+ [dgudgeon]: https://github.com/dgudgeon
998
+ [djaenecke]: https://github.com/djaenecke
999
+ [Dominic]: https://github.com/dol
1000
+ [Eugene Maslovich]: https://github.com/ehpc
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
1007
+ [Komarov Alexey]: https://github.com/erdraug
1008
+ [Marin Crnkovic]: https://github.com/anorgan
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
+
vendor/phpcompatibility/php-compatibility/LICENSE ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
vendor/phpcompatibility/php-compatibility/PHPCSAliases.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *
14
+ * This file is auto-loaded by PHPCS 3.x before any sniffs are loaded
15
+ * through the PHPCS 3.x `<autoload>` ruleset directive.
16
+ *
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) {
28
+ class_alias('PHP_CodeSniffer\Sniffs\Sniff', '\PHP_CodeSniffer_Sniff');
29
+ }
30
+ if (class_exists('\PHP_CodeSniffer_File') === false) {
31
+ class_alias('PHP_CodeSniffer\Files\File', '\PHP_CodeSniffer_File');
32
+ }
33
+ if (class_exists('\PHP_CodeSniffer_Tokens') === false) {
34
+ class_alias('PHP_CodeSniffer\Util\Tokens', '\PHP_CodeSniffer_Tokens');
35
+ }
36
+ if (class_exists('\PHP_CodeSniffer_Exception') === false) {
37
+ class_alias('PHP_CodeSniffer\Exceptions\RuntimeException', '\PHP_CodeSniffer_Exception');
38
+ }
39
+ if (class_exists('\PHP_CodeSniffer_Standards_AbstractScopeSniff') === false) {
40
+ class_alias('PHP_CodeSniffer\Sniffs\AbstractScopeSniff', '\PHP_CodeSniffer_Standards_AbstractScopeSniff');
41
+ }
42
+ if (class_exists('\Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff') === false) {
43
+ class_alias('PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff', '\Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff');
44
+ }
45
+
46
+ define('PHPCOMPATIBILITY_PHPCS_ALIASES_SET', true);
47
+
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.
63
+ if (stripos($class, 'PHPCompatibility') !== 0) {
64
+ return;
65
+ }
66
+
67
+ $file = realpath(__DIR__) . DIRECTORY_SEPARATOR . strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php';
68
+
69
+ if (file_exists($file)) {
70
+ include_once $file;
71
+ }
72
+ });
73
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractComplexVersionSniff.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
21
+
22
+
23
+ /**
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.
30
+ * @param array $itemInfo Base information about the item.
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);
38
+
39
+ if ($this->shouldThrowError($errorInfo) === true) {
40
+ $this->addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo);
41
+ }
42
+ }
43
+
44
+
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
51
+ */
52
+ abstract protected function shouldThrowError(array $errorInfo);
53
+
54
+
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()
61
+ {
62
+ return array();
63
+ }
64
+
65
+
66
+ /**
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.
73
+ */
74
+ protected function getVersionArray(array $itemArray)
75
+ {
76
+ return array_diff_key($itemArray, array_flip($this->getNonVersionArrayKeys()));
77
+ }
78
+
79
+
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
+ *
86
+ * @return string
87
+ */
88
+ protected function getItemName(array $itemInfo, array $errorInfo)
89
+ {
90
+ return $itemInfo['name'];
91
+ }
92
+
93
+
94
+ /**
95
+ * Get the error message template for a specific sniff.
96
+ *
97
+ * @return string
98
+ */
99
+ abstract protected function getErrorMsgTemplate();
100
+
101
+
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.
108
+ *
109
+ * @return string
110
+ */
111
+ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
112
+ {
113
+ return $error;
114
+ }
115
+
116
+
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.
123
+ *
124
+ * @return array
125
+ */
126
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
127
+ {
128
+ return $data;
129
+ }
130
+
131
+
132
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
25
+ /**
26
+ * Is the sniff looking for a function call or a method call ?
27
+ *
28
+ * Note: the child class may need to do additional checks to make sure that
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
+ */
35
+ protected $isMethod = false;
36
+
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
43
+ * depending on your needs.
44
+ */
45
+ protected $targetFunctions = array();
46
+
47
+ /**
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()
69
+ {
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;
90
+ }
91
+
92
+ $tokens = $phpcsFile->getTokens();
93
+ $function = $tokens[$stackPtr]['content'];
94
+ $functionLc = strtolower($function);
95
+
96
+ if (isset($this->targetFunctions[$functionLc]) === false) {
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;
108
+ }
109
+ } else {
110
+ if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) {
111
+ // Not a call to a PHP function.
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;
120
+ }
121
+ }
122
+
123
+ $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
124
+
125
+ if (empty($parameters)) {
126
+ return $this->processNoParameters($phpcsFile, $stackPtr, $function);
127
+ } else {
128
+ return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters);
129
+ }
130
+ }
131
+
132
+
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
+ *
139
+ * @return bool
140
+ */
141
+ abstract protected function bowOutEarly();
142
+
143
+
144
+ /**
145
+ * Process the parameters of a matched function.
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.
152
+ * @param array $parameters Array with information about the parameters.
153
+ *
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
+ /**
161
+ * Process the function if no parameters were found.
162
+ *
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.
169
+ *
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
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractNewFeatureSniff.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
21
+
22
+
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
29
+ */
30
+ protected function shouldThrowError(array $errorInfo)
31
+ {
32
+ return ($errorInfo['not_in_version'] !== '');
33
+ }
34
+
35
+
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
+ *
42
+ * @return array
43
+ */
44
+ public function getErrorInfo(array $itemArray, array $itemInfo)
45
+ {
46
+ $errorInfo = array(
47
+ 'not_in_version' => '',
48
+ 'error' => true,
49
+ );
50
+
51
+ $versionArray = $this->getVersionArray($itemArray);
52
+
53
+ if (empty($versionArray) === false) {
54
+ foreach ($versionArray as $version => $present) {
55
+ if ($errorInfo['not_in_version'] === '' && $present === false
56
+ && $this->supportsBelow($version) === true
57
+ ) {
58
+ $errorInfo['not_in_version'] = $version;
59
+ }
60
+ }
61
+ }
62
+
63
+ return $errorInfo;
64
+ }
65
+
66
+
67
+ /**
68
+ * Get the error message template for this sniff.
69
+ *
70
+ * @return string
71
+ */
72
+ protected function getErrorMsgTemplate()
73
+ {
74
+ return '%s is not present in PHP version %s or earlier';
75
+ }
76
+
77
+
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.
84
+ * @param array $itemInfo Base information about the item.
85
+ * @param array $errorInfo Array with detail (version) information
86
+ * relevant to the item.
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();
94
+
95
+ $errorCode = $this->stringToErrorCode($itemName) . 'Found';
96
+ $data = array(
97
+ $itemName,
98
+ $errorInfo['not_in_version'],
99
+ );
100
+
101
+ $error = $this->filterErrorMsg($error, $itemInfo, $errorInfo);
102
+ $data = $this->filterErrorData($data, $itemInfo, $errorInfo);
103
+
104
+ $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
105
+ }
106
+
107
+
108
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/AbstractRemovedFeatureSniff.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
21
+
22
+
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
29
+ */
30
+ protected function shouldThrowError(array $errorInfo)
31
+ {
32
+ return ($errorInfo['deprecated'] !== '' || $errorInfo['removed'] !== '');
33
+ }
34
+
35
+
36
+ /**
37
+ * Get an array of the non-PHP-version array keys used in a sub-array.
38
+ *
39
+ * By default, removed feature version arrays, contain an additional 'alternative' array key.
40
+ *
41
+ * @return array
42
+ */
43
+ protected function getNonVersionArrayKeys()
44
+ {
45
+ return array('alternative');
46
+ }
47
+
48
+
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
+ *
55
+ * @return array
56
+ */
57
+ public function getErrorInfo(array $itemArray, array $itemInfo)
58
+ {
59
+ $errorInfo = array(
60
+ 'deprecated' => '',
61
+ 'removed' => '',
62
+ 'alternative' => '',
63
+ 'error' => false,
64
+ );
65
+
66
+ $versionArray = $this->getVersionArray($itemArray);
67
+
68
+ if (empty($versionArray) === false) {
69
+ foreach ($versionArray as $version => $removed) {
70
+ if ($this->supportsAbove($version) === true) {
71
+ if ($removed === true && $errorInfo['removed'] === '') {
72
+ $errorInfo['removed'] = $version;
73
+ $errorInfo['error'] = true;
74
+ } elseif ($errorInfo['deprecated'] === '') {
75
+ $errorInfo['deprecated'] = $version;
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ if (isset($itemArray['alternative']) === true) {
82
+ $errorInfo['alternative'] = $itemArray['alternative'];
83
+ }
84
+
85
+ return $errorInfo;
86
+ }
87
+
88
+
89
+ /**
90
+ * Get the error message template for suggesting an alternative for a specific sniff.
91
+ *
92
+ * @return string
93
+ */
94
+ protected function getAlternativeOptionTemplate()
95
+ {
96
+ return '; Use %s instead';
97
+ }
98
+
99
+
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.
106
+ * @param array $itemInfo Base information about the item.
107
+ * @param array $errorInfo Array with detail (version) information
108
+ * relevant to the item.
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();
116
+
117
+ $errorCode = $this->stringToErrorCode($itemName);
118
+ $data = array($itemName);
119
+
120
+ if ($errorInfo['deprecated'] !== '') {
121
+ $error .= 'deprecated since PHP %s and ';
122
+ $errorCode .= 'Deprecated';
123
+ $data[] = $errorInfo['deprecated'];
124
+ }
125
+
126
+ if ($errorInfo['removed'] !== '') {
127
+ $error .= 'removed since PHP %s and ';
128
+ $errorCode .= 'Removed';
129
+ $data[] = $errorInfo['removed'];
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();
137
+ $data[] = $errorInfo['alternative'];
138
+ }
139
+
140
+ $error = $this->filterErrorMsg($error, $itemInfo, $errorInfo);
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
vendor/phpcompatibility/php-compatibility/PHPCompatibility/ComplexVersionInterface.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
25
+
26
+
27
+ /**
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.
34
+ * @param array $itemInfo Base information about the item.
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.
47
+ */
48
+ public function getItemArray(array $itemInfo);
49
+
50
+
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
+ *
57
+ * @return array
58
+ */
59
+ public function getErrorInfo(array $itemArray, array $itemInfo);
60
+
61
+
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.
68
+ * @param array $itemInfo Base information about the item.
69
+ * @param array $errorInfo Array with detail (version) information
70
+ * relevant to the item.
71
+ *
72
+ * @return void
73
+ */
74
+ public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo);
75
+
76
+
77
+ }//end interface
vendor/phpcompatibility/php-compatibility/PHPCompatibility/PHPCSHelper.php ADDED
@@ -0,0 +1,573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
18
+ * Those classes cannot be aliased as they don't represent the same object.
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
+ {
28
+
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
+ }
44
+
45
+
46
+ /**
47
+ * Pass config data to PHPCS.
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.
54
+ * @param boolean $temp Set this config data temporarily for this script run.
55
+ * This will not write the config data to the config file.
56
+ *
57
+ * @return void
58
+ */
59
+ public static function setConfigData($key, $value, $temp = false)
60
+ {
61
+ if (method_exists('\PHP_CodeSniffer\Config', 'setConfigData')) {
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
+ }
69
+
70
+
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
77
+ */
78
+ public static function getConfigData($key)
79
+ {
80
+ if (method_exists('\PHP_CodeSniffer\Config', 'getConfigData')) {
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
+ }
88
+
89
+
90
+ /**
91
+ * Get the value of a single PHPCS config key.
92
+ *
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];
114
+ }
115
+ }
116
+
117
+ return null;
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.
135
+ * @param int|array $ignore Token types that should not be considered stop points.
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);
143
+ }
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) {
160
+ $ignore = (array) $ignore;
161
+ foreach ($ignore as $code) {
162
+ if (isset($endTokens[$code]) === true) {
163
+ unset($endTokens[$code]);
164
+ }
165
+ }
166
+ }
167
+
168
+ $lastNotEmpty = $start;
169
+
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
+ }
182
+
183
+ return $i;
184
+ }
185
+
186
+ // Skip nested statements.
187
+ if (isset($tokens[$i]['scope_closer']) === true
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
+
195
+ $i = $tokens[$i]['scope_closer'];
196
+ } elseif (isset($tokens[$i]['bracket_closer']) === true
197
+ && $i === $tokens[$i]['bracket_opener']
198
+ ) {
199
+ $i = $tokens[$i]['bracket_closer'];
200
+ } elseif (isset($tokens[$i]['parenthesis_closer']) === true
201
+ && $i === $tokens[$i]['parenthesis_opener']
202
+ ) {
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
+ /**
217
+ * Returns the name of the class that the specified class extends
218
+ * (works for classes, anonymous classes and interfaces).
219
+ *
220
+ * Returns FALSE on error or if there is no extended class name.
221
+ *
222
+ * {@internal Duplicate of same method as contained in the `\PHP_CodeSniffer_File`
223
+ * class, but with some improvements which have been introduced in
224
+ * PHPCS 2.8.0.
225
+ * {@link https://github.com/squizlabs/PHP_CodeSniffer/commit/0011d448119d4c568e3ac1f825ae78815bf2cc34}.
226
+ *
227
+ * Once the minimum supported PHPCS version for this standard goes beyond
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);
242
+ }
243
+
244
+ $tokens = $phpcsFile->getTokens();
245
+
246
+ // Check for the existence of the token.
247
+ if (isset($tokens[$stackPtr]) === false) {
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
+ ) {
255
+ return false;
256
+ }
257
+
258
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
259
+ return false;
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);
275
+ $name = $phpcsFile->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
276
+ $name = trim($name);
277
+
278
+ if ($name === '') {
279
+ return false;
280
+ }
281
+
282
+ return $name;
283
+
284
+ }//end findExtendedClassName()
285
+
286
+
287
+ /**
288
+ * Returns the name(s) of the interface(s) that the specified class implements.
289
+ *
290
+ * Returns FALSE on error or if there are no implemented interface names.
291
+ *
292
+ * {@internal Duplicate of same method as introduced in PHPCS 2.7.
293
+ * This method also includes an improvement we use which was only introduced
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);
308
+ }
309
+
310
+ $tokens = $phpcsFile->getTokens();
311
+
312
+ // Check for the existence of the token.
313
+ if (isset($tokens[$stackPtr]) === false) {
314
+ return false;
315
+ }
316
+
317
+ if ($tokens[$stackPtr]['code'] !== T_CLASS
318
+ && $tokens[$stackPtr]['type'] !== 'T_ANON_CLASS'
319
+ ) {
320
+ return false;
321
+ }
322
+
323
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
324
+ return false;
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);
341
+ $name = $phpcsFile->getTokensAsString(($implementsIndex + 1), ($end - $implementsIndex - 1));
342
+ $name = trim($name);
343
+
344
+ if ($name === '') {
345
+ return false;
346
+ } else {
347
+ $names = explode(',', $name);
348
+ $names = array_map('trim', $names);
349
+ return $names;
350
+ }
351
+
352
+ }//end findImplementedInterfaceNames()
353
+
354
+
355
+ /**
356
+ * Returns the method parameters for the specified function token.
357
+ *
358
+ * Each parameter is in the following format:
359
+ *
360
+ * <code>
361
+ * 0 => array(
362
+ * 'name' => '$var', // The variable name.
363
+ * 'token' => integer, // The stack pointer to the variable name.
364
+ * 'content' => string, // The full content of the variable definition.
365
+ * 'pass_by_reference' => boolean, // Is the variable passed by reference?
366
+ * 'variable_length' => boolean, // Is the param of variable length through use of `...` ?
367
+ * 'type_hint' => string, // The type hint for the variable.
368
+ * 'type_hint_token' => integer, // The stack pointer to the type hint
369
+ * // or false if there is no type hint.
370
+ * 'nullable_type' => boolean, // Is the variable using a nullable type?
371
+ * )
372
+ * </code>
373
+ *
374
+ * Parameters with default values have an additional array index of
375
+ * 'default' with the value of the default as a string.
376
+ *
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
384
+ * function token to acquire the
385
+ * parameters for.
386
+ *
387
+ * @return array|false
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);
395
+ }
396
+
397
+ $tokens = $phpcsFile->getTokens();
398
+
399
+ // Check for the existence of the token.
400
+ if (isset($tokens[$stackPtr]) === false) {
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'];
411
+ $closer = $tokens[$stackPtr]['parenthesis_closer'];
412
+
413
+ $vars = array();
414
+ $currVar = null;
415
+ $paramStart = ($opener + 1);
416
+ $defaultStart = null;
417
+ $paramCount = 0;
418
+ $passByReference = false;
419
+ $variableLength = false;
420
+ $typeHint = '';
421
+ $typeHintToken = false;
422
+ $nullableType = false;
423
+
424
+ for ($i = $paramStart; $i <= $closer; $i++) {
425
+ // Check to see if this token has a parenthesis or bracket opener. If it does
426
+ // it's likely to be an array which might have arguments in it. This
427
+ // could cause problems in our parsing below, so lets just skip to the
428
+ // end of it.
429
+ if (isset($tokens[$i]['parenthesis_opener']) === true) {
430
+ // Don't do this if it's the close parenthesis for the method.
431
+ if ($i !== $tokens[$i]['parenthesis_closer']) {
432
+ $i = ($tokens[$i]['parenthesis_closer'] + 1);
433
+ }
434
+ }
435
+
436
+ if (isset($tokens[$i]['bracket_opener']) === true) {
437
+ // Don't do this if it's the close parenthesis for the method.
438
+ if ($i !== $tokens[$i]['bracket_closer']) {
439
+ $i = ($tokens[$i]['bracket_closer'] + 1);
440
+ }
441
+ }
442
+
443
+ switch ($tokens[$i]['type']) {
444
+ case 'T_BITWISE_AND':
445
+ if ($defaultStart === null) {
446
+ $passByReference = true;
447
+ }
448
+ break;
449
+ case 'T_VARIABLE':
450
+ $currVar = $i;
451
+ break;
452
+ case 'T_ELLIPSIS':
453
+ $variableLength = true;
454
+ break;
455
+ case 'T_ARRAY_HINT': // Pre-PHPCS 3.3.0.
456
+ case 'T_CALLABLE':
457
+ if ($typeHintToken === false) {
458
+ $typeHintToken = $i;
459
+ }
460
+
461
+ $typeHint .= $tokens[$i]['content'];
462
+ break;
463
+ case 'T_SELF':
464
+ case 'T_PARENT':
465
+ case 'T_STATIC':
466
+ // Self and parent are valid, static invalid, but was probably intended as type hint.
467
+ if (isset($defaultStart) === false) {
468
+ if ($typeHintToken === false) {
469
+ $typeHintToken = $i;
470
+ }
471
+
472
+ $typeHint .= $tokens[$i]['content'];
473
+ }
474
+ break;
475
+ case 'T_STRING':
476
+ // This is a string, so it may be a type hint, but it could
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
+ }
484
+ }
485
+
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
+ }
493
+ }
494
+
495
+ if ($nextEquals !== false) {
496
+ break;
497
+ }
498
+ }
499
+
500
+ if ($defaultStart === null) {
501
+ if ($typeHintToken === false) {
502
+ $typeHintToken = $i;
503
+ }
504
+
505
+ $typeHint .= $tokens[$i]['content'];
506
+ }
507
+ break;
508
+ case 'T_NS_SEPARATOR':
509
+ // Part of a type hint or default value.
510
+ if ($defaultStart === null) {
511
+ if ($typeHintToken === false) {
512
+ $typeHintToken = $i;
513
+ }
514
+
515
+ $typeHint .= $tokens[$i]['content'];
516
+ }
517
+ break;
518
+ case 'T_NULLABLE':
519
+ case 'T_INLINE_THEN': // Pre-PHPCS 2.8.0.
520
+ if ($defaultStart === null) {
521
+ $nullableType = true;
522
+ $typeHint .= $tokens[$i]['content'];
523
+ }
524
+ break;
525
+ case 'T_CLOSE_PARENTHESIS':
526
+ case 'T_COMMA':
527
+ // If it's null, then there must be no parameters for this
528
+ // method.
529
+ if ($currVar === null) {
530
+ break;
531
+ }
532
+
533
+ $vars[$paramCount] = array();
534
+ $vars[$paramCount]['token'] = $currVar;
535
+ $vars[$paramCount]['name'] = $tokens[$currVar]['content'];
536
+ $vars[$paramCount]['content'] = trim($phpcsFile->getTokensAsString($paramStart, ($i - $paramStart)));
537
+
538
+ if ($defaultStart !== null) {
539
+ $vars[$paramCount]['default'] = trim(
540
+ $phpcsFile->getTokensAsString(
541
+ $defaultStart,
542
+ ($i - $defaultStart)
543
+ )
544
+ );
545
+ }
546
+
547
+ $vars[$paramCount]['pass_by_reference'] = $passByReference;
548
+ $vars[$paramCount]['variable_length'] = $variableLength;
549
+ $vars[$paramCount]['type_hint'] = $typeHint;
550
+ $vars[$paramCount]['type_hint_token'] = $typeHintToken;
551
+ $vars[$paramCount]['nullable_type'] = $nullableType;
552
+
553
+ // Reset the vars, as we are about to process the next parameter.
554
+ $defaultStart = null;
555
+ $paramStart = ($i + 1);
556
+ $passByReference = false;
557
+ $variableLength = false;
558
+ $typeHint = '';
559
+ $typeHintToken = false;
560
+ $nullableType = false;
561
+
562
+ $paramCount++;
563
+ break;
564
+ case 'T_EQUAL':
565
+ $defaultStart = ($i + 1);
566
+ break;
567
+ }//end switch
568
+ }//end for
569
+
570
+ return $vars;
571
+
572
+ }//end getMethodParameters()
573
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniff.php ADDED
@@ -0,0 +1,1842 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
48
+ * List of functions using hash algorithm as parameter (always the first parameter).
49
+ *
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(
56
+ 'hash_file' => 1,
57
+ 'hash_hmac_file' => 1,
58
+ 'hash_hmac' => 1,
59
+ 'hash_init' => 1,
60
+ 'hash_pbkdf2' => 1,
61
+ 'hash' => 1,
62
+ );
63
+
64
+
65
+ /**
66
+ * List of functions which take an ini directive as parameter (always the first parameter).
67
+ *
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(
74
+ 'ini_get' => 1,
75
+ 'ini_set' => 1,
76
+ );
77
+
78
+
79
+ /**
80
+ * Get the testVersion configuration variable.
81
+ *
82
+ * The testVersion configuration variable may be in any of the following formats:
83
+ * 1) Omitted/empty, in which case no version is specified. This effectively
84
+ * disables all the checks for new PHP features provided by this standard.
85
+ * 2) A single PHP version number, e.g. "5.4" in which case the standard checks that
86
+ * the code will run on that version of PHP (no deprecated features or newer
87
+ * features being used).
88
+ * 3) A range, e.g. "5.0-5.5", in which case the standard checks the code will run
89
+ * on all PHP versions in that range, and that it doesn't use any features that
90
+ * were deprecated by the final version in the list, or which were not available
91
+ * for the first version in the list.
92
+ * We accept ranges where one of the components is missing, e.g. "-5.6" means
93
+ * all versions up to PHP 5.6, and "7.0-" means all versions above PHP 7.0.
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
100
+ * both the min and max.
101
+ *
102
+ * @throws \PHP_CodeSniffer_Exception If testVersion is invalid.
103
+ */
104
+ private function getTestVersion()
105
+ {
106
+ static $arrTestVersions = array();
107
+
108
+ $default = array(null, null);
109
+ $testVersion = trim(PHPCSHelper::getConfigData('testVersion'));
110
+
111
+ if (empty($testVersion) === false && isset($arrTestVersions[$testVersion]) === false) {
112
+
113
+ $arrTestVersions[$testVersion] = $default;
114
+
115
+ if (preg_match('`^\d+\.\d+$`', $testVersion)) {
116
+ $arrTestVersions[$testVersion] = array($testVersion, $testVersion);
117
+ return $arrTestVersions[$testVersion];
118
+ }
119
+
120
+ if (preg_match('`^(\d+\.\d+)?\s*-\s*(\d+\.\d+)?$`', $testVersion, $matches)) {
121
+ if (empty($matches[1]) === false || empty($matches[2]) === false) {
122
+ // If no lower-limit is set, we set the min version to 4.0.
123
+ // Whilst development focuses on PHP 5 and above, we also accept
124
+ // sniffs for PHP 4, so we include that as the minimum.
125
+ // (It makes no sense to support PHP 3 as this was effectively a
126
+ // different language).
127
+ $min = empty($matches[1]) ? '4.0' : $matches[1];
128
+
129
+ // If no upper-limit is set, we set the max version to 99.9.
130
+ $max = empty($matches[2]) ? '99.9' : $matches[2];
131
+
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 {
139
+ $arrTestVersions[$testVersion] = array($min, $max);
140
+ return $arrTestVersions[$testVersion];
141
+ }
142
+ }
143
+ }
144
+
145
+ trigger_error(
146
+ "Invalid testVersion setting: '" . $testVersion . "'",
147
+ E_USER_WARNING
148
+ );
149
+ return $default;
150
+ }
151
+
152
+ if (isset($arrTestVersions[$testVersion])) {
153
+ return $arrTestVersions[$testVersion];
154
+ }
155
+
156
+ return $default;
157
+ }
158
+
159
+
160
+ /**
161
+ * Check whether a specific PHP version is equal to or higher than the maximum
162
+ * supported PHP version as provided by the user in `testVersion`.
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
169
+ * is equal to or higher than the highest supported PHP version
170
+ * in testVersion. False otherwise.
171
+ */
172
+ public function supportsAbove($phpVersion)
173
+ {
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
+ /**
188
+ * Check whether a specific PHP version is equal to or lower than the minimum
189
+ * supported PHP version as provided by the user in `testVersion`.
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
196
+ * supported PHP version in testVersion.
197
+ * False otherwise or if no testVersion is provided.
198
+ */
199
+ public function supportsBelow($phpVersion)
200
+ {
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
220
+ * the message relates to.
221
+ * @param bool $isError Whether to report the message as an
222
+ * 'error' or 'warning'.
223
+ * Defaults to true (error).
224
+ * @param string $code The error code for the message.
225
+ * Defaults to 'Found'.
226
+ * @param array $data Optional input for the data replacements.
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);
234
+ } else {
235
+ $phpcsFile->addWarning($message, $stackPtr, $code, $data);
236
+ }
237
+ }
238
+
239
+
240
+ /**
241
+ * Convert an arbitrary string to an alphanumeric string with underscores.
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
248
+ */
249
+ public function stringToErrorCode($baseString)
250
+ {
251
+ return preg_replace('`[^a-z0-9_]`i', '_', strtolower($baseString));
252
+ }
253
+
254
+
255
+ /**
256
+ * Strip quotes surrounding an arbitrary string.
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.
263
+ */
264
+ public function stripQuotes($string)
265
+ {
266
+ return preg_replace('`^([\'"])(.*)\1$`Ds', '$2', $string);
267
+ }
268
+
269
+
270
+ /**
271
+ * Strip variables from an arbitrary double quoted string.
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.
278
+ */
279
+ public function stripVariables($string)
280
+ {
281
+ if (strpos($string, '$') === false) {
282
+ return $string;
283
+ }
284
+
285
+ return preg_replace(self::REGEX_COMPLEX_VARS, '', $string);
286
+ }
287
+
288
+
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
311
+ * will detect whether the array has values or is empty.
312
+ *
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
+
325
+ // Check for the existence of the token.
326
+ if (isset($tokens[$stackPtr]) === false) {
327
+ return false;
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
+ }
342
+
343
+ if ($nextNonEmpty === $tokens[$stackPtr]['bracket_closer']) {
344
+ // No parameters.
345
+ return false;
346
+ } else {
347
+ return true;
348
+ }
349
+ }
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
+
357
+ if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) {
358
+ return false;
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.
366
+ return false;
367
+ }
368
+
369
+ return true;
370
+ }
371
+
372
+
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,
380
+ * it will return the number of values in the array.
381
+ *
382
+ * @link https://github.com/PHPCompatibility/PHPCompatibility/issues/111
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
408
+ * pointer and raw parameter value for all parameters. Index will be 1-based.
409
+ * If no parameters are found, will return an empty array.
410
+ *
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;
441
+ }
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'])
456
+ && $tokens[$nextComma]['bracket_opener'] === $nextComma)
457
+ && isset($tokens[$nextComma]['bracket_closer'])
458
+ ) {
459
+ // Skip forward to the end of the short array definition.
460
+ $nextComma = $tokens[$nextComma]['bracket_closer'];
461
+ continue;
462
+ }
463
+
464
+ // Skip past closures passed as function parameters.
465
+ if ($tokens[$nextComma]['type'] === 'T_CLOSURE'
466
+ && (isset($tokens[$nextComma]['scope_condition'])
467
+ && $tokens[$nextComma]['scope_condition'] === $nextComma)
468
+ && isset($tokens[$nextComma]['scope_closer'])
469
+ ) {
470
+ // Skip forward to the end of the closure declaration.
471
+ $nextComma = $tokens[$nextComma]['scope_closer'];
472
+ continue;
473
+ }
474
+
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
+ }
482
+
483
+ // Ignore closing parenthesis/bracket if not 'ours'.
484
+ if ($tokens[$nextComma]['type'] === $tokens[$closer]['type'] && $nextComma !== $closer) {
485
+ continue;
486
+ }
487
+
488
+ // Ok, we've reached the end of the parameter.
489
+ $parameters[$cnt]['start'] = $paramStart;
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
+ }
500
+
501
+ // Prepare for the next parameter.
502
+ $paramStart = $nextComma + 1;
503
+ $cnt++;
504
+ }
505
+
506
+ return $parameters;
507
+ }
508
+
509
+
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
+
530
+ if (isset($parameters[$paramOffset]) === false) {
531
+ return false;
532
+ } else {
533
+ return $parameters[$paramOffset];
534
+ }
535
+ }
536
+
537
+
538
+ /**
539
+ * Verify whether a token is within a scoped condition.
540
+ *
541
+ * If the optional $validScopes parameter has been passed, the function
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
548
+ * or int value of a valid scope.
549
+ * Pass the T_.. constant(s) for the
550
+ * desired scope to this parameter.
551
+ *
552
+ * @return bool Without the optional $scopeTypes: True if within a scope, false otherwise.
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
+
560
+ // Check for the existence of the token.
561
+ if (isset($tokens[$stackPtr]) === false) {
562
+ return false;
563
+ }
564
+
565
+ // No conditions = no scope.
566
+ if (empty($tokens[$stackPtr]['conditions'])) {
567
+ return false;
568
+ }
569
+
570
+ // Ok, there are conditions, do we have to check for specific ones ?
571
+ if (isset($validScopes) === false) {
572
+ return true;
573
+ }
574
+
575
+ return $phpcsFile->hasCondition($stackPtr, $validScopes);
576
+ }
577
+
578
+
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
585
+ * scope or also accept interfaces and traits
586
+ * as scope.
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
+
671
+ // Check for the existence of the token.
672
+ if (isset($tokens[$stackPtr]) === false) {
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);
703
+ $className = $phpcsFile->getTokensAsString($start, ($end - $start));
704
+ $className = trim($className);
705
+
706
+ return $this->getFQName($phpcsFile, $stackPtr, $className);
707
+ }
708
+
709
+
710
+ /**
711
+ * Returns the fully qualified name of the class that the specified class extends.
712
+ *
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
+
725
+ // Check for the existence of the token.
726
+ if (isset($tokens[$stackPtr]) === false) {
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
+ ) {
734
+ return '';
735
+ }
736
+
737
+ $extends = PHPCSHelper::findExtendedClassName($phpcsFile, $stackPtr);
738
+ if (empty($extends) || is_string($extends) === false) {
739
+ return '';
740
+ }
741
+
742
+ return $this->getFQName($phpcsFile, $stackPtr, $extends);
743
+ }
744
+
745
+
746
+ /**
747
+ * Returns the class name for the static usage of a class.
748
+ * This can be a call to a method, the use of a property or constant.
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
+
761
+ // Check for the existence of the token.
762
+ if (isset($tokens[$stackPtr]) === false) {
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
+ }
786
+ $className = $phpcsFile->getDeclarationName($classDeclarationPtr);
787
+ return $this->getFQName($phpcsFile, $classDeclarationPtr, $className);
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);
798
+ if ($start === false || isset($tokens[($start + 1)]) === false) {
799
+ return '';
800
+ }
801
+
802
+ $start = ($start + 1);
803
+ $className = $phpcsFile->getTokensAsString($start, ($stackPtr - $start));
804
+ $className = trim($className);
805
+
806
+ return $this->getFQName($phpcsFile, $stackPtr, $className);
807
+ }
808
+
809
+
810
+ /**
811
+ * Get the Fully Qualified name for a class/function/constant etc.
812
+ *
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.
826
+ return $name;
827
+ }
828
+
829
+ // Remove the namespace keyword if used.
830
+ if (strpos($name, 'namespace\\') === 0) {
831
+ $name = substr($name, 10);
832
+ }
833
+
834
+ $namespace = $this->determineNamespace($phpcsFile, $stackPtr);
835
+
836
+ if ($namespace === '') {
837
+ return '\\' . $name;
838
+ } else {
839
+ return '\\' . $namespace . '\\' . $name;
840
+ }
841
+ }
842
+
843
+
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);
859
+ }
860
+
861
+
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
+
874
+ // Check for the existence of the token.
875
+ if (isset($tokens[$stackPtr]) === false) {
876
+ return '';
877
+ }
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) {
885
+ return $namespace;
886
+ }
887
+
888
+ // We are in a scoped namespace, but couldn't determine the name. Searching for a global namespace is futile.
889
+ return '';
890
+ }
891
+ }
892
+
893
+ /*
894
+ * Not in a scoped namespace, so let's see if we can find a non-scoped namespace instead.
895
+ * Keeping in mind that:
896
+ * - there can be multiple non-scoped namespaces in a file (bad practice, but it happens).
897
+ * - the namespace keyword can also be used as part of a function/method call and such.
898
+ * - that a non-named namespace resolves to the global namespace.
899
+ */
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) {
907
+ break;
908
+ }
909
+
910
+ $namespace = $this->getDeclaredNamespaceName($phpcsFile, $previousNSToken);
911
+
912
+ } while ($namespace === false && $previousNSToken !== false);
913
+
914
+ // If we still haven't got a namespace, return an empty string.
915
+ if ($namespace === false) {
916
+ return '';
917
+ } else {
918
+ return $namespace;
919
+ }
920
+ }
921
+
922
+ /**
923
+ * Get the complete namespace name for a namespace declaration.
924
+ *
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
+
938
+ // Check for the existence of the token.
939
+ if ($stackPtr === false || isset($tokens[$stackPtr]) === false) {
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 = '';
967
+ while (isset($validTokens[$tokens[$nextToken]['code']]) === true) {
968
+ $namespaceName .= trim($tokens[$nextToken]['content']);
969
+ $nextToken++;
970
+ }
971
+
972
+ return $namespaceName;
973
+ }
974
+
975
+
976
+ /**
977
+ * Get the stack pointer for a return type token for a given function.
978
+ *
979
+ * Compatible layer for older PHPCS versions which don't recognize
980
+ * return type hints correctly.
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
+ *
987
+ * @return int|false Stack pointer to the return type token or false if
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
+
1003
+ if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) {
1004
+ return false;
1005
+ }
1006
+
1007
+ // Allow for interface and abstract method declarations.
1008
+ $endOfFunctionDeclaration = null;
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
+ }
1016
+ }
1017
+
1018
+ if (isset($endOfFunctionDeclaration) === false) {
1019
+ return false;
1020
+ }
1021
+
1022
+ $hasColon = $phpcsFile->findNext(
1023
+ array(T_COLON, T_INLINE_ELSE),
1024
+ ($tokens[$stackPtr]['parenthesis_closer'] + 1),
1025
+ $endOfFunctionDeclaration
1026
+ );
1027
+ if ($hasColon === false) {
1028
+ return false;
1029
+ }
1030
+
1031
+ /*
1032
+ * - `self`, `parent` and `callable` are not being recognized as return types in PHPCS < 2.6.0.
1033
+ * - Return types are not recognized at all in PHPCS < 2.4.0.
1034
+ * - The T_RETURN_TYPE token is defined, but no longer in use since PHPCS 3.3.0+.
1035
+ * The token will now be tokenized as T_STRING.
1036
+ * - An `array` (return) type declaration was tokenized as `T_ARRAY_HINT` in PHPCS 2.3.3 - 3.2.3
1037
+ * to prevent confusing sniffs looking for array declarations.
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);
1049
+ }
1050
+
1051
+
1052
+ /**
1053
+ * Get the complete return type declaration for a given function.
1054
+ *
1055
+ * Cross-version compatible way to retrieve the complete return type declaration.
1056
+ *
1057
+ * For a classname-based return type, PHPCS, as well as the Sniff::getReturnTypeHintToken()
1058
+ * method will mark the classname as the return type token.
1059
+ * This method will find preceeding namespaces and namespace separators and will return a
1060
+ * string containing the qualified return type declaration.
1061
+ *
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
+
1093
+ if ($tokens[$i]['type'] === 'T_NULLABLE') {
1094
+ continue;
1095
+ }
1096
+
1097
+ if (defined('T_NULLABLE') === false && $tokens[$i]['code'] === T_INLINE_THEN) {
1098
+ // Old PHPCS.
1099
+ continue;
1100
+ }
1101
+
1102
+ $returnTypeHint .= $tokens[$i]['content'];
1103
+ }
1104
+
1105
+ return $returnTypeHint;
1106
+ }
1107
+
1108
+
1109
+ /**
1110
+ * Check whether a T_VARIABLE token is a class property declaration.
1111
+ *
1112
+ * Compatibility layer for PHPCS cross-version compatibility
1113
+ * as PHPCS 2.4.0 - 2.7.1 does not have good enough support for
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
+
1131
+ // Note: interfaces can not declare properties.
1132
+ $validScopes = array(
1133
+ 'T_CLASS' => true,
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
+
1144
+ return false;
1145
+ }
1146
+
1147
+
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
+
1165
+ // Note: traits can not declare constants.
1166
+ $validScopes = array(
1167
+ 'T_CLASS' => true,
1168
+ 'T_ANON_CLASS' => true,
1169
+ 'T_INTERFACE' => true,
1170
+ );
1171
+ if ($this->validDirectScope($phpcsFile, $stackPtr, $validScopes) === true) {
1172
+ return true;
1173
+ }
1174
+
1175
+ return false;
1176
+ }
1177
+
1178
+
1179
+ /**
1180
+ * Check whether the direct wrapping scope of a token is within a limited set of
1181
+ * acceptable tokens.
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
+
1199
+ if (empty($tokens[$stackPtr]['conditions']) === true) {
1200
+ return false;
1201
+ }
1202
+
1203
+ /*
1204
+ * Check only the direct wrapping scope of the token.
1205
+ */
1206
+ $conditions = array_keys($tokens[$stackPtr]['conditions']);
1207
+ $ptr = array_pop($conditions);
1208
+
1209
+ if (isset($tokens[$ptr]) === false) {
1210
+ return false;
1211
+ }
1212
+
1213
+ if (isset($validScopes[$tokens[$ptr]['type']]) === true) {
1214
+ return true;
1215
+ }
1216
+
1217
+ return false;
1218
+ }
1219
+
1220
+
1221
+ /**
1222
+ * Get an array of just the type hints from a function declaration.
1223
+ *
1224
+ * Expects to be passed T_FUNCTION or T_CLOSURE token.
1225
+ *
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
+ *
1232
+ * @return array Array with type hints or an empty array if
1233
+ * - the function does not have any parameters
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
+
1250
+ $typeHints = array();
1251
+
1252
+ foreach ($parameters as $param) {
1253
+ if ($param['type_hint'] === '') {
1254
+ continue;
1255
+ }
1256
+
1257
+ // Strip off potential nullable indication.
1258
+ $typeHint = ltrim($param['type_hint'], '?');
1259
+
1260
+ // Strip off potential (global) namespace indication.
1261
+ $typeHint = ltrim($typeHint, '\\');
1262
+
1263
+ if ($typeHint !== '') {
1264
+ $typeHints[] = $typeHint;
1265
+ }
1266
+ }
1267
+
1268
+ return $typeHints;
1269
+ }
1270
+
1271
+
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
+
1285
+ // Check for the existence of the token.
1286
+ if (isset($tokens[$stackPtr]) === false) {
1287
+ return false;
1288
+ }
1289
+
1290
+ if ($tokens[$stackPtr]['code'] !== T_STRING) {
1291
+ return false;
1292
+ }
1293
+
1294
+ $functionName = $tokens[$stackPtr]['content'];
1295
+ $functionNameLc = strtolower($functionName);
1296
+
1297
+ // Bow out if not one of the functions we're targetting.
1298
+ if (isset($this->hashAlgoFunctions[$functionNameLc]) === false) {
1299
+ return false;
1300
+ }
1301
+
1302
+ // Get the parameter from the function call which should contain the algorithm name.
1303
+ $algoParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->hashAlgoFunctions[$functionNameLc]);
1304
+ if ($algoParam === false) {
1305
+ return false;
1306
+ }
1307
+
1308
+ // Algorithm is a text string, so we need to remove the quotes.
1309
+ $algo = strtolower(trim($algoParam['raw']));
1310
+ $algo = $this->stripQuotes($algo);
1311
+
1312
+ return $algo;
1313
+ }
1314
+
1315
+
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
+
1328
+ $tokens = $phpcsFile->getTokens();
1329
+
1330
+ // Check for the existence of the token.
1331
+ if (isset($tokens[$stackPtr]) === false) {
1332
+ return false;
1333
+ }
1334
+
1335
+ // Is this one of the tokens this function handles ?
1336
+ if ($tokens[$stackPtr]['code'] !== T_STRING) {
1337
+ return false;
1338
+ }
1339
+
1340
+ // Check for older PHP, PHPCS version so we can compensate for misidentified tokens.
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;
1357
+ }
1358
+
1359
+ // Array of tokens which if found preceding the $stackPtr indicate that a T_STRING is not a global constant.
1360
+ $tokensToIgnore = array(
1361
+ 'T_NAMESPACE' => true,
1362
+ 'T_USE' => true,
1363
+ 'T_CLASS' => true,
1364
+ 'T_TRAIT' => true,
1365
+ 'T_INTERFACE' => true,
1366
+ 'T_EXTENDS' => true,
1367
+ 'T_IMPLEMENTS' => true,
1368
+ 'T_NEW' => true,
1369
+ 'T_FUNCTION' => true,
1370
+ 'T_DOUBLE_COLON' => true,
1371
+ 'T_OBJECT_OPERATOR' => true,
1372
+ 'T_INSTANCEOF' => true,
1373
+ 'T_INSTEADOF' => true,
1374
+ 'T_GOTO' => true,
1375
+ 'T_AS' => true,
1376
+ 'T_PUBLIC' => true,
1377
+ 'T_PROTECTED' => true,
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
1388
+ && $tokens[$prev]['content'] === 'insteadof'))))
1389
+ ) {
1390
+ // Not the use of a constant.
1391
+ return false;
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.
1407
+ return false;
1408
+ }
1409
+
1410
+ /*
1411
+ * Deal with a number of variations of use statements.
1412
+ */
1413
+ for ($i = $stackPtr; $i > 0; $i--) {
1414
+ if ($tokens[$i]['line'] !== $tokens[$stackPtr]['line']) {
1415
+ break;
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;
1430
+ }
1431
+ } else {
1432
+ // Not a const use statement.
1433
+ return false;
1434
+ }
1435
+ }
1436
+ }
1437
+
1438
+ return true;
1439
+ }
1440
+
1441
+
1442
+ /**
1443
+ * Determine whether the tokens between $start and $end together form a positive number
1444
+ * as recognized by PHP.
1445
+ *
1446
+ * The outcome of this function is reliable for `true`, `false` should be regarded as
1447
+ * "undetermined".
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.
1454
+ * @param int $end End of the snippet (inclusive), i.e. this
1455
+ * token will be examined as part of the snippet.
1456
+ * @param bool $allowFloats Whether to only consider integers, or also floats.
1457
+ *
1458
+ * @return bool True if PHP would evaluate the snippet as a positive number.
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
+
1466
+ if ($number === false) {
1467
+ return false;
1468
+ }
1469
+
1470
+ return ($number > 0);
1471
+ }
1472
+
1473
+
1474
+ /**
1475
+ * Determine whether the tokens between $start and $end together form a negative number
1476
+ * as recognized by PHP.
1477
+ *
1478
+ * The outcome of this function is reliable for `true`, `false` should be regarded as
1479
+ * "undetermined".
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.
1486
+ * @param int $end End of the snippet (inclusive), i.e. this
1487
+ * token will be examined as part of the snippet.
1488
+ * @param bool $allowFloats Whether to only consider integers, or also floats.
1489
+ *
1490
+ * @return bool True if PHP would evaluate the snippet as a negative number.
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
+
1498
+ if ($number === false) {
1499
+ return false;
1500
+ }
1501
+
1502
+ return ($number < 0);
1503
+
1504
+ }
1505
+
1506
+ /**
1507
+ * Determine whether the tokens between $start and $end together form a number
1508
+ * as recognized by PHP.
1509
+ *
1510
+ * The outcome of this function is reliable for "true-ish" values, `false` should
1511
+ * be regarded as "undetermined".
1512
+ *
1513
+ * @link https://3v4l.org/npTeM
1514
+ *
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.
1521
+ * @param int $end End of the snippet (inclusive), i.e. this
1522
+ * token will be examined as part of the snippet.
1523
+ * @param bool $allowFloats Whether to only consider integers, or also floats.
1524
+ *
1525
+ * @return int|float|bool The number found if PHP would evaluate the snippet as a number.
1526
+ * The return type will be int if $allowFloats is false, if
1527
+ * $allowFloats is true, the return type will be float.
1528
+ * False will be returned when the snippet does not evaluate to a
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;
1548
+
1549
+ $tokens = $phpcsFile->getTokens();
1550
+ $searchEnd = ($end + 1);
1551
+ $negativeNumber = false;
1552
+
1553
+ if (isset($tokens[$start], $tokens[$searchEnd]) === false) {
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) {
1571
+ return false;
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;
1595
+ }
1596
+
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;
1604
+ }
1605
+ } else {
1606
+ // Gather subsequent lines for a multi-line string.
1607
+ for ($i = $nextNonEmpty; $i < $searchEnd; $i++) {
1608
+ if ($tokens[$i]['code'] !== $tokens[$nextNonEmpty]['code']) {
1609
+ break;
1610
+ }
1611
+ $content .= $tokens[$i]['content'];
1612
+ }
1613
+
1614
+ $nextNonEmpty = --$i;
1615
+ $content = $this->stripQuotes($content);
1616
+ $stringContent = $content;
1617
+ }
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))`';
1625
+
1626
+ $intString = preg_match($regexInt, $content, $intMatch);
1627
+ $floatString = preg_match($regexFloat, $content, $floatMatch);
1628
+
1629
+ // Does the text string start with a number ? If so, PHP would juggle it and use it as a number.
1630
+ if ($allowFloats === false) {
1631
+ if ($intString !== 1 || $floatString === 1) {
1632
+ if ($floatString === 1) {
1633
+ // Found float. Only integers targetted.
1634
+ return false;
1635
+ }
1636
+
1637
+ $content = 0.0;
1638
+ } else {
1639
+ $content = (float) trim($intMatch[0]);
1640
+ }
1641
+ } else {
1642
+ if ($intString !== 1 && $floatString !== 1) {
1643
+ $content = 0.0;
1644
+ } else {
1645
+ $content = ($floatString === 1) ? (float) trim($floatMatch[0]) : (float) trim($intMatch[0]);
1646
+ }
1647
+ }
1648
+
1649
+ // Allow for different behaviour for hex numeric strings between PHP 5 vs PHP 7.
1650
+ if ($intString === 1 && trim($intMatch[0]) === '0'
1651
+ && preg_match('`^\s*(0x[A-Fa-f0-9]+)`', $stringContent, $hexNumberString) === 1
1652
+ && $this->supportsBelow('5.6') === true
1653
+ ) {
1654
+ // The filter extension still allows for hex numeric strings in PHP 7, so
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
+ }
1662
+ }
1663
+ }
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
+ }
1671
+
1672
+ if ($negativeNumber === true) {
1673
+ $content = -$content;
1674
+ }
1675
+
1676
+ if ($allowFloats === false) {
1677
+ return (int) $content;
1678
+ }
1679
+
1680
+ return $content;
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
+
1699
+ // Check for the existence of the token.
1700
+ if (isset($tokens[$stackPtr]) === false) {
1701
+ return false;
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;
1723
+ }
1724
+ break;
1725
+ }
1726
+
1727
+ if (isset($opener, $closer) === false) {
1728
+ // Parse error, live coding or real square bracket.
1729
+ return false;
1730
+ }
1731
+
1732
+ /*
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,
1754
+ null,
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
+ }
1789
+ }
1790
+ }
1791
+
1792
+ // Maybe this is a short list syntax nested inside another short list syntax ?
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,
1800
+ null,
1801
+ true
1802
+ );
1803
+
1804
+ if ($parentOpener === false) {
1805
+ return false;
1806
+ }
1807
+
1808
+ } while (isset($tokens[$parentOpener]['bracket_closer']) === true
1809
+ && $tokens[$parentOpener]['bracket_closer'] < $opener
1810
+ );
1811
+
1812
+ if (isset($tokens[$parentOpener]['bracket_closer']) === true
1813
+ && $tokens[$parentOpener]['bracket_closer'] > $closer
1814
+ ) {
1815
+ // Work around tokenizer issue in PHPCS 2.0 - 2.7.
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,
1826
+ null,
1827
+ true
1828
+ );
1829
+
1830
+ if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_EQUAL) {
1831
+ return true;
1832
+ }
1833
+
1834
+ return false;
1835
+ }
1836
+
1837
+ return $this->isShortList($phpcsFile, $parentOpener);
1838
+ }
1839
+
1840
+ return false;
1841
+ }
1842
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ArgumentFunctionsUsageSniff.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ArgumentFunctionsUsageSniff.
18
+ *
19
+ * - Prior to PHP 5.3, these functions could not be used as a function call parameter.
20
+ *
21
+ * - Calling these functions from the outermost scope of a file which has been included by
22
+ * calling `include` or `require` from within a function in the calling file, worked
23
+ * prior to PHP 5.3. As of PHP 5.3, this will generate a warning and will always return false/-1.
24
+ * If the file was called directly or included in the global scope, calls to these
25
+ * functions would already generate a warning prior to PHP 5.3.
26
+ *
27
+ * PHP version 5.3
28
+ *
29
+ * @category PHP
30
+ * @package PHPCompatibility
31
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
32
+ */
33
+ class ArgumentFunctionsUsageSniff extends Sniff
34
+ {
35
+
36
+ /**
37
+ * The target functions for this sniff.
38
+ *
39
+ * @var array
40
+ */
41
+ protected $targetFunctions = array(
42
+ 'func_get_args' => true,
43
+ 'func_get_arg' => true,
44
+ 'func_num_args' => true,
45
+ );
46
+
47
+
48
+ /**
49
+ * Returns an array of tokens this test wants to listen for.
50
+ *
51
+ * @return array
52
+ */
53
+ public function register()
54
+ {
55
+ return array(T_STRING);
56
+ }
57
+
58
+
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.
65
+ *
66
+ * @return void
67
+ */
68
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
69
+ {
70
+ $tokens = $phpcsFile->getTokens();
71
+ $functionLc = strtolower($tokens[$stackPtr]['content']);
72
+ if (isset($this->targetFunctions[$functionLc]) === false) {
73
+ return;
74
+ }
75
+
76
+ // Next non-empty token should be the open parenthesis.
77
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
78
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
79
+ return;
80
+ }
81
+
82
+ $ignore = array(
83
+ T_DOUBLE_COLON => true,
84
+ T_OBJECT_OPERATOR => true,
85
+ T_FUNCTION => true,
86
+ T_NEW => true,
87
+ );
88
+
89
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
90
+ if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) {
91
+ // Not a call to a PHP function.
92
+ return;
93
+ } elseif ($tokens[$prevNonEmpty]['code'] === T_NS_SEPARATOR && $tokens[$prevNonEmpty - 1]['code'] === T_STRING) {
94
+ // Namespaced function.
95
+ return;
96
+ }
97
+
98
+ $data = $tokens[$stackPtr]['content'];
99
+
100
+ /*
101
+ * Check for usage of the functions in the global scope.
102
+ *
103
+ * As PHPCS can not determine whether a file is included from within a function in
104
+ * another file, so always throw a warning/error.
105
+ */
106
+ if ($phpcsFile->hasCondition($stackPtr, array(T_FUNCTION, T_CLOSURE)) === false) {
107
+ $isError = false;
108
+ $message = 'Use of %s() outside of a user-defined function is only supported if the file is included from within a user-defined function in another file prior to PHP 5.3.';
109
+
110
+ if ($this->supportsAbove('5.3') === true) {
111
+ $isError = true;
112
+ $message .= ' As of PHP 5.3, it is no longer supported at all.';
113
+ }
114
+
115
+ $this->addMessage($phpcsFile, $message, $stackPtr, $isError, 'OutsideFunctionScope', $data);
116
+ }
117
+
118
+ /*
119
+ * Check for usage of the functions as a parameter in a function call.
120
+ */
121
+ if ($this->supportsBelow('5.2') === false) {
122
+ return;
123
+ }
124
+
125
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) {
126
+ return;
127
+ }
128
+
129
+ $throwError = false;
130
+
131
+ $closer = end($tokens[$stackPtr]['nested_parenthesis']);
132
+ if (isset($tokens[$closer]['parenthesis_owner'])
133
+ && $tokens[$tokens[$closer]['parenthesis_owner']]['type'] === 'T_CLOSURE'
134
+ ) {
135
+ $throwError = true;
136
+ } else {
137
+ $opener = key($tokens[$stackPtr]['nested_parenthesis']);
138
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($opener - 1), null, true);
139
+ if ($tokens[$prevNonEmpty]['code'] !== T_STRING) {
140
+ return;
141
+ }
142
+
143
+ $prevPrevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true);
144
+ if ($tokens[$prevPrevNonEmpty]['code'] === T_FUNCTION) {
145
+ return;
146
+ }
147
+
148
+ $throwError = true;
149
+ }
150
+
151
+ if ($throwError === false) {
152
+ return;
153
+ }
154
+
155
+ $phpcsFile->addError(
156
+ '%s() could not be used in parameter lists prior to PHP 5.3.',
157
+ $stackPtr,
158
+ 'InParameterList',
159
+ $data
160
+ );
161
+ }
162
+
163
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/CaseSensitiveKeywordsSniff.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\CaseSensitiveKeywordsSniff.
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
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
27
+ */
28
+ class CaseSensitiveKeywordsSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * Returns an array of tokens this test wants to listen for.
33
+ *
34
+ * @return array
35
+ */
36
+ public function register()
37
+ {
38
+ return array(
39
+ T_SELF,
40
+ T_STATIC,
41
+ T_PARENT,
42
+ );
43
+ }
44
+
45
+ /**
46
+ * Processes this test, when one of its tokens is encountered.
47
+ *
48
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
49
+ * @param int $stackPtr The position of the current token in the
50
+ * stack passed in $tokens.
51
+ *
52
+ * @return void
53
+ */
54
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
55
+ {
56
+ if ($this->supportsBelow('5.4') === false) {
57
+ return;
58
+ }
59
+
60
+ $tokens = $phpcsFile->getTokens();
61
+ $tokenContentLC = strtolower($tokens[$stackPtr]['content']);
62
+
63
+ if ($tokenContentLC !== $tokens[$stackPtr]['content']) {
64
+ $phpcsFile->addError(
65
+ 'The keyword \'%s\' was treated in a case-sensitive fashion in certain cases in PHP 5.4 or earlier. Use the lowercase version for consistent support.',
66
+ $stackPtr,
67
+ 'NonLowercaseFound',
68
+ array($tokenContentLC)
69
+ );
70
+ }
71
+ }
72
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ConstantArraysUsingConstSniff.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ConstantArraysUsingConstSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ConstantArraysUsingConstSniff.
18
+ *
19
+ * Constant arrays using the constant keyword in PHP 5.6
20
+ *
21
+ * PHP version 5.6
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ */
27
+ class ConstantArraysUsingConstSniff extends Sniff
28
+ {
29
+
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(T_CONST);
38
+ }
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsBelow('5.5') !== true) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+ $find = array(
57
+ T_ARRAY => T_ARRAY,
58
+ T_OPEN_SHORT_ARRAY => T_OPEN_SHORT_ARRAY,
59
+ );
60
+
61
+ while (($hasArray = $phpcsFile->findNext($find, ($stackPtr + 1), null, false, null, true)) !== false) {
62
+ $phpcsFile->addError(
63
+ 'Constant arrays using the "const" keyword are not allowed in PHP 5.5 or earlier',
64
+ $hasArray,
65
+ 'Found'
66
+ );
67
+
68
+ // Skip past the content of the array.
69
+ $stackPtr = $hasArray;
70
+ if ($tokens[$hasArray]['code'] === T_OPEN_SHORT_ARRAY && isset($tokens[$hasArray]['bracket_closer'])) {
71
+ $stackPtr = $tokens[$hasArray]['bracket_closer'];
72
+ } elseif ($tokens[$hasArray]['code'] === T_ARRAY && isset($tokens[$hasArray]['parenthesis_closer'])) {
73
+ $stackPtr = $tokens[$hasArray]['parenthesis_closer'];
74
+ }
75
+ }
76
+ }
77
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ConstantArraysUsingDefineSniff.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ConstantArraysUsingDefineSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ConstantArraysUsingDefineSniff.
18
+ *
19
+ * Constant arrays using define in PHP 7.0
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Wim Godden <wim@cu.be>
26
+ */
27
+ class ConstantArraysUsingDefineSniff extends Sniff
28
+ {
29
+
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(T_STRING);
38
+ }
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsBelow('5.6') !== true) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+
57
+ $ignore = array(
58
+ T_DOUBLE_COLON,
59
+ T_OBJECT_OPERATOR,
60
+ T_FUNCTION,
61
+ T_CONST,
62
+ );
63
+
64
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
65
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
66
+ // Not a call to a PHP function.
67
+ return;
68
+ }
69
+
70
+ $functionLc = strtolower($tokens[$stackPtr]['content']);
71
+ if ($functionLc !== 'define') {
72
+ return;
73
+ }
74
+
75
+ $secondParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, 2);
76
+ if (isset($secondParam['start'], $secondParam['end']) === false) {
77
+ return;
78
+ }
79
+
80
+ $targetNestingLevel = 0;
81
+ if (isset($tokens[$secondParam['start']]['nested_parenthesis'])) {
82
+ $targetNestingLevel = count($tokens[$secondParam['start']]['nested_parenthesis']);
83
+ }
84
+
85
+ $array = $phpcsFile->findNext(array(T_ARRAY, T_OPEN_SHORT_ARRAY), $secondParam['start'], ($secondParam['end'] + 1));
86
+ if ($array !== false) {
87
+ if ((isset($tokens[$array]['nested_parenthesis']) === false && $targetNestingLevel === 0) || count($tokens[$array]['nested_parenthesis']) === $targetNestingLevel) {
88
+ $phpcsFile->addError(
89
+ 'Constant arrays using define are not allowed in PHP 5.6 or earlier',
90
+ $array,
91
+ 'Found'
92
+ );
93
+ }
94
+ }
95
+ }
96
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php ADDED
@@ -0,0 +1,904 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedFunctionsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedFunctionsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Wim Godden <wim.godden@cu.be>
20
+ */
21
+ class DeprecatedFunctionsSniff extends AbstractRemovedFeatureSniff
22
+ {
23
+ /**
24
+ * A list of deprecated and removed functions with their alternatives.
25
+ *
26
+ * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
27
+ * If no alternative exists, it is NULL, i.e, the function should just not be used.
28
+ *
29
+ * @var array(string => array(string => bool|string|null))
30
+ */
31
+ protected $removedFunctions = array(
32
+ 'php_check_syntax' => array(
33
+ '5.0.5' => true,
34
+ 'alternative' => null,
35
+ ),
36
+ 'call_user_method' => array(
37
+ '5.3' => false,
38
+ '5.4' => false,
39
+ '5.5' => false,
40
+ '5.6' => false,
41
+ '7.0' => true,
42
+ 'alternative' => 'call_user_func()',
43
+ ),
44
+ 'call_user_method_array' => array(
45
+ '5.3' => false,
46
+ '5.4' => false,
47
+ '5.5' => false,
48
+ '5.6' => false,
49
+ '7.0' => true,
50
+ 'alternative' => 'call_user_func_array()',
51
+ ),
52
+ 'define_syslog_variables' => array(
53
+ '5.3' => false,
54
+ '5.4' => true,
55
+ '5.5' => true,
56
+ '5.6' => true,
57
+ 'alternative' => null,
58
+ ),
59
+ 'dl' => array(
60
+ '5.3' => false,
61
+ '5.4' => false,
62
+ '5.5' => false,
63
+ '5.6' => false,
64
+ 'alternative' => null,
65
+ ),
66
+ 'ereg' => array(
67
+ '5.3' => false,
68
+ '5.4' => false,
69
+ '5.5' => false,
70
+ '5.6' => false,
71
+ '7.0' => true,
72
+ 'alternative' => 'preg_match()',
73
+ ),
74
+ 'ereg_replace' => array(
75
+ '5.3' => false,
76
+ '5.4' => false,
77
+ '5.5' => false,
78
+ '5.6' => false,
79
+ '7.0' => true,
80
+ 'alternative' => 'preg_replace()',
81
+ ),
82
+ 'eregi' => array(
83
+ '5.3' => false,
84
+ '5.4' => false,
85
+ '5.5' => false,
86
+ '5.6' => false,
87
+ '7.0' => true,
88
+ 'alternative' => 'preg_match()',
89
+ ),
90
+ 'eregi_replace' => array(
91
+ '5.3' => false,
92
+ '5.4' => false,
93
+ '5.5' => false,
94
+ '5.6' => false,
95
+ '7.0' => true,
96
+ 'alternative' => 'preg_replace()',
97
+ ),
98
+ 'imagepsbbox' => array(
99
+ '7.0' => true,
100
+ 'alternative' => null,
101
+ ),
102
+ 'imagepsencodefont' => array(
103
+ '7.0' => true,
104
+ 'alternative' => null,
105
+ ),
106
+ 'imagepsextendfont' => array(
107
+ '7.0' => true,
108
+ 'alternative' => null,
109
+ ),
110
+ 'imagepsfreefont' => array(
111
+ '7.0' => true,
112
+ 'alternative' => null,
113
+ ),
114
+ 'imagepsloadfont' => array(
115
+ '7.0' => true,
116
+ 'alternative' => null,
117
+ ),
118
+ 'imagepsslantfont' => array(
119
+ '7.0' => true,
120
+ 'alternative' => null,
121
+ ),
122
+ 'imagepstext' => array(
123
+ '7.0' => true,
124
+ 'alternative' => null,
125
+ ),
126
+ 'import_request_variables' => array(
127
+ '5.3' => false,
128
+ '5.4' => true,
129
+ 'alternative' => null,
130
+ ),
131
+ 'ldap_sort' => array(
132
+ '7.0' => false,
133
+ 'alternative' => null,
134
+ ),
135
+ 'mcrypt_generic_end' => array(
136
+ '5.3' => false,
137
+ '5.4' => false,
138
+ '5.5' => false,
139
+ '5.6' => false,
140
+ '7.0' => true,
141
+ 'alternative' => 'mcrypt_generic_deinit()',
142
+ ),
143
+ 'mysql_db_query' => array(
144
+ '5.3' => false,
145
+ '5.4' => false,
146
+ '5.5' => false,
147
+ '5.6' => false,
148
+ '7.0' => true,
149
+ 'alternative' => 'mysqli::select_db() and mysqli::query()',
150
+ ),
151
+ 'mysql_escape_string' => array(
152
+ '5.3' => false,
153
+ '5.4' => false,
154
+ '5.5' => false,
155
+ '5.6' => false,
156
+ '7.0' => true,
157
+ 'alternative' => 'mysqli::real_escape_string()',
158
+ ),
159
+ 'mysql_list_dbs' => array(
160
+ '5.4' => false,
161
+ '5.5' => false,
162
+ '5.6' => false,
163
+ '7.0' => true,
164
+ 'alternative' => null,
165
+ ),
166
+ 'mysqli_bind_param' => array(
167
+ '5.3' => false,
168
+ '5.4' => true,
169
+ '5.5' => true,
170
+ '5.6' => true,
171
+ 'alternative' => 'mysqli_stmt::bind_param()',
172
+ ),
173
+ 'mysqli_bind_result' => array(
174
+ '5.3' => false,
175
+ '5.4' => true,
176
+ '5.5' => true,
177
+ '5.6' => true,
178
+ 'alternative' => 'mysqli_stmt::bind_result()',
179
+ ),
180
+ 'mysqli_client_encoding' => array(
181
+ '5.3' => false,
182
+ '5.4' => true,
183
+ '5.5' => true,
184
+ '5.6' => true,
185
+ 'alternative' => 'mysqli::character_set_name()',
186
+ ),
187
+ 'mysqli_fetch' => array(
188
+ '5.3' => false,
189
+ '5.4' => true,
190
+ '5.5' => true,
191
+ '5.6' => true,
192
+ 'alternative' => 'mysqli_stmt::fetch()',
193
+ ),
194
+ 'mysqli_param_count' => array(
195
+ '5.3' => false,
196
+ '5.4' => true,
197
+ '5.5' => true,
198
+ '5.6' => true,
199
+ 'alternative' => 'mysqli_stmt_param_count()',
200
+ ),
201
+ 'mysqli_get_metadata' => array(
202
+ '5.3' => false,
203
+ '5.4' => true,
204
+ '5.5' => true,
205
+ '5.6' => true,
206
+ 'alternative' => 'mysqli_stmt::result_metadata()',
207
+ ),
208
+ 'mysqli_send_long_data' => array(
209
+ '5.3' => false,
210
+ '5.4' => true,
211
+ '5.5' => true,
212
+ '5.6' => true,
213
+ 'alternative' => 'mysqli_stmt::send_long_data()',
214
+ ),
215
+ 'magic_quotes_runtime' => array(
216
+ '5.3' => false,
217
+ '5.4' => false,
218
+ '5.5' => false,
219
+ '5.6' => false,
220
+ '7.0' => true,
221
+ 'alternative' => null,
222
+ ),
223
+ 'session_register' => array(
224
+ '5.3' => false,
225
+ '5.4' => true,
226
+ '5.5' => true,
227
+ '5.6' => true,
228
+ 'alternative' => '$_SESSION',
229
+ ),
230
+ 'session_unregister' => array(
231
+ '5.3' => false,
232
+ '5.4' => true,
233
+ '5.5' => true,
234
+ '5.6' => true,
235
+ 'alternative' => '$_SESSION',
236
+ ),
237
+ 'session_is_registered' => array(
238
+ '5.3' => false,
239
+ '5.4' => true,
240
+ '5.5' => true,
241
+ '5.6' => true,
242
+ 'alternative' => '$_SESSION',
243
+ ),
244
+ 'set_magic_quotes_runtime' => array(
245
+ '5.3' => false,
246
+ '5.4' => false,
247
+ '5.5' => false,
248
+ '5.6' => false,
249
+ '7.0' => true,
250
+ 'alternative' => null,
251
+ ),
252
+ 'set_socket_blocking' => array(
253
+ '5.3' => false,
254
+ '5.4' => false,
255
+ '5.5' => false,
256
+ '5.6' => false,
257
+ '7.0' => true,
258
+ 'alternative' => 'stream_set_blocking()',
259
+ ),
260
+ 'split' => array(
261
+ '5.3' => false,
262
+ '5.4' => false,
263
+ '5.5' => false,
264
+ '5.6' => false,
265
+ '7.0' => true,
266
+ 'alternative' => 'preg_split()',
267
+ ),
268
+ 'spliti' => array(
269
+ '5.3' => false,
270
+ '5.4' => false,
271
+ '5.5' => false,
272
+ '5.6' => false,
273
+ '7.0' => true,
274
+ 'alternative' => 'preg_split()',
275
+ ),
276
+ 'sql_regcase' => array(
277
+ '5.3' => false,
278
+ '5.4' => false,
279
+ '5.5' => false,
280
+ '5.6' => false,
281
+ '7.0' => true,
282
+ 'alternative' => null,
283
+ ),
284
+ 'php_logo_guid' => array(
285
+ '5.5' => true,
286
+ '5.6' => true,
287
+ 'alternative' => null,
288
+ ),
289
+ 'php_egg_logo_guid' => array(
290
+ '5.5' => true,
291
+ '5.6' => true,
292
+ 'alternative' => null,
293
+ ),
294
+ 'php_real_logo_guid' => array(
295
+ '5.5' => true,
296
+ '5.6' => true,
297
+ 'alternative' => null,
298
+ ),
299
+ 'zend_logo_guid' => array(
300
+ '5.5' => true,
301
+ '5.6' => true,
302
+ 'alternative' => null,
303
+ ),
304
+ 'datefmt_set_timezone_id' => array(
305
+ '5.5' => false,
306
+ '5.6' => false,
307
+ '7.0' => true,
308
+ 'alternative' => 'IntlDateFormatter::setTimeZone()',
309
+ ),
310
+ 'mcrypt_ecb' => array(
311
+ '5.5' => false,
312
+ '5.6' => false,
313
+ '7.0' => true,
314
+ 'alternative' => null,
315
+ ),
316
+ 'mcrypt_cbc' => array(
317
+ '5.5' => false,
318
+ '5.6' => false,
319
+ '7.0' => true,
320
+ 'alternative' => null,
321
+ ),
322
+ 'mcrypt_cfb' => array(
323
+ '5.5' => false,
324
+ '5.6' => false,
325
+ '7.0' => true,
326
+ 'alternative' => null,
327
+ ),
328
+ 'mcrypt_ofb' => array(
329
+ '5.5' => false,
330
+ '5.6' => false,
331
+ '7.0' => true,
332
+ 'alternative' => null,
333
+ ),
334
+ 'ocibindbyname' => array(
335
+ '5.4' => false,
336
+ '5.5' => false,
337
+ '5.6' => false,
338
+ 'alternative' => 'oci_bind_by_name()',
339
+ ),
340
+ 'ocicancel' => array(
341
+ '5.4' => false,
342
+ '5.5' => false,
343
+ '5.6' => false,
344
+ 'alternative' => 'oci_cancel()',
345
+ ),
346
+ 'ocicloselob' => array(
347
+ '5.4' => false,
348
+ '5.5' => false,
349
+ '5.6' => false,
350
+ 'alternative' => 'OCI-Lob::close()',
351
+ ),
352
+ 'ocicollappend' => array(
353
+ '5.4' => false,
354
+ '5.5' => false,
355
+ '5.6' => false,
356
+ 'alternative' => 'OCI-Collection::append()',
357
+ ),
358
+ 'ocicollassign' => array(
359
+ '5.4' => false,
360
+ '5.5' => false,
361
+ '5.6' => false,
362
+ 'alternative' => 'OCI-Collection::assign()',
363
+ ),
364
+ 'ocicollassignelem' => array(
365
+ '5.4' => false,
366
+ '5.5' => false,
367
+ '5.6' => false,
368
+ 'alternative' => 'OCI-Collection::assignElem()',
369
+ ),
370
+ 'ocicollgetelem' => array(
371
+ '5.4' => false,
372
+ '5.5' => false,
373
+ '5.6' => false,
374
+ 'alternative' => 'OCI-Collection::getElem()',
375
+ ),
376
+ 'ocicollmax' => array(
377
+ '5.4' => false,
378
+ '5.5' => false,
379
+ '5.6' => false,
380
+ 'alternative' => 'OCI-Collection::max()',
381
+ ),
382
+ 'ocicollsize' => array(
383
+ '5.4' => false,
384
+ '5.5' => false,
385
+ '5.6' => false,
386
+ 'alternative' => 'OCI-Collection::size()',
387
+ ),
388
+ 'ocicolltrim' => array(
389
+ '5.4' => false,
390
+ '5.5' => false,
391
+ '5.6' => false,
392
+ 'alternative' => 'OCI-Collection::trim()',
393
+ ),
394
+ 'ocicolumnisnull' => array(
395
+ '5.4' => false,
396
+ '5.5' => false,
397
+ '5.6' => false,
398
+ 'alternative' => 'oci_field_is_null()',
399
+ ),
400
+ 'ocicolumnname' => array(
401
+ '5.4' => false,
402
+ '5.5' => false,
403
+ '5.6' => false,
404
+ 'alternative' => 'oci_field_name()',
405
+ ),
406
+ 'ocicolumnprecision' => array(
407
+ '5.4' => false,
408
+ '5.5' => false,
409
+ '5.6' => false,
410
+ 'alternative' => 'oci_field_precision()',
411
+ ),
412
+ 'ocicolumnscale' => array(
413
+ '5.4' => false,
414
+ '5.5' => false,
415
+ '5.6' => false,
416
+ 'alternative' => 'oci_field_scale()',
417
+ ),
418
+ 'ocicolumnsize' => array(
419
+ '5.4' => false,
420
+ '5.5' => false,
421
+ '5.6' => false,
422
+ 'alternative' => 'oci_field_size()',
423
+ ),
424
+ 'ocicolumntype' => array(
425
+ '5.4' => false,
426
+ '5.5' => false,
427
+ '5.6' => false,
428
+ 'alternative' => 'oci_field_type()',
429
+ ),
430
+ 'ocicolumntyperaw' => array(
431
+ '5.4' => false,
432
+ '5.5' => false,
433
+ '5.6' => false,
434
+ 'alternative' => 'oci_field_type_raw()',
435
+ ),
436
+ 'ocicommit' => array(
437
+ '5.4' => false,
438
+ '5.5' => false,
439
+ '5.6' => false,
440
+ 'alternative' => 'oci_commit()',
441
+ ),
442
+ 'ocidefinebyname' => array(
443
+ '5.4' => false,
444
+ '5.5' => false,
445
+ '5.6' => false,
446
+ 'alternative' => 'oci_define_by_name()',
447
+ ),
448
+ 'ocierror' => array(
449
+ '5.4' => false,
450
+ '5.5' => false,
451
+ '5.6' => false,
452
+ 'alternative' => 'oci_error()',
453
+ ),
454
+ 'ociexecute' => array(
455
+ '5.4' => false,
456
+ '5.5' => false,
457
+ '5.6' => false,
458
+ 'alternative' => 'oci_execute()',
459
+ ),
460
+ 'ocifetch' => array(
461
+ '5.4' => false,
462
+ '5.5' => false,
463
+ '5.6' => false,
464
+ 'alternative' => 'oci_fetch()',
465
+ ),
466
+ 'ocifetchinto' => array(
467
+ '5.4' => false,
468
+ '5.5' => false,
469
+ '5.6' => false,
470
+ 'alternative' => null,
471
+ ),
472
+ 'ocifetchstatement' => array(
473
+ '5.4' => false,
474
+ '5.5' => false,
475
+ '5.6' => false,
476
+ 'alternative' => 'oci_fetch_all()',
477
+ ),
478
+ 'ocifreecollection' => array(
479
+ '5.4' => false,
480
+ '5.5' => false,
481
+ '5.6' => false,
482
+ 'alternative' => 'OCI-Collection::free()',
483
+ ),
484
+ 'ocifreecursor' => array(
485
+ '5.4' => false,
486
+ '5.5' => false,
487
+ '5.6' => false,
488
+ 'alternative' => 'oci_free_statement()',
489
+ ),
490
+ 'ocifreedesc' => array(
491
+ '5.4' => false,
492
+ '5.5' => false,
493
+ '5.6' => false,
494
+ 'alternative' => 'OCI-Lob::free()',
495
+ ),
496
+ 'ocifreestatement' => array(
497
+ '5.4' => false,
498
+ '5.5' => false,
499
+ '5.6' => false,
500
+ 'alternative' => 'oci_free_statement()',
501
+ ),
502
+ 'ociinternaldebug' => array(
503
+ '5.4' => false,
504
+ '5.5' => false,
505
+ '5.6' => false,
506
+ 'alternative' => 'oci_internal_debug()',
507
+ ),
508
+ 'ociloadlob' => array(
509
+ '5.4' => false,
510
+ '5.5' => false,
511
+ '5.6' => false,
512
+ 'alternative' => 'OCI-Lob::load()',
513
+ ),
514
+ 'ocilogoff' => array(
515
+ '5.4' => false,
516
+ '5.5' => false,
517
+ '5.6' => false,
518
+ 'alternative' => 'oci_close()',
519
+ ),
520
+ 'ocilogon' => array(
521
+ '5.4' => false,
522
+ '5.5' => false,
523
+ '5.6' => false,
524
+ 'alternative' => 'oci_connect()',
525
+ ),
526
+ 'ocinewcollection' => array(
527
+ '5.4' => false,
528
+ '5.5' => false,
529
+ '5.6' => false,
530
+ 'alternative' => 'oci_new_collection()',
531
+ ),
532
+ 'ocinewcursor' => array(
533
+ '5.4' => false,
534
+ '5.5' => false,
535
+ '5.6' => false,
536
+ 'alternative' => 'oci_new_cursor()',
537
+ ),
538
+ 'ocinewdescriptor' => array(
539
+ '5.4' => false,
540
+ '5.5' => false,
541
+ '5.6' => false,
542
+ 'alternative' => 'oci_new_descriptor()',
543
+ ),
544
+ 'ocinlogon' => array(
545
+ '5.4' => false,
546
+ '5.5' => false,
547
+ '5.6' => false,
548
+ 'alternative' => 'oci_new_connect()',
549
+ ),
550
+ 'ocinumcols' => array(
551
+ '5.4' => false,
552
+ '5.5' => false,
553
+ '5.6' => false,
554
+ 'alternative' => 'oci_num_fields()',
555
+ ),
556
+ 'ociparse' => array(
557
+ '5.4' => false,
558
+ '5.5' => false,
559
+ '5.6' => false,
560
+ 'alternative' => 'oci_parse()',
561
+ ),
562
+ 'ociplogon' => array(
563
+ '5.4' => false,
564
+ '5.5' => false,
565
+ '5.6' => false,
566
+ 'alternative' => 'oci_pconnect()',
567
+ ),
568
+ 'ociresult' => array(
569
+ '5.4' => false,
570
+ '5.5' => false,
571
+ '5.6' => false,
572
+ 'alternative' => 'oci_result()',
573
+ ),
574
+ 'ocirollback' => array(
575
+ '5.4' => false,
576
+ '5.5' => false,
577
+ '5.6' => false,
578
+ 'alternative' => 'oci_rollback()',
579
+ ),
580
+ 'ocirowcount' => array(
581
+ '5.4' => false,
582
+ '5.5' => false,
583
+ '5.6' => false,
584
+ 'alternative' => 'oci_num_rows()',
585
+ ),
586
+ 'ocisavelob' => array(
587
+ '5.4' => false,
588
+ '5.5' => false,
589
+ '5.6' => false,
590
+ 'alternative' => 'OCI-Lob::save()',
591
+ ),
592
+ 'ocisavelobfile' => array(
593
+ '5.4' => false,
594
+ '5.5' => false,
595
+ '5.6' => false,
596
+ 'alternative' => 'OCI-Lob::import()',
597
+ ),
598
+ 'ociserverversion' => array(
599
+ '5.4' => false,
600
+ '5.5' => false,
601
+ '5.6' => false,
602
+ 'alternative' => 'oci_server_version()',
603
+ ),
604
+ 'ocisetprefetch' => array(
605
+ '5.4' => false,
606
+ '5.5' => false,
607
+ '5.6' => false,
608
+ 'alternative' => 'oci_set_prefetch()',
609
+ ),
610
+ 'ocistatementtype' => array(
611
+ '5.4' => false,
612
+ '5.5' => false,
613
+ '5.6' => false,
614
+ 'alternative' => 'oci_statement_type()',
615
+ ),
616
+ 'ociwritelobtofile' => array(
617
+ '5.4' => false,
618
+ '5.5' => false,
619
+ '5.6' => false,
620
+ 'alternative' => 'OCI-Lob::export()',
621
+ ),
622
+ 'ociwritetemporarylob' => array(
623
+ '5.4' => false,
624
+ '5.5' => false,
625
+ '5.6' => false,
626
+ 'alternative' => 'OCI-Lob::writeTemporary()',
627
+ ),
628
+ 'mysqli_get_cache_stats' => array(
629
+ '5.4' => true,
630
+ 'alternative' => null,
631
+ ),
632
+
633
+ 'mcrypt_create_iv' => array(
634
+ '7.1' => false,
635
+ '7.2' => true,
636
+ 'alternative' => 'random_bytes() or OpenSSL',
637
+ ),
638
+ 'mcrypt_decrypt' => array(
639
+ '7.1' => false,
640
+ '7.2' => true,
641
+ 'alternative' => 'OpenSSL',
642
+ ),
643
+ 'mcrypt_enc_get_algorithms_name' => array(
644
+ '7.1' => false,
645
+ '7.2' => true,
646
+ 'alternative' => 'OpenSSL',
647
+ ),
648
+ 'mcrypt_enc_get_block_size' => array(
649
+ '7.1' => false,
650
+ '7.2' => true,
651
+ 'alternative' => 'OpenSSL',
652
+ ),
653
+ 'mcrypt_enc_get_iv_size' => array(
654
+ '7.1' => false,
655
+ '7.2' => true,
656
+ 'alternative' => 'OpenSSL',
657
+ ),
658
+ 'mcrypt_enc_get_key_size' => array(
659
+ '7.1' => false,
660
+ '7.2' => true,
661
+ 'alternative' => 'OpenSSL',
662
+ ),
663
+ 'mcrypt_enc_get_modes_name' => array(
664
+ '7.1' => false,
665
+ '7.2' => true,
666
+ 'alternative' => 'OpenSSL',
667
+ ),
668
+ 'mcrypt_enc_get_supported_key_sizes' => array(
669
+ '7.1' => false,
670
+ '7.2' => true,
671
+ 'alternative' => 'OpenSSL',
672
+ ),
673
+ 'mcrypt_enc_is_block_algorithm_mode' => array(
674
+ '7.1' => false,
675
+ '7.2' => true,
676
+ 'alternative' => 'OpenSSL',
677
+ ),
678
+ 'mcrypt_enc_is_block_algorithm' => array(
679
+ '7.1' => false,
680
+ '7.2' => true,
681
+ 'alternative' => 'OpenSSL',
682
+ ),
683
+ 'mcrypt_enc_is_block_mode' => array(
684
+ '7.1' => false,
685
+ '7.2' => true,
686
+ 'alternative' => 'OpenSSL',
687
+ ),
688
+ 'mcrypt_enc_self_test' => array(
689
+ '7.1' => false,
690
+ '7.2' => true,
691
+ 'alternative' => 'OpenSSL',
692
+ ),
693
+ 'mcrypt_encrypt' => array(
694
+ '7.1' => false,
695
+ '7.2' => true,
696
+ 'alternative' => 'OpenSSL',
697
+ ),
698
+ 'mcrypt_generic_deinit' => array(
699
+ '7.1' => false,
700
+ '7.2' => true,
701
+ 'alternative' => 'OpenSSL',
702
+ ),
703
+ 'mcrypt_generic_init' => array(
704
+ '7.1' => false,
705
+ '7.2' => true,
706
+ 'alternative' => 'OpenSSL',
707
+ ),
708
+ 'mcrypt_generic' => array(
709
+ '7.1' => false,
710
+ '7.2' => true,
711
+ 'alternative' => 'OpenSSL',
712
+ ),
713
+ 'mcrypt_get_block_size' => array(
714
+ '7.1' => false,
715
+ '7.2' => true,
716
+ 'alternative' => 'OpenSSL',
717
+ ),
718
+ 'mcrypt_get_cipher_name' => array(
719
+ '7.1' => false,
720
+ '7.2' => true,
721
+ 'alternative' => 'OpenSSL',
722
+ ),
723
+ 'mcrypt_get_iv_size' => array(
724
+ '7.1' => false,
725
+ '7.2' => true,
726
+ 'alternative' => 'OpenSSL',
727
+ ),
728
+ 'mcrypt_get_key_size' => array(
729
+ '7.1' => false,
730
+ '7.2' => true,
731
+ 'alternative' => 'OpenSSL',
732
+ ),
733
+ 'mcrypt_list_algorithms' => array(
734
+ '7.1' => false,
735
+ '7.2' => true,
736
+ 'alternative' => 'OpenSSL',
737
+ ),
738
+ 'mcrypt_list_modes' => array(
739
+ '7.1' => false,
740
+ '7.2' => true,
741
+ 'alternative' => 'OpenSSL',
742
+ ),
743
+ 'mcrypt_module_close' => array(
744
+ '7.1' => false,
745
+ '7.2' => true,
746
+ 'alternative' => 'OpenSSL',
747
+ ),
748
+ 'mcrypt_module_get_algo_block_size' => array(
749
+ '7.1' => false,
750
+ '7.2' => true,
751
+ 'alternative' => 'OpenSSL',
752
+ ),
753
+ 'mcrypt_module_get_algo_key_size' => array(
754
+ '7.1' => false,
755
+ '7.2' => true,
756
+ 'alternative' => 'OpenSSL',
757
+ ),
758
+ 'mcrypt_module_get_supported_key_sizes' => array(
759
+ '7.1' => false,
760
+ '7.2' => true,
761
+ 'alternative' => 'OpenSSL',
762
+ ),
763
+ 'mcrypt_module_is_block_algorithm_mode' => array(
764
+ '7.1' => false,
765
+ '7.2' => true,
766
+ 'alternative' => 'OpenSSL',
767
+ ),
768
+ 'mcrypt_module_is_block_algorithm' => array(
769
+ '7.1' => false,
770
+ '7.2' => true,
771
+ 'alternative' => 'OpenSSL',
772
+ ),
773
+ 'mcrypt_module_is_block_mode' => array(
774
+ '7.1' => false,
775
+ '7.2' => true,
776
+ 'alternative' => 'OpenSSL',
777
+ ),
778
+ 'mcrypt_module_open' => array(
779
+ '7.1' => false,
780
+ '7.2' => true,
781
+ 'alternative' => 'OpenSSL',
782
+ ),
783
+ 'mcrypt_module_self_test' => array(
784
+ '7.1' => false,
785
+ '7.2' => true,
786
+ 'alternative' => 'OpenSSL',
787
+ ),
788
+ 'mdecrypt_generic' => array(
789
+ '7.1' => false,
790
+ '7.2' => true,
791
+ 'alternative' => 'OpenSSL',
792
+ ),
793
+ 'jpeg2wbmp' => array(
794
+ '7.2' => false,
795
+ 'alternative' => 'imagecreatefromjpeg() and imagewbmp()',
796
+ ),
797
+ 'png2wbmp' => array(
798
+ '7.2' => false,
799
+ 'alternative' => 'imagecreatefrompng() or imagewbmp()',
800
+ ),
801
+ 'create_function' => array(
802
+ '7.2' => false,
803
+ 'alternative' => 'an anonymous function',
804
+ ),
805
+ 'each' => array(
806
+ '7.2' => false,
807
+ 'alternative' => 'a foreach loop',
808
+ ),
809
+ 'gmp_random' => array(
810
+ '7.2' => false,
811
+ 'alternative' => 'gmp_random_bits() or gmp_random_range()',
812
+ ),
813
+ 'read_exif_data' => array(
814
+ '7.2' => false,
815
+ 'alternative' => 'exif_read_data()',
816
+ ),
817
+ );
818
+
819
+
820
+ /**
821
+ * Returns an array of tokens this test wants to listen for.
822
+ *
823
+ * @return array
824
+ */
825
+ public function register()
826
+ {
827
+ // Handle case-insensitivity of function names.
828
+ $this->removedFunctions = $this->arrayKeysToLowercase($this->removedFunctions);
829
+
830
+ return array(T_STRING);
831
+
832
+ }//end register()
833
+
834
+
835
+ /**
836
+ * Processes this test, when one of its tokens is encountered.
837
+ *
838
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
839
+ * @param int $stackPtr The position of the current token in
840
+ * the stack passed in $tokens.
841
+ *
842
+ * @return void
843
+ */
844
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
845
+ {
846
+ $tokens = $phpcsFile->getTokens();
847
+
848
+ $ignore = array(
849
+ T_DOUBLE_COLON,
850
+ T_OBJECT_OPERATOR,
851
+ T_FUNCTION,
852
+ T_CLASS,
853
+ T_CONST,
854
+ T_USE,
855
+ T_NS_SEPARATOR,
856
+ );
857
+
858
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
859
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
860
+ // Not a call to a PHP function.
861
+ return;
862
+ }
863
+
864
+ $function = $tokens[$stackPtr]['content'];
865
+ $functionLc = strtolower($function);
866
+
867
+ if (isset($this->removedFunctions[$functionLc]) === false) {
868
+ return;
869
+ }
870
+
871
+ $itemInfo = array(
872
+ 'name' => $function,
873
+ 'nameLc' => $functionLc,
874
+ );
875
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
876
+
877
+ }//end process()
878
+
879
+
880
+ /**
881
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
882
+ *
883
+ * @param array $itemInfo Base information about the item.
884
+ *
885
+ * @return array Version and other information about the item.
886
+ */
887
+ public function getItemArray(array $itemInfo)
888
+ {
889
+ return $this->removedFunctions[$itemInfo['nameLc']];
890
+ }
891
+
892
+
893
+ /**
894
+ * Get the error message template for this sniff.
895
+ *
896
+ * @return string
897
+ */
898
+ protected function getErrorMsgTemplate()
899
+ {
900
+ return 'Function %s() is ';
901
+ }
902
+
903
+
904
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedIniDirectivesSniff.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedIniDirectivesSniff.
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\PHP;
12
+
13
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedIniDirectivesSniff.
17
+ *
18
+ * Discourages the use of deprecated INI directives through ini_set() or ini_get().
19
+ *
20
+ * @category PHP
21
+ * @package PHPCompatibility
22
+ * @author Wim Godden <wim.godden@cu.be>
23
+ * @copyright 2012 Cu.be Solutions bvba
24
+ */
25
+ class DeprecatedIniDirectivesSniff extends AbstractRemovedFeatureSniff
26
+ {
27
+ /**
28
+ * A list of deprecated INI directives.
29
+ *
30
+ * The array lists : version number with false (deprecated) and true (removed).
31
+ * If's sufficient to list the first version where the ini directive was deprecated/removed.
32
+ *
33
+ * @var array(string)
34
+ */
35
+ protected $deprecatedIniDirectives = array(
36
+ 'fbsql.batchSize' => array(
37
+ '5.1' => true,
38
+ 'alternative' => 'fbsql.batchsize',
39
+ ),
40
+
41
+ 'ifx.allow_persistent' => array(
42
+ '5.2.1' => true,
43
+ ),
44
+ 'ifx.blobinfile' => array(
45
+ '5.2.1' => true,
46
+ ),
47
+ 'ifx.byteasvarchar' => array(
48
+ '5.2.1' => true,
49
+ ),
50
+ 'ifx.charasvarchar' => array(
51
+ '5.2.1' => true,
52
+ ),
53
+ 'ifx.default_host' => array(
54
+ '5.2.1' => true,
55
+ ),
56
+ 'ifx.default_password' => array(
57
+ '5.2.1' => true,
58
+ ),
59
+ 'ifx.default_user' => array(
60
+ '5.2.1' => true,
61
+ ),
62
+ 'ifx.max_links' => array(
63
+ '5.2.1' => true,
64
+ ),
65
+ 'ifx.max_persistent' => array(
66
+ '5.2.1' => true,
67
+ ),
68
+ 'ifx.nullformat' => array(
69
+ '5.2.1' => true,
70
+ ),
71
+ 'ifx.textasvarchar' => array(
72
+ '5.2.1' => true,
73
+ ),
74
+
75
+ 'zend.ze1_compatibility_mode' => array(
76
+ '5.3' => true,
77
+ ),
78
+
79
+ 'allow_call_time_pass_reference' => array(
80
+ '5.3' => false,
81
+ '5.4' => true,
82
+ ),
83
+ 'define_syslog_variables' => array(
84
+ '5.3' => false,
85
+ '5.4' => true,
86
+ ),
87
+ 'detect_unicode' => array(
88
+ '5.4' => true,
89
+ 'alternative' => 'zend.detect_unicode',
90
+ ),
91
+ 'highlight.bg' => array(
92
+ '5.3' => false,
93
+ '5.4' => true,
94
+ ),
95
+ 'magic_quotes_gpc' => array(
96
+ '5.3' => false,
97
+ '5.4' => true,
98
+ ),
99
+ 'magic_quotes_runtime' => array(
100
+ '5.3' => false,
101
+ '5.4' => true,
102
+ ),
103
+ 'magic_quotes_sybase' => array(
104
+ '5.3' => false,
105
+ '5.4' => true,
106
+ ),
107
+ 'mbstring.script_encoding' => array(
108
+ '5.4' => true,
109
+ 'alternative' => 'zend.script_encoding',
110
+ ),
111
+ 'register_globals' => array(
112
+ '5.3' => false,
113
+ '5.4' => true,
114
+ ),
115
+ 'register_long_arrays' => array(
116
+ '5.3' => false,
117
+ '5.4' => true,
118
+ ),
119
+ 'safe_mode' => array(
120
+ '5.3' => false,
121
+ '5.4' => true,
122
+ ),
123
+ 'safe_mode_allowed_env_vars' => array(
124
+ '5.3' => false,
125
+ '5.4' => true,
126
+ ),
127
+ 'safe_mode_exec_dir' => array(
128
+ '5.3' => false,
129
+ '5.4' => true,
130
+ ),
131
+ 'safe_mode_gid' => array(
132
+ '5.3' => false,
133
+ '5.4' => true,
134
+ ),
135
+ 'safe_mode_include_dir' => array(
136
+ '5.3' => false,
137
+ '5.4' => true,
138
+ ),
139
+ 'safe_mode_protected_env_vars' => array(
140
+ '5.3' => false,
141
+ '5.4' => true,
142
+ ),
143
+ 'session.bug_compat_42' => array(
144
+ '5.3' => false,
145
+ '5.4' => true,
146
+ ),
147
+ 'session.bug_compat_warn' => array(
148
+ '5.3' => false,
149
+ '5.4' => true,
150
+ ),
151
+ 'y2k_compliance' => array(
152
+ '5.3' => false,
153
+ '5.4' => true,
154
+ ),
155
+
156
+ 'always_populate_raw_post_data' => array(
157
+ '5.6' => false,
158
+ '7.0' => true,
159
+ ),
160
+ 'iconv.input_encoding' => array(
161
+ '5.6' => false,
162
+ ),
163
+ 'iconv.output_encoding' => array(
164
+ '5.6' => false,
165
+ ),
166
+ 'iconv.internal_encoding' => array(
167
+ '5.6' => false,
168
+ ),
169
+ 'mbstring.http_input' => array(
170
+ '5.6' => false,
171
+ ),
172
+ 'mbstring.http_output' => array(
173
+ '5.6' => false,
174
+ ),
175
+ 'mbstring.internal_encoding' => array(
176
+ '5.6' => false,
177
+ ),
178
+
179
+ 'asp_tags' => array(
180
+ '7.0' => true,
181
+ ),
182
+ 'xsl.security_prefs' => array(
183
+ '7.0' => true,
184
+ ),
185
+
186
+ 'mcrypt.algorithms_dir' => array(
187
+ '7.1' => false,
188
+ '7.2' => true,
189
+ ),
190
+ 'mcrypt.modes_dir' => array(
191
+ '7.1' => false,
192
+ '7.2' => true,
193
+ ),
194
+ 'session.entropy_file' => array(
195
+ '7.1' => true,
196
+ ),
197
+ 'session.entropy_length' => array(
198
+ '7.1' => true,
199
+ ),
200
+ 'session.hash_function' => array(
201
+ '7.1' => true,
202
+ ),
203
+ 'session.hash_bits_per_character' => array(
204
+ '7.1' => true,
205
+ ),
206
+
207
+ 'mbstring.func_overload' => array(
208
+ '7.2' => false,
209
+ ),
210
+ 'sql.safe_mode' => array(
211
+ '7.2' => true,
212
+ ),
213
+ 'track_errors' => array(
214
+ '7.2' => false,
215
+ ),
216
+ 'opcache.fast_shutdown' => array(
217
+ '7.2' => true,
218
+ ),
219
+ );
220
+
221
+ /**
222
+ * Returns an array of tokens this test wants to listen for.
223
+ *
224
+ * @return array
225
+ */
226
+ public function register()
227
+ {
228
+ return array(T_STRING);
229
+
230
+ }//end register()
231
+
232
+ /**
233
+ * Processes this test, when one of its tokens is encountered.
234
+ *
235
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
236
+ * @param int $stackPtr The position of the current token in the
237
+ * stack passed in $tokens.
238
+ *
239
+ * @return void
240
+ */
241
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
242
+ {
243
+ $tokens = $phpcsFile->getTokens();
244
+
245
+ $ignore = array(
246
+ T_DOUBLE_COLON,
247
+ T_OBJECT_OPERATOR,
248
+ T_FUNCTION,
249
+ T_CONST,
250
+ );
251
+
252
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
253
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
254
+ // Not a call to a PHP function.
255
+ return;
256
+ }
257
+
258
+ $functionLc = strtolower($tokens[$stackPtr]['content']);
259
+ if (isset($this->iniFunctions[$functionLc]) === false) {
260
+ return;
261
+ }
262
+
263
+ $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);
264
+ if ($iniToken === false) {
265
+ return;
266
+ }
267
+
268
+ $filteredToken = $this->stripQuotes($iniToken['raw']);
269
+ if (isset($this->deprecatedIniDirectives[$filteredToken]) === false) {
270
+ return;
271
+ }
272
+
273
+ $itemInfo = array(
274
+ 'name' => $filteredToken,
275
+ 'functionLc' => $functionLc,
276
+ );
277
+ $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
278
+
279
+ }//end process()
280
+
281
+
282
+ /**
283
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
284
+ *
285
+ * @param array $itemInfo Base information about the item.
286
+ *
287
+ * @return array Version and other information about the item.
288
+ */
289
+ public function getItemArray(array $itemInfo)
290
+ {
291
+ return $this->deprecatedIniDirectives[$itemInfo['name']];
292
+ }
293
+
294
+
295
+ /**
296
+ * Retrieve the relevant detail (version) information for use in an error message.
297
+ *
298
+ * @param array $itemArray Version and other information about the item.
299
+ * @param array $itemInfo Base information about the item.
300
+ *
301
+ * @return array
302
+ */
303
+ public function getErrorInfo(array $itemArray, array $itemInfo)
304
+ {
305
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
306
+
307
+ // Lower error level to warning if the function used was ini_get.
308
+ if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') {
309
+ $errorInfo['error'] = false;
310
+ }
311
+
312
+ return $errorInfo;
313
+ }
314
+
315
+
316
+ /**
317
+ * Get the error message template for this sniff.
318
+ *
319
+ * @return string
320
+ */
321
+ protected function getErrorMsgTemplate()
322
+ {
323
+ return "INI directive '%s' is ";
324
+ }
325
+
326
+
327
+ /**
328
+ * Get the error message template for suggesting an alternative for a specific sniff.
329
+ *
330
+ * @return string
331
+ */
332
+ protected function getAlternativeOptionTemplate()
333
+ {
334
+ return str_replace("%s", "'%s'", parent::getAlternativeOptionTemplate());
335
+ }
336
+
337
+
338
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedMagicAutoloadSniff.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedMagicAutoloadSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedMagicAutoloadSniff.
18
+ *
19
+ * @category PHP
20
+ * @package PHPCompatibility
21
+ * @author Wim Godden <wim.godden@cu.be>
22
+ */
23
+ class DeprecatedMagicAutoloadSniff extends Sniff
24
+ {
25
+ /**
26
+ * Scopes to look for when testing using validDirectScope
27
+ *
28
+ * @var array
29
+ */
30
+ private $checkForScopes = array(
31
+ 'T_CLASS' => true,
32
+ 'T_ANON_CLASS' => true,
33
+ 'T_INTERFACE' => true,
34
+ 'T_TRAIT' => true,
35
+ 'T_NAMESPACE' => true,
36
+ );
37
+
38
+ /**
39
+ * Returns an array of tokens this test wants to listen for.
40
+ *
41
+ * @return array
42
+ */
43
+ public function register()
44
+ {
45
+ return array(T_FUNCTION);
46
+ }//end register()
47
+
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.
54
+ *
55
+ * @return void
56
+ */
57
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
58
+ {
59
+ if ($this->supportsAbove('7.2') === false) {
60
+ return;
61
+ }
62
+
63
+ $funcName = $phpcsFile->getDeclarationName($stackPtr);
64
+
65
+ if (strtolower($funcName) !== '__autoload') {
66
+ return;
67
+ }
68
+
69
+ if ($this->validDirectScope($phpcsFile, $stackPtr, $this->checkForScopes) === true) {
70
+ return;
71
+ }
72
+
73
+ if ($this->determineNamespace($phpcsFile, $stackPtr) !== '') {
74
+ return;
75
+ }
76
+
77
+ $phpcsFile->addWarning('Use of __autoload() function is deprecated since PHP 7.2', $stackPtr, 'Found');
78
+ }//end process()
79
+
80
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedNewReferenceSniff.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedNewReferenceSniff.
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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedNewReferenceSniff.
19
+ *
20
+ * Discourages the use of assigning the return value of new by reference
21
+ *
22
+ * PHP version 5.4
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Wim Godden <wim.godden@cu.be>
27
+ * @copyright 2012 Cu.be Solutions bvba
28
+ */
29
+ class DeprecatedNewReferenceSniff extends Sniff
30
+ {
31
+
32
+ /**
33
+ * Returns an array of tokens this test wants to listen for.
34
+ *
35
+ * @return array
36
+ */
37
+ public function register()
38
+ {
39
+ return array(T_NEW);
40
+
41
+ }//end register()
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.
49
+ *
50
+ * @return void
51
+ */
52
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
+ {
54
+ if ($this->supportsAbove('5.3') === false) {
55
+ return;
56
+ }
57
+
58
+ $tokens = $phpcsFile->getTokens();
59
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
60
+ if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['type'] !== 'T_BITWISE_AND') {
61
+ return;
62
+ }
63
+
64
+ $error = 'Assigning the return value of new by reference is deprecated in PHP 5.3';
65
+ $isError = false;
66
+ $errorCode = 'Deprecated';
67
+
68
+ if ($this->supportsAbove('7.0') === true) {
69
+ $error .= ' and has been removed in PHP 7.0';
70
+ $isError = true;
71
+ $errorCode = 'Removed';
72
+ }
73
+
74
+ $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode);
75
+
76
+ }//end process()
77
+
78
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedPHP4StyleConstructorsSniff.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedPHP4StyleConstructorsSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedPHP4StyleConstructorsSniff.
18
+ *
19
+ * PHP version 7.0
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Koen Eelen <koen.eelen@cu.be>
24
+ */
25
+ class DeprecatedPHP4StyleConstructorsSniff extends Sniff
26
+ {
27
+
28
+ /**
29
+ * Returns an array of tokens this test wants to listen for.
30
+ *
31
+ * @return array
32
+ */
33
+ public function register()
34
+ {
35
+ return array(T_CLASS);
36
+
37
+ }
38
+
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.
45
+ *
46
+ * @return void
47
+ */
48
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
49
+ {
50
+ if ($this->supportsAbove('7.0') === false) {
51
+ return;
52
+ }
53
+
54
+ if ($this->determineNamespace($phpcsFile, $stackPtr) !== '') {
55
+ /*
56
+ * Namespaced methods with the same name as the class are treated as
57
+ * regular methods, so we can bow out if we're in a namespace.
58
+ *
59
+ * Note: the exception to this is PHP 5.3.0-5.3.2. This is currently
60
+ * not dealt with.
61
+ */
62
+ return;
63
+ }
64
+
65
+ $tokens = $phpcsFile->getTokens();
66
+
67
+ $class = $tokens[$stackPtr];
68
+
69
+ if (isset($class['scope_closer']) === false) {
70
+ return;
71
+ }
72
+
73
+ $scopeCloser = $class['scope_closer'];
74
+ $className = $phpcsFile->getDeclarationName($stackPtr);
75
+
76
+ if (empty($className) || is_string($className) === false) {
77
+ return;
78
+ }
79
+
80
+ $nextFunc = $stackPtr;
81
+ $classNameLc = strtolower($className);
82
+ $newConstructorFound = false;
83
+ $oldConstructorFound = false;
84
+ $oldConstructorPos = -1;
85
+ while (($nextFunc = $phpcsFile->findNext(T_FUNCTION, ($nextFunc + 1), $scopeCloser)) !== false) {
86
+ $funcName = $phpcsFile->getDeclarationName($nextFunc);
87
+ if (empty($funcName) || is_string($funcName) === false) {
88
+ continue;
89
+ }
90
+
91
+ $funcNameLc = strtolower($funcName);
92
+
93
+ if ($funcNameLc === '__construct') {
94
+ $newConstructorFound = true;
95
+ }
96
+
97
+ if ($funcNameLc === $classNameLc) {
98
+ $oldConstructorFound = true;
99
+ $oldConstructorPos = $nextFunc;
100
+ }
101
+
102
+ // If both have been found, no need to continue looping through the functions.
103
+ if ($newConstructorFound === true && $oldConstructorFound === true) {
104
+ break;
105
+ }
106
+ }
107
+
108
+ if ($newConstructorFound === false && $oldConstructorFound === true) {
109
+ $phpcsFile->addWarning(
110
+ 'Use of deprecated PHP4 style class constructor is not supported since PHP 7.',
111
+ $oldConstructorPos,
112
+ 'Found'
113
+ );
114
+ }
115
+ }
116
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DeprecatedTypeCastsSniff.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedTypeCastsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\DeprecatedTypeCastsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class DeprecatedTypeCastsSniff extends AbstractRemovedFeatureSniff
22
+ {
23
+ /**
24
+ * A list of deprecated and removed type casts with their alternatives.
25
+ *
26
+ * The array lists : version number with false (deprecated) or true (removed) and an alternative function.
27
+ * If no alternative exists, it is NULL, i.e, the function should just not be used.
28
+ *
29
+ * @var array(string => array(string => bool|string|null))
30
+ */
31
+ protected $deprecatedTypeCasts = array(
32
+ 'T_UNSET_CAST' => array(
33
+ '7.2' => false,
34
+ 'alternative' => 'unset()',
35
+ 'description' => 'unset',
36
+ ),
37
+ );
38
+
39
+
40
+ /**
41
+ * Returns an array of tokens this test wants to listen for.
42
+ *
43
+ * @return array
44
+ */
45
+ public function register()
46
+ {
47
+ $tokens = array();
48
+ foreach ($this->deprecatedTypeCasts as $token => $versions) {
49
+ $tokens[] = constant($token);
50
+ }
51
+
52
+ return $tokens;
53
+
54
+ }//end register()
55
+
56
+
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.
63
+ *
64
+ * @return void
65
+ */
66
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
67
+ {
68
+ $tokens = $phpcsFile->getTokens();
69
+ $tokenType = $tokens[$stackPtr]['type'];
70
+
71
+ $itemInfo = array(
72
+ 'name' => $tokenType,
73
+ 'description' => $this->deprecatedTypeCasts[$tokenType]['description'],
74
+ );
75
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
76
+
77
+ }//end process()
78
+
79
+
80
+ /**
81
+ * Get an array of the non-PHP-version array keys used in a sub-array.
82
+ *
83
+ * @return array
84
+ */
85
+ protected function getNonVersionArrayKeys()
86
+ {
87
+ return array('description', 'alternative');
88
+ }
89
+
90
+ /**
91
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
92
+ *
93
+ * @param array $itemInfo Base information about the item.
94
+ *
95
+ * @return array Version and other information about the item.
96
+ */
97
+ public function getItemArray(array $itemInfo)
98
+ {
99
+ return $this->deprecatedTypeCasts[$itemInfo['name']];
100
+ }
101
+
102
+
103
+ /**
104
+ * Get the error message template for this sniff.
105
+ *
106
+ * @return string
107
+ */
108
+ protected function getErrorMsgTemplate()
109
+ {
110
+ return 'The %s cast is ';
111
+ }
112
+
113
+
114
+ /**
115
+ * Filter the error data before it's passed to PHPCS.
116
+ *
117
+ * @param array $data The error data array which was created.
118
+ * @param array $itemInfo Base information about the item this error message applies to.
119
+ * @param array $errorInfo Detail information about an item this error message applies to.
120
+ *
121
+ * @return array
122
+ */
123
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
124
+ {
125
+ $data[0] = $itemInfo['description'];
126
+ return $data;
127
+ }
128
+
129
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DiscouragedSwitchContinueSniff.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\DiscouragedSwitchContinue.
19
+ *
20
+ * PHP 7.3 will throw a warning when continue is used to target a switch control structure.
21
+ *
22
+ * PHP version 7.3
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
27
+ */
28
+ class DiscouragedSwitchContinueSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * Token codes of control structures which can be targeted using continue.
33
+ *
34
+ * @var array
35
+ */
36
+ protected $loopStructures = array(
37
+ \T_FOR => \T_FOR,
38
+ \T_FOREACH => \T_FOREACH,
39
+ \T_WHILE => \T_WHILE,
40
+ \T_DO => \T_DO,
41
+ \T_SWITCH => \T_SWITCH,
42
+ );
43
+
44
+ /**
45
+ * Tokens which start a new case within a switch.
46
+ *
47
+ * @var array
48
+ */
49
+ protected $caseTokens = array(
50
+ \T_CASE => \T_CASE,
51
+ \T_DEFAULT => \T_DEFAULT,
52
+ );
53
+
54
+ /**
55
+ * Token codes which are accepted to determine the level for the continue.
56
+ *
57
+ * This array is enriched with the arithmetic operators in the register() method.
58
+ *
59
+ * @var array
60
+ */
61
+ protected $acceptedLevelTokens = array(
62
+ \T_LNUMBER => \T_LNUMBER,
63
+ \T_OPEN_PARENTHESIS => \T_OPEN_PARENTHESIS,
64
+ \T_CLOSE_PARENTHESIS => \T_CLOSE_PARENTHESIS,
65
+ );
66
+
67
+ /**
68
+ * PHPCS cross-version compatible version of the Tokens::$emptyTokens array.
69
+ *
70
+ * @var array
71
+ */
72
+ private $emptyTokens = array();
73
+
74
+ /**
75
+ * Returns an array of tokens this test wants to listen for.
76
+ *
77
+ * @return array
78
+ */
79
+ public function register()
80
+ {
81
+ $arithmeticTokens = \PHP_CodeSniffer_Tokens::$arithmeticTokens;
82
+ $this->emptyTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
83
+ if (version_compare(PHPCSHelper::getVersion(), '2.0', '<')) {
84
+ $arithmeticTokens = array_combine($arithmeticTokens, $arithmeticTokens);
85
+ $this->emptyTokens = array_combine($this->emptyTokens, $this->emptyTokens);
86
+ }
87
+
88
+ $this->acceptedLevelTokens = $this->acceptedLevelTokens + $arithmeticTokens + $this->emptyTokens;
89
+
90
+ return array(\T_SWITCH);
91
+ }
92
+
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.
99
+ *
100
+ * @return void
101
+ */
102
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
103
+ {
104
+ if ($this->supportsAbove('7.3') === false) {
105
+ return;
106
+ }
107
+
108
+ $tokens = $phpcsFile->getTokens();
109
+
110
+ if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
111
+ return;
112
+ }
113
+
114
+ $switchOpener = $tokens[$stackPtr]['scope_opener'];
115
+ $switchCloser = $tokens[$stackPtr]['scope_closer'];
116
+
117
+ // Quick check whether we need to bother with the more complex logic.
118
+ $hasContinue = $phpcsFile->findNext(\T_CONTINUE, ($switchOpener + 1), $switchCloser);
119
+ if ($hasContinue === false) {
120
+ return;
121
+ }
122
+
123
+ $caseDefault = $switchOpener;
124
+
125
+ do {
126
+ $caseDefault = $phpcsFile->findNext($this->caseTokens, ($caseDefault + 1), $switchCloser);
127
+ if ($caseDefault === false) {
128
+ break;
129
+ }
130
+
131
+ if (isset($tokens[$caseDefault]['scope_opener']) === false) {
132
+ // Unknown start of the case, skip.
133
+ continue;
134
+ }
135
+
136
+ $caseOpener = $tokens[$caseDefault]['scope_opener'];
137
+ $nextCaseDefault = $phpcsFile->findNext($this->caseTokens, ($caseDefault + 1), $switchCloser);
138
+ if ($nextCaseDefault === false) {
139
+ $caseCloser = $switchCloser;
140
+ } else {
141
+ $caseCloser = $nextCaseDefault;
142
+ }
143
+
144
+ // Check for unscoped control structures within the case.
145
+ $controlStructure = $caseOpener;
146
+ $doCount = 0;
147
+ while (($controlStructure = $phpcsFile->findNext($this->loopStructures, ($controlStructure + 1), $caseCloser)) !== false) {
148
+ if ($tokens[$controlStructure]['code'] === \T_DO) {
149
+ $doCount++;
150
+ }
151
+
152
+ if (isset($tokens[$controlStructure]['scope_opener'], $tokens[$controlStructure]['scope_closer']) === false) {
153
+ if ($tokens[$controlStructure]['code'] === \T_WHILE && $doCount > 0) {
154
+ // While in a do-while construct.
155
+ $doCount--;
156
+ continue;
157
+ }
158
+
159
+ // Control structure without braces found within the case, ignore this case.
160
+ continue 2;
161
+ }
162
+ }
163
+
164
+ // Examine the contents of the case.
165
+ $continue = $caseOpener;
166
+
167
+ do {
168
+ $continue = $phpcsFile->findNext(\T_CONTINUE, ($continue + 1), $caseCloser);
169
+ if ($continue === false) {
170
+ break;
171
+ }
172
+
173
+ $nextSemicolon = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($continue + 1), $caseCloser);
174
+ $codeString = '';
175
+ for ($i = ($continue + 1); $i < $nextSemicolon; $i++) {
176
+ if (isset($this->acceptedLevelTokens[$tokens[$i]['code']]) === false) {
177
+ // Function call/variable or other token which make numeric level impossible to determine.
178
+ continue 2;
179
+ }
180
+
181
+ if (isset($this->emptyTokens[$tokens[$i]['code']]) === true) {
182
+ continue;
183
+ }
184
+
185
+ $codeString .= $tokens[$i]['content'];
186
+ }
187
+
188
+ $level = null;
189
+ if ($codeString !== '') {
190
+ if (is_numeric($codeString)) {
191
+ $level = (int) $codeString;
192
+ } else {
193
+ // With the above logic, the string can only contain digits and operators, eval!
194
+ $level = eval("return ( $codeString );");
195
+ }
196
+ }
197
+
198
+ if (isset($level) === false || $level === 0) {
199
+ $level = 1;
200
+ }
201
+
202
+ // Examine which control structure is being targeted by the continue statement.
203
+ if (isset($tokens[$continue]['conditions']) === false) {
204
+ continue;
205
+ }
206
+
207
+ $conditions = array_reverse($tokens[$continue]['conditions'], true);
208
+ // PHPCS adds more structures to the conditions array than we want to take into
209
+ // consideration, so clean up the array.
210
+ foreach ($conditions as $tokenPtr => $tokenCode) {
211
+ if (isset($this->loopStructures[$tokenCode]) === false) {
212
+ unset($conditions[$tokenPtr]);
213
+ }
214
+ }
215
+
216
+ $targetCondition = \array_slice($conditions, ($level - 1), 1, true);
217
+ if (empty($targetCondition)) {
218
+ continue;
219
+ }
220
+
221
+ $conditionToken = key($targetCondition);
222
+ if ($conditionToken === $stackPtr) {
223
+ $phpcsFile->addWarning(
224
+ "Targeting a 'switch' control structure with a 'continue' statement is strongly discouraged and will throw a warning as of PHP 7.3.",
225
+ $continue,
226
+ 'Found'
227
+ );
228
+ }
229
+
230
+ } while ($continue < $caseCloser);
231
+
232
+ } while ($caseDefault < $switchCloser);
233
+ }
234
+
235
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/DynamicAccessToStaticSniff.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\DynamicAccessToStaticSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHP_CodeSniffer_Tokens as Tokens;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\DynamicAccessToStaticSniff.
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
+ * @category PHP
26
+ * @package PHPCompatibility
27
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
+ */
29
+ class DynamicAccessToStaticSniff extends Sniff
30
+ {
31
+
32
+ /**
33
+ * Returns an array of tokens this test wants to listen for.
34
+ *
35
+ * @return array
36
+ */
37
+ public function register()
38
+ {
39
+ return array(
40
+ T_DOUBLE_COLON,
41
+ );
42
+ }
43
+
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.
50
+ *
51
+ * @return void
52
+ */
53
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
54
+ {
55
+ if ($this->supportsBelow('5.2') === false) {
56
+ return;
57
+ }
58
+
59
+ $tokens = $phpcsFile->getTokens();
60
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
61
+
62
+ // Disregard `static::` as well. Late static binding is reported by another sniff.
63
+ if ($tokens[$prevNonEmpty]['code'] === T_SELF
64
+ || $tokens[$prevNonEmpty]['code'] === T_PARENT
65
+ || $tokens[$prevNonEmpty]['code'] === T_STATIC
66
+ ) {
67
+ return;
68
+ }
69
+
70
+ if ($tokens[$prevNonEmpty]['code'] === T_STRING) {
71
+ $prevPrevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prevNonEmpty - 1), null, true);
72
+
73
+ if ($tokens[$prevPrevNonEmpty]['code'] !== T_OBJECT_OPERATOR) {
74
+ return;
75
+ }
76
+ }
77
+
78
+ $phpcsFile->addError(
79
+ 'Static class properties and methods, as well as class constants, could not be accessed using a dynamic (variable) classname in PHP 5.2 or earlier.',
80
+ $stackPtr,
81
+ 'Found'
82
+ );
83
+ }
84
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/EmptyNonVariableSniff.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\EmptyNonVariableSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\EmptyNonVariableSniff.
18
+ *
19
+ * Verify that nothing but variables are passed to empty().
20
+ *
21
+ * PHP version 5.5
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ */
27
+ class EmptyNonVariableSniff extends Sniff
28
+ {
29
+ /**
30
+ * List of tokens to check against.
31
+ *
32
+ * @var array
33
+ */
34
+ protected $tokenBlackList = array();
35
+
36
+ /**
37
+ * List of brackets which can be part of a variable variable.
38
+ *
39
+ * Key is the open bracket token, value the close bracket token.
40
+ *
41
+ * @var array
42
+ */
43
+ protected $bracketTokens = array(
44
+ T_OPEN_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET,
45
+ T_OPEN_SQUARE_BRACKET => T_CLOSE_SQUARE_BRACKET,
46
+ );
47
+
48
+
49
+ /**
50
+ * Returns an array of tokens this test wants to listen for.
51
+ *
52
+ * @return array
53
+ */
54
+ public function register()
55
+ {
56
+ // Set the token blacklist only once.
57
+ $tokenBlackList = array_unique(
58
+ array_merge(
59
+ \PHP_CodeSniffer_Tokens::$assignmentTokens,
60
+ \PHP_CodeSniffer_Tokens::$equalityTokens,
61
+ \PHP_CodeSniffer_Tokens::$comparisonTokens,
62
+ \PHP_CodeSniffer_Tokens::$operators,
63
+ \PHP_CodeSniffer_Tokens::$booleanOperators,
64
+ \PHP_CodeSniffer_Tokens::$castTokens,
65
+ array(T_OPEN_PARENTHESIS, T_STRING_CONCAT)
66
+ )
67
+ );
68
+
69
+ $this->tokenBlackList = array_combine($tokenBlackList, $tokenBlackList);
70
+
71
+ return array(T_EMPTY);
72
+ }
73
+
74
+ /**
75
+ * Processes this test, when one of its tokens is encountered.
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.
80
+ *
81
+ * @return void
82
+ */
83
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
84
+ {
85
+ if ($this->supportsBelow('5.4') === false) {
86
+ return;
87
+ }
88
+
89
+ $tokens = $phpcsFile->getTokens();
90
+
91
+ $open = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr, null, false, null, true);
92
+ if ($open === false || isset($tokens[$open]['parenthesis_closer']) === false) {
93
+ return;
94
+ }
95
+
96
+ $close = $tokens[$open]['parenthesis_closer'];
97
+
98
+ // If no variable at all was found, then it's definitely a no-no.
99
+ $hasVariable = $phpcsFile->findNext(T_VARIABLE, $open + 1, $close);
100
+ if ($hasVariable === false) {
101
+ $this->addError($phpcsFile, $stackPtr);
102
+ return;
103
+ }
104
+
105
+ // Check if the variable found is at the right level. Deeper levels are always an error.
106
+ if (isset($tokens[$open + 1]['nested_parenthesis'], $tokens[$hasVariable]['nested_parenthesis'])) {
107
+ $nestingLevel = count($tokens[$open + 1]['nested_parenthesis']);
108
+ if (count($tokens[$hasVariable]['nested_parenthesis']) !== $nestingLevel) {
109
+ $this->addError($phpcsFile, $stackPtr);
110
+ return;
111
+ }
112
+ }
113
+
114
+ // Ok, so the first variable is at the right level, now are there any
115
+ // blacklisted tokens within the empty() ?
116
+ $hasBadToken = $phpcsFile->findNext($this->tokenBlackList, $open + 1, $close);
117
+ if ($hasBadToken === false) {
118
+ return;
119
+ }
120
+
121
+ // If there are also bracket tokens, the blacklisted token might be part of a variable
122
+ // variable, but if there are no bracket tokens, we know we have an error.
123
+ $hasBrackets = $phpcsFile->findNext($this->bracketTokens, $open + 1, $close);
124
+ if ($hasBrackets === false) {
125
+ $this->addError($phpcsFile, $stackPtr);
126
+ return;
127
+ }
128
+
129
+ // Ok, we have both a blacklisted token as well as brackets, so we need to walk
130
+ // the tokens of the variable variable.
131
+ for ($i = ($open + 1); $i < $close; $i++) {
132
+ // If this is a bracket token, skip to the end of the bracketed expression.
133
+ if (isset($this->bracketTokens[$tokens[$i]['code']], $tokens[$i]['bracket_closer'])) {
134
+ $i = $tokens[$i]['bracket_closer'];
135
+ continue;
136
+ }
137
+
138
+ // If it's a blacklisted token, not within brackets, we have an error.
139
+ if (isset($this->tokenBlackList[$tokens[$i]['code']])) {
140
+ $this->addError($phpcsFile, $stackPtr);
141
+ return;
142
+ }
143
+ }
144
+ }
145
+
146
+
147
+ /**
148
+ * Add the error message.
149
+ *
150
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
151
+ * @param int $stackPtr The position of the current token in the
152
+ * stack passed in $tokens.
153
+ *
154
+ * @return void
155
+ */
156
+ protected function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
157
+ {
158
+ $phpcsFile->addError(
159
+ 'Only variables can be passed to empty() prior to PHP 5.5.',
160
+ $stackPtr,
161
+ 'Found'
162
+ );
163
+ }
164
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueOutsideLoopSniff.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenBreakContinueOutsideLoop.
18
+ *
19
+ * Forbids use of break or continue statements outside of looping structures.
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ */
27
+ class ForbiddenBreakContinueOutsideLoopSniff extends Sniff
28
+ {
29
+
30
+ /**
31
+ * Token codes of control structure in which usage of break/continue is valid.
32
+ *
33
+ * @var array
34
+ */
35
+ protected $validLoopStructures = array(
36
+ T_FOR => true,
37
+ T_FOREACH => true,
38
+ T_WHILE => true,
39
+ T_DO => true,
40
+ T_SWITCH => true,
41
+ );
42
+
43
+ /**
44
+ * Token codes which did not correctly get a condition assigned in older PHPCS versions.
45
+ *
46
+ * @var array
47
+ */
48
+ protected $backCompat = array(
49
+ T_CASE => true,
50
+ T_DEFAULT => true,
51
+ );
52
+
53
+ /**
54
+ * Returns an array of tokens this test wants to listen for.
55
+ *
56
+ * @return array
57
+ */
58
+ public function register()
59
+ {
60
+ return array(
61
+ T_BREAK,
62
+ T_CONTINUE,
63
+ );
64
+
65
+ }//end register()
66
+
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.
73
+ *
74
+ * @return void
75
+ */
76
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
77
+ {
78
+ $tokens = $phpcsFile->getTokens();
79
+ $token = $tokens[$stackPtr];
80
+
81
+ // Check if the break/continue is within a valid loop structure.
82
+ if (empty($token['conditions']) === false) {
83
+ foreach ($token['conditions'] as $tokenCode) {
84
+ if (isset($this->validLoopStructures[$tokenCode]) === true) {
85
+ return;
86
+ }
87
+ }
88
+ } else {
89
+ // Deal with older PHPCS versions.
90
+ if (isset($token['scope_condition']) === true && isset($this->backCompat[$tokens[$token['scope_condition']]['code']]) === true) {
91
+ return;
92
+ }
93
+ }
94
+
95
+ // If we're still here, no valid loop structure container has been found, so throw an error.
96
+ $error = "Using '%s' outside of a loop or switch structure is invalid";
97
+ $isError = false;
98
+ $errorCode = 'Found';
99
+ $data = array($token['content']);
100
+
101
+ if ($this->supportsAbove('7.0')) {
102
+ $error .= ' and will throw a fatal error since PHP 7.0';
103
+ $isError = true;
104
+ $errorCode = 'FatalError';
105
+ }
106
+
107
+ $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
108
+
109
+ }//end process()
110
+
111
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenBreakContinueVariableArgumentsSniff.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenBreakContinueVariableArguments.
19
+ *
20
+ * Forbids variable arguments on break or continue statements.
21
+ *
22
+ * PHP version 5.4
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Wim Godden <wim.godden@cu.be>
27
+ * @copyright 2012 Cu.be Solutions bvba
28
+ */
29
+ class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff
30
+ {
31
+ /**
32
+ * Error types this sniff handles for forbidden break/continue arguments.
33
+ *
34
+ * Array key is the error code. Array value will be used as part of the error message.
35
+ *
36
+ * @var array
37
+ */
38
+ private $errorTypes = array(
39
+ 'variableArgument' => 'a variable argument',
40
+ 'zeroArgument' => '0 as an argument',
41
+ );
42
+
43
+ /**
44
+ * Returns an array of tokens this test wants to listen for.
45
+ *
46
+ * @return array
47
+ */
48
+ public function register()
49
+ {
50
+ return array(T_BREAK, T_CONTINUE);
51
+
52
+ }//end register()
53
+
54
+ /**
55
+ * Processes this test, when one of its tokens is encountered.
56
+ *
57
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
58
+ * @param int $stackPtr The position of the current token in the
59
+ * stack passed in $tokens.
60
+ *
61
+ * @return void
62
+ */
63
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
64
+ {
65
+ if ($this->supportsAbove('5.4') === false) {
66
+ return;
67
+ }
68
+
69
+ $tokens = $phpcsFile->getTokens();
70
+ $nextSemicolonToken = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr), null, false);
71
+ $errorType = '';
72
+ for ($curToken = $stackPtr + 1; $curToken < $nextSemicolonToken; $curToken++) {
73
+ if ($tokens[$curToken]['type'] === 'T_STRING') {
74
+ // If the next non-whitespace token after the string
75
+ // is an opening parenthesis then it's a function call.
76
+ $openBracket = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $curToken + 1, null, true);
77
+ if ($tokens[$openBracket]['code'] === T_OPEN_PARENTHESIS) {
78
+ $errorType = 'variableArgument';
79
+ break;
80
+ }
81
+
82
+ } elseif (in_array($tokens[$curToken]['type'], array('T_VARIABLE', 'T_FUNCTION', 'T_CLOSURE'), true)) {
83
+ $errorType = 'variableArgument';
84
+ break;
85
+
86
+ } elseif ($tokens[$curToken]['type'] === 'T_LNUMBER' && $tokens[$curToken]['content'] === '0') {
87
+ $errorType = 'zeroArgument';
88
+ break;
89
+ }
90
+ }
91
+
92
+ if ($errorType !== '') {
93
+ $error = 'Using %s on break or continue is forbidden since PHP 5.4';
94
+ $errorCode = $errorType . 'Found';
95
+ $data = array($this->errorTypes[$errorType]);
96
+
97
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
98
+ }
99
+
100
+ }//end process()
101
+
102
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenCallTimePassByReferenceSniff.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
15
+
16
+ use PHPCompatibility\Sniff;
17
+
18
+ /**
19
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenCallTimePassByReference.
20
+ *
21
+ * Discourages the use of call time pass by references
22
+ *
23
+ * PHP version 5.4
24
+ *
25
+ * @category PHP
26
+ * @package PHPCompatibility
27
+ * @author Gary Rogers <gmrwebde@gmail.com>
28
+ * @author Florian Grandel <jerico.dev@gmail.com>
29
+ * @copyright 2009 Florian Grandel
30
+ */
31
+ class ForbiddenCallTimePassByReferenceSniff extends Sniff
32
+ {
33
+
34
+ /**
35
+ * Tokens that represent assignments or equality comparisons.
36
+ *
37
+ * Near duplicate of Tokens::$assignmentTokens + Tokens::$equalityTokens.
38
+ * Copied in for PHPCS cross-version compatibility.
39
+ *
40
+ * @var array
41
+ */
42
+ private $assignOrCompare = array(
43
+ // Equality tokens.
44
+ 'T_IS_EQUAL' => true,
45
+ 'T_IS_NOT_EQUAL' => true,
46
+ 'T_IS_IDENTICAL' => true,
47
+ 'T_IS_NOT_IDENTICAL' => true,
48
+ 'T_IS_SMALLER_OR_EQUAL' => true,
49
+ 'T_IS_GREATER_OR_EQUAL' => true,
50
+
51
+ // Assignment tokens.
52
+ 'T_EQUAL' => true,
53
+ 'T_AND_EQUAL' => true,
54
+ 'T_OR_EQUAL' => true,
55
+ 'T_CONCAT_EQUAL' => true,
56
+ 'T_DIV_EQUAL' => true,
57
+ 'T_MINUS_EQUAL' => true,
58
+ 'T_POW_EQUAL' => true,
59
+ 'T_MOD_EQUAL' => true,
60
+ 'T_MUL_EQUAL' => true,
61
+ 'T_PLUS_EQUAL' => true,
62
+ 'T_XOR_EQUAL' => true,
63
+ 'T_DOUBLE_ARROW' => true,
64
+ 'T_SL_EQUAL' => true,
65
+ 'T_SR_EQUAL' => true,
66
+ 'T_COALESCE_EQUAL' => true,
67
+ 'T_ZSR_EQUAL' => true,
68
+ );
69
+
70
+ /**
71
+ * Returns an array of tokens this test wants to listen for.
72
+ *
73
+ * @return array
74
+ */
75
+ public function register()
76
+ {
77
+ return array(T_STRING);
78
+
79
+ }//end register()
80
+
81
+ /**
82
+ * Processes this test, when one of its tokens is encountered.
83
+ *
84
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
85
+ * @param int $stackPtr The position of the current token
86
+ * in the stack passed in $tokens.
87
+ *
88
+ * @return void
89
+ */
90
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
91
+ {
92
+ if ($this->supportsAbove('5.3') === false) {
93
+ return;
94
+ }
95
+
96
+ $tokens = $phpcsFile->getTokens();
97
+
98
+ // Skip tokens that are the names of functions or classes
99
+ // within their definitions. For example: function myFunction...
100
+ // "myFunction" is T_STRING but we should skip because it is not a
101
+ // function or method *call*.
102
+ $findTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
103
+ $findTokens[] = T_BITWISE_AND;
104
+
105
+ $prevNonEmpty = $phpcsFile->findPrevious(
106
+ $findTokens,
107
+ ($stackPtr - 1),
108
+ null,
109
+ true
110
+ );
111
+
112
+ if ($prevNonEmpty !== false && in_array($tokens[$prevNonEmpty]['type'], array('T_FUNCTION', 'T_CLASS', 'T_INTERFACE', 'T_TRAIT'), true)) {
113
+ return;
114
+ }
115
+
116
+ // If the next non-whitespace token after the function or method call
117
+ // is not an opening parenthesis then it can't really be a *call*.
118
+ $openBracket = $phpcsFile->findNext(
119
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
120
+ ($stackPtr + 1),
121
+ null,
122
+ true
123
+ );
124
+
125
+ if ($openBracket === false || $tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS
126
+ || isset($tokens[$openBracket]['parenthesis_closer']) === false
127
+ ) {
128
+ return;
129
+ }
130
+
131
+ // Get the function call parameters.
132
+ $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
133
+ if (count($parameters) === 0) {
134
+ return;
135
+ }
136
+
137
+ // Which nesting level is the one we are interested in ?
138
+ $nestedParenthesisCount = 1;
139
+ if (isset($tokens[$openBracket]['nested_parenthesis'])) {
140
+ $nestedParenthesisCount = count($tokens[$openBracket]['nested_parenthesis']) + 1;
141
+ }
142
+
143
+ foreach ($parameters as $parameter) {
144
+ if ($this->isCallTimePassByReferenceParam($phpcsFile, $parameter, $nestedParenthesisCount) === true) {
145
+ // T_BITWISE_AND represents a pass-by-reference.
146
+ $error = 'Using a call-time pass-by-reference is deprecated since PHP 5.3';
147
+ $isError = false;
148
+ $errorCode = 'Deprecated';
149
+
150
+ if ($this->supportsAbove('5.4')) {
151
+ $error .= ' and prohibited since PHP 5.4';
152
+ $isError = true;
153
+ $errorCode = 'NotAllowed';
154
+ }
155
+
156
+ $this->addMessage($phpcsFile, $error, $parameter['start'], $isError, $errorCode);
157
+ }
158
+ }
159
+ }//end process()
160
+
161
+
162
+ /**
163
+ * Determine whether a parameter is passed by reference.
164
+ *
165
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
166
+ * @param array $parameter Information on the current parameter
167
+ * to be examined.
168
+ * @param int $nestingLevel Target nesting level.
169
+ *
170
+ * @return bool
171
+ */
172
+ protected function isCallTimePassByReferenceParam(\PHP_CodeSniffer_File $phpcsFile, $parameter, $nestingLevel)
173
+ {
174
+ $tokens = $phpcsFile->getTokens();
175
+
176
+ $searchStartToken = $parameter['start'] - 1;
177
+ $searchEndToken = $parameter['end'] + 1;
178
+ $nextVariable = $searchStartToken;
179
+ do {
180
+ $nextVariable = $phpcsFile->findNext(T_VARIABLE, ($nextVariable + 1), $searchEndToken);
181
+ if ($nextVariable === false) {
182
+ return false;
183
+ }
184
+
185
+ // Make sure the variable belongs directly to this function call
186
+ // and is not inside a nested function call or array.
187
+ if (isset($tokens[$nextVariable]['nested_parenthesis']) === false
188
+ || (count($tokens[$nextVariable]['nested_parenthesis']) !== $nestingLevel)
189
+ ) {
190
+ continue;
191
+ }
192
+
193
+ // Checking this: $value = my_function(...[*]$arg...).
194
+ $tokenBefore = $phpcsFile->findPrevious(
195
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
196
+ ($nextVariable - 1),
197
+ $searchStartToken,
198
+ true
199
+ );
200
+
201
+ if ($tokenBefore === false || $tokens[$tokenBefore]['code'] !== T_BITWISE_AND) {
202
+ // Nothing before the token or no &.
203
+ continue;
204
+ }
205
+
206
+ if ($phpcsFile->isReference($tokenBefore) === false) {
207
+ continue;
208
+ }
209
+
210
+ // Checking this: $value = my_function(...[*]&$arg...).
211
+ $tokenBefore = $phpcsFile->findPrevious(
212
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
213
+ ($tokenBefore - 1),
214
+ $searchStartToken,
215
+ true
216
+ );
217
+
218
+ // Prevent false positive on assign by reference and compare with reference
219
+ // within function call parameters.
220
+ if (isset($this->assignOrCompare[$tokens[$tokenBefore]['type']])) {
221
+ continue;
222
+ }
223
+
224
+ // The found T_BITWISE_AND represents a pass-by-reference.
225
+ return true;
226
+
227
+ } while ($nextVariable < $searchEndToken);
228
+
229
+ // This code should never be reached, but here in case of weird bugs.
230
+ return false;
231
+ }
232
+
233
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenClosureUseVariableNamesSniff.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * PHP 7.1 Forbidden variable names in closure use statements.
19
+ *
20
+ * Variables bound to a closure via the use construct cannot use the same name
21
+ * as any superglobals, $this, or any parameter 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 ForbiddenClosureUseVariableNamesSniff extends Sniff
30
+ {
31
+
32
+ /**
33
+ * Returns an array of tokens this test wants to listen for.
34
+ *
35
+ * @return array
36
+ */
37
+ public function register()
38
+ {
39
+ return array(T_USE);
40
+
41
+ }//end register()
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
48
+ * in the stack passed in $tokens.
49
+ *
50
+ * @return void
51
+ */
52
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
+ {
54
+ if ($this->supportsAbove('7.1') === false) {
55
+ return;
56
+ }
57
+
58
+ $tokens = $phpcsFile->getTokens();
59
+
60
+ // Verify this use statement is used with a closure - if so, it has to have parenthesis before it.
61
+ $previousNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
62
+ if ($previousNonEmpty === false || $tokens[$previousNonEmpty]['code'] !== T_CLOSE_PARENTHESIS
63
+ || isset($tokens[$previousNonEmpty]['parenthesis_opener']) === false
64
+ ) {
65
+ return;
66
+ }
67
+
68
+ // ... and (a variable within) parenthesis after it.
69
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
70
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS) {
71
+ return;
72
+ }
73
+
74
+ if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) {
75
+ // Live coding.
76
+ return;
77
+ }
78
+
79
+ $closurePtr = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($tokens[$previousNonEmpty]['parenthesis_opener'] - 1), null, true);
80
+ if ($closurePtr === false || $tokens[$closurePtr]['code'] !== T_CLOSURE) {
81
+ return;
82
+ }
83
+
84
+ // Get the parameters declared by the closure.
85
+ $closureParams = PHPCSHelper::getMethodParameters($phpcsFile, $closurePtr);
86
+
87
+ $errorMsg = 'Variables bound to a closure via the use construct cannot use the same name as superglobals, $this, or a declared parameter since PHP 7.1. Found: %s';
88
+
89
+ for ($i = ($nextNonEmpty + 1); $i < $tokens[$nextNonEmpty]['parenthesis_closer']; $i++) {
90
+ if ($tokens[$i]['code'] !== T_VARIABLE) {
91
+ continue;
92
+ }
93
+
94
+ $variableName = $tokens[$i]['content'];
95
+
96
+ if ($variableName === '$this') {
97
+ $phpcsFile->addError($errorMsg, $i, 'FoundThis', array($variableName));
98
+ continue;
99
+ }
100
+
101
+ if (in_array($variableName, $this->superglobals, true) === true) {
102
+ $phpcsFile->addError($errorMsg, $i, 'FoundSuperglobal', array($variableName));
103
+ continue;
104
+ }
105
+
106
+ // Check whether it is one of the parameters declared by the closure.
107
+ if (empty($closureParams) === false) {
108
+ foreach ($closureParams as $param) {
109
+ if ($param['name'] === $variableName) {
110
+ $phpcsFile->addError($errorMsg, $i, 'FoundShadowParam', array($variableName));
111
+ continue 2;
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ }//end process()
118
+
119
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenEmptyListAssignmentSniff.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenEmptyListAssignmentSniff.
19
+ *
20
+ * Empty list() assignments have been removed 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 ForbiddenEmptyListAssignmentSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * List of tokens to disregard when determining whether the list() is empty.
33
+ *
34
+ * @var array
35
+ */
36
+ protected $ignoreTokens = array();
37
+
38
+ /**
39
+ * Returns an array of tokens this test wants to listen for.
40
+ *
41
+ * @return array
42
+ */
43
+ public function register()
44
+ {
45
+ // Set up a list of tokens to disregard when determining whether the list() is empty.
46
+ // Only needs to be set up once.
47
+ $this->ignoreTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
48
+ if (version_compare(PHPCSHelper::getVersion(), '2.0', '<')) {
49
+ $this->ignoreTokens = array_combine($this->ignoreTokens, $this->ignoreTokens);
50
+ }
51
+ $this->ignoreTokens[T_COMMA] = T_COMMA;
52
+ $this->ignoreTokens[T_OPEN_PARENTHESIS] = T_OPEN_PARENTHESIS;
53
+ $this->ignoreTokens[T_CLOSE_PARENTHESIS] = T_CLOSE_PARENTHESIS;
54
+
55
+ return array(
56
+ T_LIST,
57
+ T_OPEN_SHORT_ARRAY,
58
+ );
59
+ }
60
+
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.
67
+ *
68
+ * @return void
69
+ */
70
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
71
+ {
72
+ if ($this->supportsAbove('7.0') === false) {
73
+ return;
74
+ }
75
+
76
+ $tokens = $phpcsFile->getTokens();
77
+
78
+ if ($tokens[$stackPtr]['code'] === T_OPEN_SHORT_ARRAY) {
79
+ if ($this->isShortList($phpcsFile, $stackPtr) === false) {
80
+ return;
81
+ }
82
+
83
+ $open = $stackPtr;
84
+ $close = $tokens[$stackPtr]['bracket_closer'];
85
+ } else {
86
+ // T_LIST.
87
+ $open = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $stackPtr, null, false, null, true);
88
+ if ($open === false || isset($tokens[$open]['parenthesis_closer']) === false) {
89
+ return;
90
+ }
91
+
92
+ $close = $tokens[$open]['parenthesis_closer'];
93
+ }
94
+
95
+ $error = true;
96
+ if (($close - $open) > 1) {
97
+ for ($cnt = $open + 1; $cnt < $close; $cnt++) {
98
+ if (isset($this->ignoreTokens[$tokens[$cnt]['code']]) === false) {
99
+ $error = false;
100
+ break;
101
+ }
102
+ }
103
+ }
104
+
105
+ if ($error === true) {
106
+ $phpcsFile->addError(
107
+ 'Empty list() assignments are not allowed since PHP 7.0',
108
+ $stackPtr,
109
+ 'Found'
110
+ );
111
+ }
112
+ }
113
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenFunctionParametersWithSameNameSniff.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenFunctionParametersWithSameName.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenFunctionParametersWithSameName.
19
+ *
20
+ * Functions can not have multiple parameters with the same name 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 ForbiddenFunctionParametersWithSameNameSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * Returns an array of tokens this test wants to listen for.
33
+ *
34
+ * @return array
35
+ */
36
+ public function register()
37
+ {
38
+ return array(
39
+ T_FUNCTION,
40
+ T_CLOSURE,
41
+ );
42
+
43
+ }//end register()
44
+
45
+ /**
46
+ * Processes this test, when one of its tokens is encountered.
47
+ *
48
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
49
+ * @param int $stackPtr The position of the current token
50
+ * in the stack passed in $tokens.
51
+ *
52
+ * @return void
53
+ */
54
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
55
+ {
56
+ if ($this->supportsAbove('7.0') === false) {
57
+ return;
58
+ }
59
+
60
+ $tokens = $phpcsFile->getTokens();
61
+ $token = $tokens[$stackPtr];
62
+ // Skip function without body.
63
+ if (isset($token['scope_opener']) === false) {
64
+ return;
65
+ }
66
+
67
+ // Get all parameters from method signature.
68
+ $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
69
+ if (empty($parameters) || is_array($parameters) === false) {
70
+ return;
71
+ }
72
+
73
+ $paramNames = array();
74
+ foreach ($parameters as $param) {
75
+ $paramNames[] = strtolower($param['name']);
76
+ }
77
+
78
+ if (count($paramNames) !== count(array_unique($paramNames))) {
79
+ $phpcsFile->addError(
80
+ 'Functions can not have multiple parameters with the same name since PHP 7.0',
81
+ $stackPtr,
82
+ 'Found'
83
+ );
84
+ }
85
+
86
+ }//end process()
87
+
88
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenGlobalVariableVariableSniff.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenGlobalVariableVariableSniff.
18
+ *
19
+ * Variable variables are forbidden with global
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Wim Godden <wim@cu.be>
26
+ */
27
+ class ForbiddenGlobalVariableVariableSniff extends Sniff
28
+ {
29
+
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(T_GLOBAL);
38
+ }
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsAbove('7.0') === false) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+ $endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr + 1));
57
+ if ($endOfStatement === false) {
58
+ // No semi-colon - live coding.
59
+ return;
60
+ }
61
+
62
+ for ($ptr = ($stackPtr + 1); $ptr <= $endOfStatement; $ptr++) {
63
+ $errorThrown = false;
64
+ $nextComma = $phpcsFile->findNext(T_COMMA, $ptr, $endOfStatement, false, null, true);
65
+ $varEnd = ($nextComma === false) ? $endOfStatement : $nextComma;
66
+ $variable = $phpcsFile->findNext(T_VARIABLE, $ptr, $varEnd);
67
+ $varString = trim($phpcsFile->getTokensAsString($ptr, ($varEnd - $ptr)));
68
+ $data = array($varString);
69
+
70
+ if ($variable !== false) {
71
+
72
+ $prev = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($variable - 1), $ptr, true);
73
+
74
+ if ($prev !== false && $tokens[$prev]['type'] === 'T_DOLLAR') {
75
+
76
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($variable + 1), $varEnd, true);
77
+
78
+ if ($next !== false
79
+ && in_array($tokens[$next]['code'], array(T_OPEN_SQUARE_BRACKET, T_OBJECT_OPERATOR, T_DOUBLE_COLON), true) === true
80
+ ) {
81
+ $phpcsFile->addError(
82
+ 'Global with variable variables is not allowed since PHP 7.0. Found %s',
83
+ $variable,
84
+ 'Found',
85
+ $data
86
+ );
87
+ $errorThrown = true;
88
+ } else {
89
+ $phpcsFile->addWarning(
90
+ 'Global with anything other than bare variables is discouraged since PHP 7.0. Found %s',
91
+ $variable,
92
+ 'NonBareVariableFound',
93
+ $data
94
+ );
95
+ $errorThrown = true;
96
+ }
97
+ }
98
+ }
99
+
100
+ if ($errorThrown === false) {
101
+ $dollar = $phpcsFile->findNext(T_DOLLAR, $ptr, $varEnd);
102
+ if ($dollar !== false) {
103
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($dollar + 1), $varEnd, true);
104
+ if ($tokens[$next]['code'] === T_OPEN_CURLY_BRACKET) {
105
+ $phpcsFile->addWarning(
106
+ 'Global with anything other than bare variables is discouraged since PHP 7.0. Found %s',
107
+ $dollar,
108
+ 'NonBareVariableFound',
109
+ $data
110
+ );
111
+ }
112
+ }
113
+ }
114
+
115
+ // Move the stack pointer forward to the next variable for multi-variable statements.
116
+ if ($nextComma === false) {
117
+ break;
118
+ }
119
+ $ptr = $nextComma;
120
+ }
121
+ }
122
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsDeclaredSniff.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenNamesAsDeclaredClassSniff.
18
+ *
19
+ * Prohibits the use of some reserved keywords to name a class, interface, trait or namespace.
20
+ * Emits errors for reserved words and warnings for soft-reserved words.
21
+ *
22
+ * @see http://php.net/manual/en/reserved.other-reserved-words.php
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 ForbiddenNamesAsDeclaredSniff extends Sniff
31
+ {
32
+
33
+ /**
34
+ * List of tokens which can not be used as class, interface, trait names or as part of a namespace.
35
+ *
36
+ * @var array
37
+ */
38
+ protected $forbiddenTokens = array(
39
+ T_NULL => '7.0',
40
+ T_TRUE => '7.0',
41
+ T_FALSE => '7.0',
42
+ );
43
+
44
+ /**
45
+ * T_STRING keywords to recognize as forbidden names.
46
+ *
47
+ * @var array
48
+ */
49
+ protected $forbiddenNames = array(
50
+ 'null' => '7.0',
51
+ 'true' => '7.0',
52
+ 'false' => '7.0',
53
+ 'bool' => '7.0',
54
+ 'int' => '7.0',
55
+ 'float' => '7.0',
56
+ 'string' => '7.0',
57
+ 'iterable' => '7.1',
58
+ 'void' => '7.1',
59
+ 'object' => '7.2',
60
+ );
61
+
62
+ /**
63
+ * T_STRING keywords to recognize as soft reserved names.
64
+ *
65
+ * Using any of these keywords to name a class, interface, trait or namespace
66
+ * is highly discouraged since they may be used in future versions of PHP.
67
+ *
68
+ * @var array
69
+ */
70
+ protected $softReservedNames = array(
71
+ 'resource' => '7.0',
72
+ 'object' => '7.0',
73
+ 'mixed' => '7.0',
74
+ 'numeric' => '7.0',
75
+ );
76
+
77
+ /**
78
+ * Combined list of the two lists above.
79
+ *
80
+ * Used for quick check whether or not something is a reserved
81
+ * word.
82
+ * Set from the `register()` method.
83
+ *
84
+ * @var array
85
+ */
86
+ private $allForbiddenNames = array();
87
+
88
+
89
+ /**
90
+ * Returns an array of tokens this test wants to listen for.
91
+ *
92
+ * @return array
93
+ */
94
+ public function register()
95
+ {
96
+ // Do the list merge only once.
97
+ $this->allForbiddenNames = array_merge($this->forbiddenNames, $this->softReservedNames);
98
+
99
+ $targets = array(
100
+ T_CLASS,
101
+ T_INTERFACE,
102
+ T_NAMESPACE,
103
+ T_STRING, // Compat for PHPCS 1.x and PHP < 5.3.
104
+ );
105
+
106
+ if (defined('T_TRAIT')) {
107
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
108
+ $targets[] = T_TRAIT;
109
+ }
110
+
111
+ return $targets;
112
+
113
+ }//end register()
114
+
115
+
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.
122
+ *
123
+ * @return void
124
+ */
125
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
126
+ {
127
+ if ($this->supportsAbove('7.0') === false) {
128
+ return;
129
+ }
130
+
131
+ $tokens = $phpcsFile->getTokens();
132
+ $tokenCode = $tokens[$stackPtr]['code'];
133
+ $tokenType = $tokens[$stackPtr]['type'];
134
+ $tokenContentLc = strtolower($tokens[$stackPtr]['content']);
135
+
136
+ // For string tokens we only care about 'trait' as that is the only one
137
+ // which may not be correctly recognized as it's own token.
138
+ // This only happens in older versions of PHP where the token doesn't exist yet as a keyword.
139
+ if ($tokenCode === T_STRING && $tokenContentLc !== 'trait') {
140
+ return;
141
+ }
142
+
143
+ if (in_array($tokenType, array('T_CLASS', 'T_INTERFACE', 'T_TRAIT'), true)) {
144
+ // Check for the declared name being a name which is not tokenized as T_STRING.
145
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
146
+ if ($nextNonEmpty !== false && isset($this->forbiddenTokens[$tokens[$nextNonEmpty]['code']]) === true) {
147
+ $name = $tokens[$nextNonEmpty]['content'];
148
+ } else {
149
+ // Get the declared name if it's a T_STRING.
150
+ $name = $phpcsFile->getDeclarationName($stackPtr);
151
+ }
152
+ unset($nextNonEmpty);
153
+
154
+ if (isset($name) === false || is_string($name) === false || $name === '') {
155
+ return;
156
+ }
157
+
158
+ $nameLc = strtolower($name);
159
+ if (isset($this->allForbiddenNames[$nameLc]) === false) {
160
+ return;
161
+ }
162
+
163
+ } elseif ($tokenCode === T_NAMESPACE) {
164
+ $namespaceName = $this->getDeclaredNamespaceName($phpcsFile, $stackPtr);
165
+
166
+ if ($namespaceName === false || $namespaceName === '') {
167
+ return;
168
+ }
169
+
170
+ $namespaceParts = explode('\\', $namespaceName);
171
+ foreach ($namespaceParts as $namespacePart) {
172
+ $partLc = strtolower($namespacePart);
173
+ if (isset($this->allForbiddenNames[$partLc]) === true) {
174
+ $name = $namespacePart;
175
+ $nameLc = $partLc;
176
+ break;
177
+ }
178
+ }
179
+ } elseif ($tokenCode === T_STRING) {
180
+ // Traits which are not yet tokenized as T_TRAIT.
181
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
182
+ if ($nextNonEmpty === false) {
183
+ return;
184
+ }
185
+
186
+ $nextNonEmptyCode = $tokens[$nextNonEmpty]['code'];
187
+
188
+ if ($nextNonEmptyCode !== T_STRING && isset($this->forbiddenTokens[$nextNonEmptyCode]) === true) {
189
+ $name = $tokens[$nextNonEmpty]['content'];
190
+ $nameLc = strtolower($tokens[$nextNonEmpty]['content']);
191
+ } elseif ($nextNonEmptyCode === T_STRING) {
192
+ $endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_OPEN_CURLY_BRACKET), ($stackPtr + 1));
193
+ if ($endOfStatement === false) {
194
+ return;
195
+ }
196
+
197
+ do {
198
+ $nextNonEmptyLc = strtolower($tokens[$nextNonEmpty]['content']);
199
+
200
+ if (isset($this->allForbiddenNames[$nextNonEmptyLc]) === true) {
201
+ $name = $tokens[$nextNonEmpty]['content'];
202
+ $nameLc = $nextNonEmptyLc;
203
+ break;
204
+ }
205
+
206
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), $endOfStatement, true);
207
+ } while ($nextNonEmpty !== false);
208
+ }
209
+ unset($nextNonEmptyCode, $nextNonEmptyLc, $endOfStatement);
210
+ }
211
+
212
+ if (isset($name, $nameLc) === false) {
213
+ return;
214
+ }
215
+
216
+ // Still here, so this is one of the reserved words.
217
+ // Build up the error message.
218
+ $error = "'%s' is a";
219
+ $isError = null;
220
+ $errorCode = $this->stringToErrorCode($nameLc) . 'Found';
221
+ $data = array(
222
+ $nameLc,
223
+ );
224
+
225
+ if (isset($this->softReservedNames[$nameLc]) === true
226
+ && $this->supportsAbove($this->softReservedNames[$nameLc]) === true
227
+ ) {
228
+ $error .= ' soft reserved keyword as of PHP version %s';
229
+ $isError = false;
230
+ $data[] = $this->softReservedNames[$nameLc];
231
+ }
232
+
233
+ if (isset($this->forbiddenNames[$nameLc]) === true
234
+ && $this->supportsAbove($this->forbiddenNames[$nameLc]) === true
235
+ ) {
236
+ if (isset($isError) === true) {
237
+ $error .= ' and a';
238
+ }
239
+ $error .= ' reserved keyword as of PHP version %s';
240
+ $isError = true;
241
+ $data[] = $this->forbiddenNames[$nameLc];
242
+ }
243
+
244
+ if (isset($isError) === true) {
245
+ $error .= ' and should not be used to name a class, interface or trait or as part of a namespace (%s)';
246
+ $data[] = $tokens[$stackPtr]['type'];
247
+
248
+ $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
249
+ }
250
+
251
+ }//end process()
252
+
253
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesAsInvokedFunctionsSniff.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\Sniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenNamesAsInvokedFunctionsSniff.
17
+ *
18
+ * Prohibits the use of reserved keywords invoked as functions.
19
+ *
20
+ * @category PHP
21
+ * @package PHPCompatibility
22
+ * @author Jansen Price <jansen.price@gmail.com>
23
+ * @copyright 2012 Cu.be Solutions bvba
24
+ */
25
+ class ForbiddenNamesAsInvokedFunctionsSniff extends Sniff
26
+ {
27
+
28
+ /**
29
+ * List of tokens to register.
30
+ *
31
+ * @var array
32
+ */
33
+ protected $targetedTokens = array(
34
+ T_ABSTRACT => '5.0',
35
+ T_CALLABLE => '5.4',
36
+ T_CATCH => '5.0',
37
+ T_FINAL => '5.0',
38
+ T_GOTO => '5.3',
39
+ T_IMPLEMENTS => '5.0',
40
+ T_INTERFACE => '5.0',
41
+ T_INSTANCEOF => '5.0',
42
+ T_NAMESPACE => '5.3',
43
+ T_PRIVATE => '5.0',
44
+ T_PROTECTED => '5.0',
45
+ T_PUBLIC => '5.0',
46
+ T_TRY => '5.0',
47
+ );
48
+
49
+ /**
50
+ * T_STRING keywords to recognize as targetted tokens.
51
+ *
52
+ * Compatibility for PHP versions where the keyword is not yet recognized
53
+ * as its own token and for PHPCS versions which change the token to
54
+ * T_STRING when used in a method call.
55
+ *
56
+ * @var array
57
+ */
58
+ protected $targetedStringTokens = array(
59
+ 'abstract' => '5.0',
60
+ 'callable' => '5.4',
61
+ 'catch' => '5.0',
62
+ 'final' => '5.0',
63
+ 'finally' => '5.5',
64
+ 'goto' => '5.3',
65
+ 'implements' => '5.0',
66
+ 'interface' => '5.0',
67
+ 'instanceof' => '5.0',
68
+ 'insteadof' => '5.4',
69
+ 'namespace' => '5.3',
70
+ 'private' => '5.0',
71
+ 'protected' => '5.0',
72
+ 'public' => '5.0',
73
+ 'trait' => '5.4',
74
+ 'try' => '5.0',
75
+ );
76
+
77
+ /**
78
+ * Returns an array of tokens this test wants to listen for.
79
+ *
80
+ * @return array
81
+ */
82
+ public function register()
83
+ {
84
+ if (defined('T_FINALLY')) {
85
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_finallyFound
86
+ $this->targetedTokens[T_FINALLY] = '5.5';
87
+ }
88
+ if (defined('T_INSTEADOF')) {
89
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_insteadofFound
90
+ $this->targetedTokens[T_INSTEADOF] = '5.4';
91
+ }
92
+ if (defined('T_TRAIT')) {
93
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
94
+ $this->targetedTokens[T_TRAIT] = '5.4';
95
+ }
96
+
97
+ $tokens = array_keys($this->targetedTokens);
98
+ $tokens[] = T_STRING;
99
+
100
+ return $tokens;
101
+ }//end register()
102
+
103
+ /**
104
+ * Processes this test, when one of its tokens is encountered.
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.
109
+ *
110
+ * @return void
111
+ */
112
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
113
+ {
114
+ $tokens = $phpcsFile->getTokens();
115
+ $tokenCode = $tokens[$stackPtr]['code'];
116
+ $tokenContentLc = strtolower($tokens[$stackPtr]['content']);
117
+ $isString = false;
118
+
119
+ /*
120
+ * For string tokens we only care if the string is a reserved word used
121
+ * as a function. This only happens in older versions of PHP where the
122
+ * token doesn't exist yet for that keyword or in later versions when the
123
+ * token is used in a method invocation.
124
+ */
125
+ if ($tokenCode === T_STRING
126
+ && (isset($this->targetedStringTokens[$tokenContentLc]) === false)
127
+ ) {
128
+ return;
129
+ }
130
+
131
+ if ($tokenCode === T_STRING) {
132
+ $isString = true;
133
+ }
134
+
135
+ // Make sure this is a function call.
136
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
137
+ if ($next === false || $tokens[$next]['code'] !== T_OPEN_PARENTHESIS) {
138
+ // Not a function call.
139
+ return;
140
+ }
141
+
142
+ // This sniff isn't concerned about function declarations.
143
+ $prev = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
144
+ if ($prev !== false && $tokens[$prev]['code'] === T_FUNCTION) {
145
+ return;
146
+ }
147
+
148
+ /*
149
+ * Deal with PHP 7 relaxing the rules.
150
+ * "As of PHP 7.0.0 these keywords are allowed as property, constant, and method names
151
+ * of classes, interfaces and traits...", i.e. they can be invoked as a method call.
152
+ *
153
+ * Only needed for those keywords which we sniff out via T_STRING.
154
+ */
155
+ if (($tokens[$prev]['code'] === T_OBJECT_OPERATOR || $tokens[$prev]['code'] === T_DOUBLE_COLON)
156
+ && $this->supportsBelow('5.6') === false
157
+ ) {
158
+ return;
159
+ }
160
+
161
+ // For the word catch, it is valid to have an open parenthesis
162
+ // after it, but only if it is preceded by a right curly brace.
163
+ if ($tokenCode === T_CATCH) {
164
+ if ($prev !== false && $tokens[$prev]['code'] === T_CLOSE_CURLY_BRACKET) {
165
+ // Ok, it's fine.
166
+ return;
167
+ }
168
+ }
169
+
170
+ if ($isString === true) {
171
+ $version = $this->targetedStringTokens[$tokenContentLc];
172
+ } else {
173
+ $version = $this->targetedTokens[$tokenCode];
174
+ }
175
+
176
+ if ($this->supportsAbove($version)) {
177
+ $error = "'%s' is a reserved keyword introduced in PHP version %s and cannot be invoked as a function (%s)";
178
+ $errorCode = $this->stringToErrorCode($tokenContentLc) . 'Found';
179
+ $data = array(
180
+ $tokenContentLc,
181
+ $version,
182
+ $tokens[$stackPtr]['type'],
183
+ );
184
+
185
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
186
+ }
187
+ }//end process()
188
+
189
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNamesSniff.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\Sniff;
14
+ use PHPCompatibility\PHPCSHelper;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenNamesSniff.
18
+ *
19
+ * Prohibits the use of reserved keywords as class, function, namespace or constant names.
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 ForbiddenNamesSniff extends Sniff
27
+ {
28
+
29
+ /**
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
+ * @var array(string => string)
34
+ */
35
+ protected $invalidNames = array(
36
+ 'abstract' => '5.0',
37
+ 'and' => 'all',
38
+ 'array' => 'all',
39
+ 'as' => 'all',
40
+ 'break' => 'all',
41
+ 'callable' => '5.4',
42
+ 'case' => 'all',
43
+ 'catch' => '5.0',
44
+ 'class' => 'all',
45
+ 'clone' => '5.0',
46
+ 'const' => 'all',
47
+ 'continue' => 'all',
48
+ 'declare' => 'all',
49
+ 'default' => 'all',
50
+ 'do' => 'all',
51
+ 'else' => 'all',
52
+ 'elseif' => 'all',
53
+ 'enddeclare' => 'all',
54
+ 'endfor' => 'all',
55
+ 'endforeach' => 'all',
56
+ 'endif' => 'all',
57
+ 'endswitch' => 'all',
58
+ 'endwhile' => 'all',
59
+ 'extends' => 'all',
60
+ 'final' => '5.0',
61
+ 'finally' => '5.5',
62
+ 'for' => 'all',
63
+ 'foreach' => 'all',
64
+ 'function' => 'all',
65
+ 'global' => 'all',
66
+ 'goto' => '5.3',
67
+ 'if' => 'all',
68
+ 'implements' => '5.0',
69
+ 'interface' => '5.0',
70
+ 'instanceof' => '5.0',
71
+ 'insteadof' => '5.4',
72
+ 'namespace' => '5.3',
73
+ 'new' => 'all',
74
+ 'or' => 'all',
75
+ 'private' => '5.0',
76
+ 'protected' => '5.0',
77
+ 'public' => '5.0',
78
+ 'static' => 'all',
79
+ 'switch' => 'all',
80
+ 'throw' => '5.0',
81
+ 'trait' => '5.4',
82
+ 'try' => '5.0',
83
+ 'use' => 'all',
84
+ 'var' => 'all',
85
+ 'while' => 'all',
86
+ 'xor' => 'all',
87
+ '__class__' => 'all',
88
+ '__dir__' => '5.3',
89
+ '__file__' => 'all',
90
+ '__function__' => 'all',
91
+ '__method__' => 'all',
92
+ '__namespace__' => '5.3',
93
+ );
94
+
95
+ /**
96
+ * A list of keywords that can follow use statements.
97
+ *
98
+ * @var array(string => string)
99
+ */
100
+ protected $validUseNames = array(
101
+ 'const' => true,
102
+ 'function' => true,
103
+ );
104
+
105
+ /**
106
+ * Whether PHPCS 1.x is used or not.
107
+ *
108
+ * @var bool
109
+ */
110
+ protected $isLowPHPCS = false;
111
+
112
+ /**
113
+ * Scope modifiers and other keywords allowed in trait use statements.
114
+ *
115
+ * @var array
116
+ */
117
+ private $allowedModifiers = array();
118
+
119
+ /**
120
+ * Targeted tokens.
121
+ *
122
+ * @var array
123
+ */
124
+ protected $targetedTokens = array(
125
+ T_CLASS,
126
+ T_FUNCTION,
127
+ T_NAMESPACE,
128
+ T_STRING,
129
+ T_CONST,
130
+ T_USE,
131
+ T_AS,
132
+ T_EXTENDS,
133
+ T_INTERFACE,
134
+ );
135
+
136
+ /**
137
+ * Returns an array of tokens this test wants to listen for.
138
+ *
139
+ * @return array
140
+ */
141
+ public function register()
142
+ {
143
+ $this->isLowPHPCS = version_compare(PHPCSHelper::getVersion(), '2.0', '<');
144
+
145
+ $this->allowedModifiers = array_combine(
146
+ \PHP_CodeSniffer_Tokens::$scopeModifiers,
147
+ \PHP_CodeSniffer_Tokens::$scopeModifiers
148
+ );
149
+ $this->allowedModifiers[T_FINAL] = T_FINAL;
150
+
151
+ $tokens = $this->targetedTokens;
152
+
153
+ if (defined('T_TRAIT')) {
154
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
155
+ $tokens[] = T_TRAIT;
156
+ }
157
+
158
+ if (defined('T_ANON_CLASS')) {
159
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
160
+ $tokens[] = T_ANON_CLASS;
161
+ }
162
+
163
+ return $tokens;
164
+ }//end register()
165
+
166
+ /**
167
+ * Processes this test, when one of its tokens is encountered.
168
+ *
169
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
170
+ * @param int $stackPtr The position of the current token in the
171
+ * stack passed in $tokens.
172
+ *
173
+ * @return void
174
+ */
175
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
176
+ {
177
+ $tokens = $phpcsFile->getTokens();
178
+
179
+ /*
180
+ * We distinguish between the class, function and namespace names vs the define statements.
181
+ */
182
+ if ($tokens[$stackPtr]['type'] === 'T_STRING') {
183
+ $this->processString($phpcsFile, $stackPtr, $tokens);
184
+ } else {
185
+ $this->processNonString($phpcsFile, $stackPtr, $tokens);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Processes this test, when one of its tokens is encountered.
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.
195
+ * @param array $tokens The stack of tokens that make up
196
+ * the file.
197
+ *
198
+ * @return void
199
+ */
200
+ public function processNonString(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens)
201
+ {
202
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
203
+ if ($nextNonEmpty === false) {
204
+ return;
205
+ }
206
+
207
+ /*
208
+ * Deal with anonymous classes - `class` before a reserved keyword is sometimes
209
+ * misidentified as `T_ANON_CLASS`.
210
+ * In PHPCS < 2.3.4 these were tokenized as T_CLASS no matter what.
211
+ */
212
+ if ($tokens[$stackPtr]['type'] === 'T_ANON_CLASS' || $tokens[$stackPtr]['type'] === 'T_CLASS') {
213
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
214
+ if ($prevNonEmpty !== false && $tokens[$prevNonEmpty]['type'] === 'T_NEW') {
215
+ return;
216
+ }
217
+ }
218
+
219
+ /*
220
+ * PHP 5.6 allows for use const and use function, but only if followed by the function/constant name.
221
+ * - `use function HelloWorld` => move to the next token (HelloWorld) to verify.
222
+ * - `use const HelloWorld` => move to the next token (HelloWorld) to verify.
223
+ */
224
+ elseif ($tokens[$stackPtr]['type'] === 'T_USE'
225
+ && isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === true
226
+ ) {
227
+ $maybeUseNext = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
228
+ if ($maybeUseNext !== false && $this->isEndOfUseStatement($tokens[$maybeUseNext]) === false) {
229
+ // Prevent duplicate messages: `const` is T_CONST in PHPCS 1.x and T_STRING in PHPCS 2.x.
230
+ if ($this->isLowPHPCS === true) {
231
+ return;
232
+ }
233
+ $nextNonEmpty = $maybeUseNext;
234
+ }
235
+ }
236
+
237
+ /*
238
+ * Deal with visibility modifiers.
239
+ * - `use HelloWorld { sayHello as protected; }` => valid, bow out.
240
+ * - `use HelloWorld { sayHello as private myPrivateHello; }` => move to the next token to verify.
241
+ */
242
+ elseif ($tokens[$stackPtr]['type'] === 'T_AS'
243
+ && isset($this->allowedModifiers[$tokens[$nextNonEmpty]['code']]) === true
244
+ && $this->inUseScope($phpcsFile, $stackPtr) === true
245
+ ) {
246
+ $maybeUseNext = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
247
+ if ($maybeUseNext === false || $this->isEndOfUseStatement($tokens[$maybeUseNext]) === true) {
248
+ return;
249
+ }
250
+
251
+ $nextNonEmpty = $maybeUseNext;
252
+ }
253
+
254
+ /*
255
+ * Deal with functions declared to return by reference.
256
+ */
257
+ elseif ($tokens[$stackPtr]['type'] === 'T_FUNCTION'
258
+ && $tokens[$nextNonEmpty]['type'] === 'T_BITWISE_AND'
259
+ ) {
260
+ $maybeUseNext = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true, null, true);
261
+ if ($maybeUseNext === false) {
262
+ // Live coding.
263
+ return;
264
+ }
265
+
266
+ $nextNonEmpty = $maybeUseNext;
267
+ }
268
+
269
+ /*
270
+ * Deal with nested namespaces.
271
+ */
272
+ elseif ($tokens[$stackPtr]['type'] === 'T_NAMESPACE') {
273
+ if ($tokens[$stackPtr + 1]['code'] === T_NS_SEPARATOR) {
274
+ // Not a namespace declaration, but use of, i.e. namespace\someFunction();
275
+ return;
276
+ }
277
+
278
+ $endToken = $phpcsFile->findNext(array(T_SEMICOLON, T_OPEN_CURLY_BRACKET), ($stackPtr + 1), null, false, null, true);
279
+ $namespaceName = trim($phpcsFile->getTokensAsString(($stackPtr + 1), ($endToken - $stackPtr - 1)));
280
+ if (empty($namespaceName) === true) {
281
+ return;
282
+ }
283
+
284
+ $namespaceParts = explode('\\', $namespaceName);
285
+ foreach ($namespaceParts as $namespacePart) {
286
+ $partLc = strtolower($namespacePart);
287
+ if (isset($this->invalidNames[$partLc]) === false) {
288
+ continue;
289
+ }
290
+
291
+ // Find the token position of the part which matched.
292
+ for ($i = ($stackPtr + 1); $i < $endToken; $i++) {
293
+ if ($tokens[$i]['content'] === $namespacePart) {
294
+ $nextNonEmpty = $i;
295
+ break;
296
+ }
297
+ }
298
+ }
299
+ unset($i, $namespacePart, $partLc);
300
+ }
301
+
302
+ $nextContentLc = strtolower($tokens[$nextNonEmpty]['content']);
303
+ if (isset($this->invalidNames[$nextContentLc]) === false) {
304
+ return;
305
+ }
306
+
307
+ /*
308
+ * Deal with PHP 7 relaxing the rules.
309
+ * "As of PHP 7.0.0 these keywords are allowed as property, constant, and method names
310
+ * of classes, interfaces and traits, except that class may not be used as constant name."
311
+ */
312
+ if ((($tokens[$stackPtr]['type'] === 'T_FUNCTION'
313
+ && $this->inClassScope($phpcsFile, $stackPtr, false) === true)
314
+ || ($tokens[$stackPtr]['type'] === 'T_CONST'
315
+ && $this->isClassConstant($phpcsFile, $stackPtr) === true
316
+ && $nextContentLc !== 'class'))
317
+ && $this->supportsBelow('5.6') === false
318
+ ) {
319
+ return;
320
+ }
321
+
322
+ if ($this->supportsAbove($this->invalidNames[$nextContentLc])) {
323
+ $data = array(
324
+ $tokens[$nextNonEmpty]['content'],
325
+ $this->invalidNames[$nextContentLc],
326
+ );
327
+ $this->addError($phpcsFile, $stackPtr, $tokens[$nextNonEmpty]['content'], $data);
328
+ }
329
+
330
+ }//end processNonString()
331
+
332
+ /**
333
+ * Processes this test, when one of its tokens is encountered.
334
+ *
335
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
336
+ * @param int $stackPtr The position of the current token in the
337
+ * stack passed in $tokens.
338
+ * @param array $tokens The stack of tokens that make up
339
+ * the file.
340
+ *
341
+ * @return void
342
+ */
343
+ public function processString(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens)
344
+ {
345
+ $tokenContentLc = strtolower($tokens[$stackPtr]['content']);
346
+
347
+ /*
348
+ * Special case for PHP versions where the target is not yet identified as
349
+ * its own token, but presents as T_STRING.
350
+ * - namespace keyword in PHP < 5.3
351
+ * - trait keyword in PHP < 5.4
352
+ */
353
+ if (version_compare(PHP_VERSION_ID, '50400', '<') && $tokenContentLc === 'trait') {
354
+ $this->processNonString($phpcsFile, $stackPtr, $tokens);
355
+ return;
356
+ }
357
+
358
+ // Look for any define/defined tokens (both T_STRING ones, blame Tokenizer).
359
+ if ($tokenContentLc !== 'define' && $tokenContentLc !== 'defined') {
360
+ return;
361
+ }
362
+
363
+ // Retrieve the define(d) constant name.
364
+ $firstParam = $this->getFunctionCallParameter($phpcsFile, $stackPtr, 1);
365
+ if ($firstParam === false) {
366
+ return;
367
+ }
368
+
369
+ $defineName = $this->stripQuotes($firstParam['raw']);
370
+ $defineNameLc = strtolower($defineName);
371
+
372
+ if (isset($this->invalidNames[$defineNameLc]) && $this->supportsAbove($this->invalidNames[$defineNameLc])) {
373
+ $data = array(
374
+ $defineName,
375
+ $this->invalidNames[$defineNameLc],
376
+ );
377
+ $this->addError($phpcsFile, $stackPtr, $defineNameLc, $data);
378
+ }
379
+ }//end processString()
380
+
381
+
382
+ /**
383
+ * Add the error message.
384
+ *
385
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
386
+ * @param int $stackPtr The position of the current token in the
387
+ * stack passed in $tokens.
388
+ * @param string $content The token content found.
389
+ * @param array $data The data to pass into the error message.
390
+ *
391
+ * @return void
392
+ */
393
+ protected function addError($phpcsFile, $stackPtr, $content, $data)
394
+ {
395
+ $error = "Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)";
396
+ $errorCode = $this->stringToErrorCode($content) . 'Found';
397
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
398
+ }
399
+
400
+
401
+ /**
402
+ * Check if the current token code is for a token which can be considered
403
+ * the end of a (partial) use statement.
404
+ *
405
+ * @param int $token The current token information.
406
+ *
407
+ * @return bool
408
+ */
409
+ protected function isEndOfUseStatement($token)
410
+ {
411
+ return in_array($token['code'], array(T_CLOSE_CURLY_BRACKET, T_SEMICOLON, T_COMMA), true);
412
+ }
413
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenNegativeBitshiftSniff.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenNegativeBitshift.
19
+ *
20
+ * Bitwise shifts by negative number will throw an ArithmeticError 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 ForbiddenNegativeBitshiftSniff extends Sniff
29
+ {
30
+ /**
31
+ * Potential end tokens for which the end pointer has to be set back by one.
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
+ * @var array
38
+ */
39
+ private $inclusiveStopPoints = array(
40
+ T_COLON => true,
41
+ T_COMMA => true,
42
+ T_DOUBLE_ARROW => true,
43
+ T_SEMICOLON => true,
44
+ );
45
+
46
+ /**
47
+ * Returns an array of tokens this test wants to listen for.
48
+ *
49
+ * @return array
50
+ */
51
+ public function register()
52
+ {
53
+ return array(
54
+ T_SL,
55
+ T_SL_EQUAL,
56
+ T_SR,
57
+ T_SR_EQUAL,
58
+ );
59
+
60
+ }//end register()
61
+
62
+ /**
63
+ * Processes this test, when one of its tokens is encountered.
64
+ *
65
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
66
+ * @param int $stackPtr The position of the current token
67
+ * in the stack passed in $tokens.
68
+ *
69
+ * @return void
70
+ */
71
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
72
+ {
73
+ if ($this->supportsAbove('7.0') === false) {
74
+ return;
75
+ }
76
+
77
+ $tokens = $phpcsFile->getTokens();
78
+
79
+ // Determine the start and end of the part of the statement we need to examine.
80
+ $start = ($stackPtr + 1);
81
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $start, null, true);
82
+ if ($next !== false && $tokens[$next]['code'] === T_OPEN_PARENTHESIS) {
83
+ $start = ($next + 1);
84
+ }
85
+
86
+ $end = PHPCSHelper::findEndOfStatement($phpcsFile, $start);
87
+ if (isset($this->inclusiveStopPoints[$tokens[$end]['code']]) === true) {
88
+ --$end;
89
+ }
90
+
91
+ if ($this->isNegativeNumber($phpcsFile, $start, $end, true) !== true) {
92
+ // Not a negative number or undetermined.
93
+ return;
94
+ }
95
+
96
+ $phpcsFile->addError(
97
+ 'Bitwise shifts by negative number will throw an ArithmeticError in PHP 7.0. Found: %s',
98
+ $stackPtr,
99
+ 'Found',
100
+ array($phpcsFile->getTokensAsString($start, ($end - $start + 1)))
101
+ );
102
+
103
+ }//end process()
104
+
105
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ForbiddenSwitchWithMultipleDefaultBlocksSniff.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ForbiddenSwitchWithMultipleDefaultBlocksSniff.
18
+ *
19
+ * Switch statements can not have multiple default blocks since PHP 7.0
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Wim Godden <wim@cu.be>
26
+ */
27
+ class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff
28
+ {
29
+
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(T_SWITCH);
38
+
39
+ }//end register()
40
+
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(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
51
+ {
52
+ if ($this->supportsAbove('7.0') === false) {
53
+ return;
54
+ }
55
+
56
+ $tokens = $phpcsFile->getTokens();
57
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
58
+ return;
59
+ }
60
+
61
+ $defaultToken = $stackPtr;
62
+ $defaultCount = 0;
63
+ $targetLevel = $tokens[$stackPtr]['level'] + 1;
64
+ while ($defaultCount < 2 && ($defaultToken = $phpcsFile->findNext(array(T_DEFAULT), $defaultToken + 1, $tokens[$stackPtr]['scope_closer'])) !== false) {
65
+ // Same level or one below (= two default cases after each other).
66
+ if ($tokens[$defaultToken]['level'] === $targetLevel || $tokens[$defaultToken]['level'] === ($targetLevel + 1)) {
67
+ $defaultCount++;
68
+ }
69
+ }
70
+
71
+ if ($defaultCount > 1) {
72
+ $phpcsFile->addError(
73
+ 'Switch statements can not have multiple default blocks since PHP 7.0',
74
+ $stackPtr,
75
+ 'Found'
76
+ );
77
+ }
78
+ }//end process()
79
+
80
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/InternalInterfacesSniff.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\InternalInterfacesSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\Sniff;
13
+ use PHPCompatibility\PHPCSHelper;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\InternalInterfacesSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
21
+ */
22
+ class InternalInterfacesSniff extends Sniff
23
+ {
24
+
25
+ /**
26
+ * A list of PHP internal interfaces, not intended to be implemented by userland classes.
27
+ *
28
+ * The array lists : the error message to use.
29
+ *
30
+ * @var array(string => string)
31
+ */
32
+ protected $internalInterfaces = array(
33
+ 'Traversable' => 'shouldn\'t be implemented directly, implement the Iterator or IteratorAggregate interface instead.',
34
+ 'DateTimeInterface' => 'is intended for type hints only and is not implementable.',
35
+ 'Throwable' => 'cannot be implemented directly, extend the Exception class instead.',
36
+ );
37
+
38
+
39
+ /**
40
+ * Returns an array of tokens this test wants to listen for.
41
+ *
42
+ * @return array
43
+ */
44
+ public function register()
45
+ {
46
+ // Handle case-insensitivity of interface names.
47
+ $this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces);
48
+
49
+ $targets = array(T_CLASS);
50
+
51
+ if (defined('T_ANON_CLASS')) {
52
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
53
+ $targets[] = T_ANON_CLASS;
54
+ }
55
+
56
+ return $targets;
57
+
58
+ }//end register()
59
+
60
+
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
66
+ * the stack passed in $tokens.
67
+ *
68
+ * @return void
69
+ */
70
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
71
+ {
72
+ $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr);
73
+
74
+ if (is_array($interfaces) === false || $interfaces === array()) {
75
+ return;
76
+ }
77
+
78
+ foreach ($interfaces as $interface) {
79
+ $interfaceLc = strtolower($interface);
80
+ if (isset($this->internalInterfaces[$interfaceLc]) === true) {
81
+ $error = 'The interface %s %s';
82
+ $errorCode = $this->stringToErrorCode($interfaceLc) . 'Found';
83
+ $data = array(
84
+ $interface,
85
+ $this->internalInterfaces[$interfaceLc],
86
+ );
87
+
88
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
89
+ }
90
+ }
91
+
92
+ }//end process()
93
+
94
+
95
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/LateStaticBindingSniff.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\LateStaticBindingSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\LateStaticBindingSniff.
18
+ *
19
+ * PHP version 5.3
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
24
+ */
25
+ class LateStaticBindingSniff extends Sniff
26
+ {
27
+ /**
28
+ * Returns an array of tokens this test wants to listen for.
29
+ *
30
+ * @return array
31
+ */
32
+ public function register()
33
+ {
34
+ return array(T_STATIC);
35
+
36
+ }//end register()
37
+
38
+
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.
45
+ *
46
+ * @return void
47
+ */
48
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
49
+ {
50
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
51
+ if ($nextNonEmpty === false) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+ if ($tokens[$nextNonEmpty]['code'] !== T_DOUBLE_COLON) {
57
+ return;
58
+ }
59
+
60
+ $inClass = $this->inClassScope($phpcsFile, $stackPtr, false);
61
+
62
+ if ($inClass === true && $this->supportsBelow('5.2') === true) {
63
+ $phpcsFile->addError(
64
+ 'Late static binding is not supported in PHP 5.2 or earlier.',
65
+ $stackPtr,
66
+ 'Found'
67
+ );
68
+ }
69
+
70
+ if ($inClass === false) {
71
+ $phpcsFile->addError(
72
+ 'Late static binding is not supported outside of class scope.',
73
+ $stackPtr,
74
+ 'OutsideClassScope'
75
+ );
76
+ }
77
+
78
+ }//end process()
79
+
80
+
81
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/MbstringReplaceEModifierSniff.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\MbstringReplaceEModifierSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\MbstringReplaceEModifierSniff.
18
+ *
19
+ * PHP version 7.1
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
24
+ */
25
+ class MbstringReplaceEModifierSniff extends AbstractFunctionCallParameterSniff
26
+ {
27
+
28
+ /**
29
+ * Functions to check for.
30
+ *
31
+ * Key is the function name, value the parameter position of the options parameter.
32
+ *
33
+ * @var array
34
+ */
35
+ protected $targetFunctions = array(
36
+ 'mb_ereg_replace' => 4,
37
+ 'mb_eregi_replace' => 4,
38
+ 'mb_regex_set_options' => 1,
39
+ );
40
+
41
+
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()
48
+ {
49
+ // Version used here should be the highest version from the `$newModifiers` array,
50
+ // i.e. the last PHP version in which a new modifier was introduced.
51
+ return ($this->supportsAbove('7.1') === false);
52
+ }
53
+
54
+
55
+ /**
56
+ * Process the parameters of a matched function.
57
+ *
58
+ * This method has to be made concrete in child classes.
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.
63
+ * @param array $parameters Array with information about the parameters.
64
+ *
65
+ * @return int|void Integer stack pointer to skip forward or void to continue
66
+ * normal file processing.
67
+ */
68
+ public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $parameters)
69
+ {
70
+ $tokens = $phpcsFile->getTokens();
71
+ $functionNameLc = strtolower($functionName);
72
+
73
+ // Check whether the options parameter in the function call is passed.
74
+ if (isset($parameters[$this->targetFunctions[$functionNameLc]]) === false) {
75
+ return;
76
+ }
77
+
78
+ $optionsParam = $parameters[$this->targetFunctions[$functionNameLc]];
79
+
80
+ $stringToken = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$stringTokens, $optionsParam['start'], $optionsParam['end'] + 1);
81
+ if ($stringToken === false) {
82
+ // No string token found in the options parameter, so skip it (e.g. variable passed in).
83
+ return;
84
+ }
85
+
86
+ $options = '';
87
+
88
+ /*
89
+ * Get the content of any string tokens in the options parameter and remove the quotes and variables.
90
+ */
91
+ for ($i = $stringToken; $i <= $optionsParam['end']; $i++) {
92
+ if (in_array($tokens[$i]['code'], \PHP_CodeSniffer_Tokens::$stringTokens, true) === false) {
93
+ continue;
94
+ }
95
+
96
+ $content = $this->stripQuotes($tokens[$i]['content']);
97
+ if ($tokens[$i]['code'] === T_DOUBLE_QUOTED_STRING) {
98
+ $content = $this->stripVariables($content);
99
+ }
100
+ $content = trim($content);
101
+
102
+ if (empty($content) === false) {
103
+ $options .= $content;
104
+ }
105
+ }
106
+
107
+ if (strpos($options, 'e') !== false) {
108
+ $error = 'The Mbstring regex "e" modifier is deprecated since PHP 7.1.';
109
+
110
+ // The alternative mb_ereg_replace_callback() function is only available since 5.4.1.
111
+ if ($this->supportsBelow('5.4.1') === false) {
112
+ $error .= ' Use mb_ereg_replace_callback() instead (PHP 5.4.1+).';
113
+ }
114
+
115
+ $phpcsFile->addWarning($error, $stackPtr, 'Deprecated');
116
+ }
117
+ }
118
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewAnonymousClassesSniff.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewAnonymousClasses.
18
+ *
19
+ * Anonymous classes are supported in PHP 7.0
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Wim Godden <wim.godden@cu.be>
26
+ */
27
+ class NewAnonymousClassesSniff extends Sniff
28
+ {
29
+
30
+ /**
31
+ * Tokens which in various PHP versions indicate the `class` keyword.
32
+ *
33
+ * The dedicated anonymous class token is added from the `register()`
34
+ * method if the token is available.
35
+ *
36
+ * @var array
37
+ */
38
+ private $indicators = array(
39
+ T_CLASS => T_CLASS,
40
+ );
41
+
42
+ /**
43
+ * Returns an array of tokens this test wants to listen for.
44
+ *
45
+ * @return array
46
+ */
47
+ public function register()
48
+ {
49
+ if (defined('T_ANON_CLASS')) {
50
+ $this->indicators[T_ANON_CLASS] = T_ANON_CLASS;
51
+ }
52
+
53
+ return array(T_NEW);
54
+ }//end register()
55
+
56
+
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.
63
+ *
64
+ * @return void
65
+ */
66
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
67
+ {
68
+ if ($this->supportsBelow('5.6') === false) {
69
+ return;
70
+ }
71
+
72
+ $tokens = $phpcsFile->getTokens();
73
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
74
+ if ($nextNonEmpty === false || isset($this->indicators[$tokens[$nextNonEmpty]['code']]) === false) {
75
+ return;
76
+ }
77
+
78
+ // Still here ? In that case, it is an anonymous class.
79
+ $phpcsFile->addError(
80
+ 'Anonymous classes are not supported in PHP 5.6 or earlier',
81
+ $stackPtr,
82
+ 'Found'
83
+ );
84
+
85
+ }//end process()
86
+
87
+
88
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewArrayStringDereferencingSniff.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewArrayStringDereferencingSniff.
18
+ *
19
+ * Array and string literals can now be dereferenced directly to access individual elements and characters.
20
+ *
21
+ * PHP version 5.5
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ */
27
+ class NewArrayStringDereferencingSniff 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()
35
+ {
36
+ return array(
37
+ T_ARRAY,
38
+ T_OPEN_SHORT_ARRAY,
39
+ T_CONSTANT_ENCAPSED_STRING,
40
+ );
41
+ }//end register()
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
48
+ * the stack passed in $tokens.
49
+ *
50
+ * @return void
51
+ */
52
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
+ {
54
+ if ($this->supportsBelow('5.4') === false) {
55
+ return;
56
+ }
57
+
58
+ $tokens = $phpcsFile->getTokens();
59
+
60
+ switch ($tokens[$stackPtr]['code']) {
61
+ case T_CONSTANT_ENCAPSED_STRING:
62
+ $type = 'string literals';
63
+ $end = $stackPtr;
64
+ break;
65
+
66
+ case T_ARRAY:
67
+ if (isset($tokens[$stackPtr]['parenthesis_closer']) === false) {
68
+ // Live coding.
69
+ return;
70
+ } else {
71
+ $type = 'arrays';
72
+ $end = $tokens[$stackPtr]['parenthesis_closer'];
73
+ }
74
+ break;
75
+
76
+ case T_OPEN_SHORT_ARRAY:
77
+ if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
78
+ // Live coding.
79
+ return;
80
+ } else {
81
+ $type = 'arrays';
82
+ $end = $tokens[$stackPtr]['bracket_closer'];
83
+ }
84
+ break;
85
+ }
86
+
87
+ if (isset($type, $end) === false) {
88
+ // Shouldn't happen, but for some reason did.
89
+ return;
90
+ }
91
+
92
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($end + 1), null, true, null, true);
93
+
94
+ if ($nextNonEmpty !== false
95
+ && ($tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET'
96
+ || $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SHORT_ARRAY') // Work around bug #1381 in PHPCS 2.8.1 and lower.
97
+ ) {
98
+ $phpcsFile->addError(
99
+ 'Direct array dereferencing of %s is not present in PHP version 5.4 or earlier',
100
+ $nextNonEmpty,
101
+ 'Found',
102
+ array($type)
103
+ );
104
+ }
105
+
106
+ }//end process()
107
+
108
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClassMemberAccessSniff.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\NewClassMemberAccessSniff.
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
+ * PHP version 5.4
24
+ * PHP version 7.0
25
+ *
26
+ * @category PHP
27
+ * @package PHPCompatibility
28
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
29
+ */
30
+ class NewClassMemberAccessSniff extends Sniff
31
+ {
32
+
33
+ /**
34
+ * Returns an array of tokens this test wants to listen for.
35
+ *
36
+ * @return array
37
+ */
38
+ public function register()
39
+ {
40
+ return array(
41
+ T_NEW,
42
+ T_CLONE,
43
+ );
44
+ }
45
+
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.
52
+ *
53
+ * @return void
54
+ */
55
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
56
+ {
57
+ $tokens = $phpcsFile->getTokens();
58
+
59
+ if ($tokens[$stackPtr]['code'] === T_NEW && $this->supportsBelow('5.3') !== true) {
60
+ return;
61
+ } elseif ($tokens[$stackPtr]['code'] === T_CLONE && $this->supportsBelow('5.6') !== true) {
62
+ return;
63
+ }
64
+
65
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === false) {
66
+ // The `new className/clone $a` has to be in parentheses, without is not supported.
67
+ return;
68
+ }
69
+
70
+ $parenthesisCloser = end($tokens[$stackPtr]['nested_parenthesis']);
71
+ $parenthesisOpener = key($tokens[$stackPtr]['nested_parenthesis']);
72
+
73
+ if (isset($tokens[$parenthesisOpener]['parenthesis_owner']) === true) {
74
+ // If there is an owner, these parentheses are for a different purpose.
75
+ return;
76
+ }
77
+
78
+ $prevBeforeParenthesis = $phpcsFile->findPrevious(
79
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
80
+ ($parenthesisOpener - 1),
81
+ null,
82
+ true
83
+ );
84
+ if ($prevBeforeParenthesis !== false && $tokens[$prevBeforeParenthesis]['code'] === T_STRING) {
85
+ // This is most likely a function call with the new/cloned object as a parameter.
86
+ return;
87
+ }
88
+
89
+ $nextAfterParenthesis = $phpcsFile->findNext(
90
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
91
+ ($parenthesisCloser + 1),
92
+ null,
93
+ true
94
+ );
95
+ if ($nextAfterParenthesis === false) {
96
+ // Live coding.
97
+ return;
98
+ }
99
+
100
+ if ($tokens[$nextAfterParenthesis]['code'] !== T_OBJECT_OPERATOR
101
+ && $tokens[$nextAfterParenthesis]['code'] !== T_OPEN_SQUARE_BRACKET
102
+ ) {
103
+ return;
104
+ }
105
+
106
+ $data = array('instantiation', '5.3');
107
+ $errorCode = 'OnNewFound';
108
+
109
+ if ($tokens[$stackPtr]['code'] === T_CLONE) {
110
+ $data = array('cloning', '5.6');
111
+ $errorCode = 'OnCloneFound';
112
+ }
113
+
114
+ $phpcsFile->addError(
115
+ 'Class member access on object %s was not supported in PHP %s or earlier',
116
+ $parenthesisCloser,
117
+ $errorCode,
118
+ $data
119
+ );
120
+ }
121
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClassesSniff.php ADDED
@@ -0,0 +1,818 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\AbstractNewFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewClassesSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Wim Godden <wim.godden@cu.be>
21
+ * @copyright 2013 Cu.be Solutions bvba
22
+ */
23
+ class NewClassesSniff extends AbstractNewFeatureSniff
24
+ {
25
+
26
+ /**
27
+ * A list of new classes, not present in older versions.
28
+ *
29
+ * The array lists : version number with false (not present) or true (present).
30
+ * If's sufficient to list the first version where the class appears.
31
+ *
32
+ * @var array(string => array(string => bool))
33
+ */
34
+ protected $newClasses = array(
35
+ 'ArrayObject' => array(
36
+ '4.4' => false,
37
+ '5.0' => true,
38
+ ),
39
+ 'ArrayIterator' => array(
40
+ '4.4' => false,
41
+ '5.0' => true,
42
+ ),
43
+ 'CachingIterator' => array(
44
+ '4.4' => false,
45
+ '5.0' => true,
46
+ ),
47
+ 'DirectoryIterator' => array(
48
+ '4.4' => false,
49
+ '5.0' => true,
50
+ ),
51
+ 'RecursiveDirectoryIterator' => array(
52
+ '4.4' => false,
53
+ '5.0' => true,
54
+ ),
55
+ 'RecursiveIteratorIterator' => array(
56
+ '4.4' => false,
57
+ '5.0' => true,
58
+ ),
59
+ 'php_user_filter' => array(
60
+ '4.4' => false,
61
+ '5.0' => true,
62
+ ),
63
+ 'tidy' => array(
64
+ '4.4' => false,
65
+ '5.0' => true,
66
+ ),
67
+
68
+ 'SimpleXMLElement' => array(
69
+ '5.0.0' => false,
70
+ '5.0.1' => true,
71
+ ),
72
+ 'tidyNode' => array(
73
+ '5.0.0' => false,
74
+ '5.0.1' => true,
75
+ ),
76
+
77
+ 'libXMLError' => array(
78
+ '5.0' => false,
79
+ '5.1' => true,
80
+ ),
81
+ 'PDO' => array(
82
+ '5.0' => false,
83
+ '5.1' => true,
84
+ ),
85
+ 'PDOStatement' => array(
86
+ '5.0' => false,
87
+ '5.1' => true,
88
+ ),
89
+ 'AppendIterator' => array(
90
+ '5.0' => false,
91
+ '5.1' => true,
92
+ ),
93
+ 'EmptyIterator' => array(
94
+ '5.0' => false,
95
+ '5.1' => true,
96
+ ),
97
+ 'FilterIterator' => array(
98
+ '5.0' => false,
99
+ '5.1' => true,
100
+ ),
101
+ 'InfiniteIterator' => array(
102
+ '5.0' => false,
103
+ '5.1' => true,
104
+ ),
105
+ 'IteratorIterator' => array(
106
+ '5.0' => false,
107
+ '5.1' => true,
108
+ ),
109
+ 'LimitIterator' => array(
110
+ '5.0' => false,
111
+ '5.1' => true,
112
+ ),
113
+ 'NoRewindIterator' => array(
114
+ '5.0' => false,
115
+ '5.1' => true,
116
+ ),
117
+ 'ParentIterator' => array(
118
+ '5.0' => false,
119
+ '5.1' => true,
120
+ ),
121
+ 'RecursiveArrayIterator' => array(
122
+ '5.0' => false,
123
+ '5.1' => true,
124
+ ),
125
+ 'RecursiveCachingIterator' => array(
126
+ '5.0' => false,
127
+ '5.1' => true,
128
+ ),
129
+ 'RecursiveFilterIterator' => array(
130
+ '5.0' => false,
131
+ '5.1' => true,
132
+ ),
133
+ 'SimpleXMLIterator' => array(
134
+ '5.0' => false,
135
+ '5.1' => true,
136
+ ),
137
+ 'SplFileObject' => array(
138
+ '5.0' => false,
139
+ '5.1' => true,
140
+ ),
141
+ 'XMLReader' => array(
142
+ '5.0' => false,
143
+ '5.1' => true,
144
+ ),
145
+
146
+ 'SplFileInfo' => array(
147
+ '5.1.1' => false,
148
+ '5.1.2' => true,
149
+ ),
150
+ 'SplTempFileObject' => array(
151
+ '5.1.1' => false,
152
+ '5.1.2' => true,
153
+ ),
154
+ 'XMLWriter' => array(
155
+ '5.1.1' => false,
156
+ '5.1.2' => true,
157
+ ),
158
+
159
+ 'DateTime' => array(
160
+ '5.1' => false,
161
+ '5.2' => true,
162
+ ),
163
+ 'DateTimeZone' => array(
164
+ '5.1' => false,
165
+ '5.2' => true,
166
+ ),
167
+ 'RegexIterator' => array(
168
+ '5.1' => false,
169
+ '5.2' => true,
170
+ ),
171
+ 'RecursiveRegexIterator' => array(
172
+ '5.1' => false,
173
+ '5.2' => true,
174
+ ),
175
+ 'ReflectionFunctionAbstract' => array(
176
+ '5.1' => false,
177
+ '5.2' => true,
178
+ ),
179
+ 'ZipArchive' => array(
180
+ '5.1' => false,
181
+ '5.2' => true,
182
+ ),
183
+
184
+ 'Closure' => array(
185
+ '5.2' => false,
186
+ '5.3' => true,
187
+ ),
188
+ 'DateInterval' => array(
189
+ '5.2' => false,
190
+ '5.3' => true,
191
+ ),
192
+ 'DatePeriod' => array(
193
+ '5.2' => false,
194
+ '5.3' => true,
195
+ ),
196
+ 'finfo' => array(
197
+ '5.2' => false,
198
+ '5.3' => true,
199
+ ),
200
+ 'Collator' => array(
201
+ '5.2' => false,
202
+ '5.3' => true,
203
+ ),
204
+ 'NumberFormatter' => array(
205
+ '5.2' => false,
206
+ '5.3' => true,
207
+ ),
208
+ 'Locale' => array(
209
+ '5.2' => false,
210
+ '5.3' => true,
211
+ ),
212
+ 'Normalizer' => array(
213
+ '5.2' => false,
214
+ '5.3' => true,
215
+ ),
216
+ 'MessageFormatter' => array(
217
+ '5.2' => false,
218
+ '5.3' => true,
219
+ ),
220
+ 'IntlDateFormatter' => array(
221
+ '5.2' => false,
222
+ '5.3' => true,
223
+ ),
224
+ 'Phar' => array(
225
+ '5.2' => false,
226
+ '5.3' => true,
227
+ ),
228
+ 'PharData' => array(
229
+ '5.2' => false,
230
+ '5.3' => true,
231
+ ),
232
+ 'PharFileInfo' => array(
233
+ '5.2' => false,
234
+ '5.3' => true,
235
+ ),
236
+ 'FilesystemIterator' => array(
237
+ '5.2' => false,
238
+ '5.3' => true,
239
+ ),
240
+ 'GlobIterator' => array(
241
+ '5.2' => false,
242
+ '5.3' => true,
243
+ ),
244
+ 'MultipleIterator' => array(
245
+ '5.2' => false,
246
+ '5.3' => true,
247
+ ),
248
+ 'RecursiveTreeIterator' => array(
249
+ '5.2' => false,
250
+ '5.3' => true,
251
+ ),
252
+ 'SplDoublyLinkedList' => array(
253
+ '5.2' => false,
254
+ '5.3' => true,
255
+ ),
256
+ 'SplFixedArray' => array(
257
+ '5.2' => false,
258
+ '5.3' => true,
259
+ ),
260
+ 'SplHeap' => array(
261
+ '5.2' => false,
262
+ '5.3' => true,
263
+ ),
264
+ 'SplMaxHeap' => array(
265
+ '5.2' => false,
266
+ '5.3' => true,
267
+ ),
268
+ 'SplMinHeap' => array(
269
+ '5.2' => false,
270
+ '5.3' => true,
271
+ ),
272
+ 'SplObjectStorage' => array(
273
+ '5.2' => false,
274
+ '5.3' => true,
275
+ ),
276
+ 'SplPriorityQueue' => array(
277
+ '5.2' => false,
278
+ '5.3' => true,
279
+ ),
280
+ 'SplQueue' => array(
281
+ '5.2' => false,
282
+ '5.3' => true,
283
+ ),
284
+ 'SplStack' => array(
285
+ '5.2' => false,
286
+ '5.3' => true,
287
+ ),
288
+
289
+ 'ResourceBundle' => array(
290
+ '5.3.1' => false,
291
+ '5.3.2' => true,
292
+ ),
293
+
294
+ 'CallbackFilterIterator' => array(
295
+ '5.3' => false,
296
+ '5.4' => true,
297
+ ),
298
+ 'RecursiveCallbackFilterIterator' => array(
299
+ '5.3' => false,
300
+ '5.4' => true,
301
+ ),
302
+ 'ReflectionZendExtension' => array(
303
+ '5.3' => false,
304
+ '5.4' => true,
305
+ ),
306
+ 'SessionHandler' => array(
307
+ '5.3' => false,
308
+ '5.4' => true,
309
+ ),
310
+ 'SNMP' => array(
311
+ '5.3' => false,
312
+ '5.4' => true,
313
+ ),
314
+ 'Transliterator' => array(
315
+ '5.3' => false,
316
+ '5.4' => true,
317
+ ),
318
+ 'Spoofchecker' => array(
319
+ '5.3' => false,
320
+ '5.4' => true,
321
+ ),
322
+
323
+ 'Generator' => array(
324
+ '5.4' => false,
325
+ '5.5' => true,
326
+ ),
327
+ 'CURLFile' => array(
328
+ '5.4' => false,
329
+ '5.5' => true,
330
+ ),
331
+ 'DateTimeImmutable' => array(
332
+ '5.4' => false,
333
+ '5.5' => true,
334
+ ),
335
+ 'IntlCalendar' => array(
336
+ '5.4' => false,
337
+ '5.5' => true,
338
+ ),
339
+ 'IntlGregorianCalendar' => array(
340
+ '5.4' => false,
341
+ '5.5' => true,
342
+ ),
343
+ 'IntlTimeZone' => array(
344
+ '5.4' => false,
345
+ '5.5' => true,
346
+ ),
347
+ 'IntlBreakIterator' => array(
348
+ '5.4' => false,
349
+ '5.5' => true,
350
+ ),
351
+ 'IntlRuleBasedBreakIterator' => array(
352
+ '5.4' => false,
353
+ '5.5' => true,
354
+ ),
355
+ 'IntlCodePointBreakIterator' => array(
356
+ '5.4' => false,
357
+ '5.5' => true,
358
+ ),
359
+ 'UConverter' => array(
360
+ '5.4' => false,
361
+ '5.5' => true,
362
+ ),
363
+
364
+ 'GMP' => array(
365
+ '5.5' => false,
366
+ '5.6' => true,
367
+ ),
368
+
369
+ 'IntlChar' => array(
370
+ '5.6' => false,
371
+ '7.0' => true,
372
+ ),
373
+ 'ReflectionType' => array(
374
+ '5.6' => false,
375
+ '7.0' => true,
376
+ ),
377
+ 'ReflectionGenerator' => array(
378
+ '5.6' => false,
379
+ '7.0' => true,
380
+ ),
381
+
382
+ 'ReflectionClassConstant' => array(
383
+ '7.0' => false,
384
+ '7.1' => true,
385
+ ),
386
+
387
+ );
388
+
389
+ /**
390
+ * A list of new Exception classes, not present in older versions.
391
+ *
392
+ * The array lists : version number with false (not present) or true (present).
393
+ * If's sufficient to list the first version where the class appears.
394
+ *
395
+ * {@internal Classes listed here do not need to be added to the $newClasses
396
+ * property as well.
397
+ * This list is automatically added to the $newClasses property
398
+ * in the `register()` method.}}
399
+ *
400
+ * @var array(string => array(string => bool))
401
+ */
402
+ protected $newExceptions = array(
403
+ 'Exception' => array(
404
+ // According to the docs introduced in PHP 5.1, but this appears to be.
405
+ // an error. Class was introduced with try/catch keywords in PHP 5.0.
406
+ '4.4' => false,
407
+ '5.0' => true,
408
+ ),
409
+ 'ErrorException' => array(
410
+ '5.0' => false,
411
+ '5.1' => true,
412
+ ),
413
+ 'BadFunctionCallException' => array(
414
+ '5.0' => false,
415
+ '5.1' => true,
416
+ ),
417
+ 'BadMethodCallException' => array(
418
+ '5.0' => false,
419
+ '5.1' => true,
420
+ ),
421
+ 'DomainException' => array(
422
+ '5.0' => false,
423
+ '5.1' => true,
424
+ ),
425
+ 'InvalidArgumentException' => array(
426
+ '5.0' => false,
427
+ '5.1' => true,
428
+ ),
429
+ 'LengthException' => array(
430
+ '5.0' => false,
431
+ '5.1' => true,
432
+ ),
433
+ 'LogicException' => array(
434
+ '5.0' => false,
435
+ '5.1' => true,
436
+ ),
437
+ 'OutOfBoundsException' => array(
438
+ '5.0' => false,
439
+ '5.1' => true,
440
+ ),
441
+ 'OutOfRangeException' => array(
442
+ '5.0' => false,
443
+ '5.1' => true,
444
+ ),
445
+ 'OverflowException' => array(
446
+ '5.0' => false,
447
+ '5.1' => true,
448
+ ),
449
+ 'RangeException' => array(
450
+ '5.0' => false,
451
+ '5.1' => true,
452
+ ),
453
+ 'RuntimeException' => array(
454
+ '5.0' => false,
455
+ '5.1' => true,
456
+ ),
457
+ 'UnderflowException' => array(
458
+ '5.0' => false,
459
+ '5.1' => true,
460
+ ),
461
+ 'UnexpectedValueException' => array(
462
+ '5.0' => false,
463
+ '5.1' => true,
464
+ ),
465
+ 'DOMException' => array(
466
+ '4.4' => false,
467
+ '5.0' => true,
468
+ ),
469
+ 'mysqli_sql_exception' => array(
470
+ '4.4' => false,
471
+ '5.0' => true,
472
+ ),
473
+ 'PDOException' => array(
474
+ '5.0' => false,
475
+ '5.1' => true,
476
+ ),
477
+ 'ReflectionException' => array(
478
+ '4.4' => false,
479
+ '5.0' => true,
480
+ ),
481
+ 'SoapFault' => array(
482
+ '4.4' => false,
483
+ '5.0' => true,
484
+ ),
485
+
486
+ 'PharException' => array(
487
+ '5.2' => false,
488
+ '5.3' => true,
489
+ ),
490
+
491
+ 'SNMPException' => array(
492
+ '5.3' => false,
493
+ '5.4' => true,
494
+ ),
495
+
496
+ 'IntlException' => array(
497
+ '5.5.0' => false,
498
+ '5.5.1' => true,
499
+ ),
500
+
501
+ 'Error' => array(
502
+ '5.6' => false,
503
+ '7.0' => true,
504
+ ),
505
+ 'ArithmeticError' => array(
506
+ '5.6' => false,
507
+ '7.0' => true,
508
+ ),
509
+ 'AssertionError' => array(
510
+ '5.6' => false,
511
+ '7.0' => true,
512
+ ),
513
+ 'DivisionByZeroError' => array(
514
+ '5.6' => false,
515
+ '7.0' => true,
516
+ ),
517
+ 'ParseError' => array(
518
+ '5.6' => false,
519
+ '7.0' => true,
520
+ ),
521
+ 'TypeError' => array(
522
+ '5.6' => false,
523
+ '7.0' => true,
524
+ ),
525
+ 'UI\Exception\InvalidArgumentException' => array(
526
+ '5.6' => false,
527
+ '7.0' => true,
528
+ ),
529
+ 'UI\Exception\RuntimeException' => array(
530
+ '5.6' => false,
531
+ '7.0' => true,
532
+ ),
533
+
534
+ 'ArgumentCountError' => array(
535
+ '7.0' => false,
536
+ '7.1' => true,
537
+ ),
538
+ );
539
+
540
+
541
+ /**
542
+ * Returns an array of tokens this test wants to listen for.
543
+ *
544
+ * @return array
545
+ */
546
+ public function register()
547
+ {
548
+ // Handle case-insensitivity of class names.
549
+ $this->newClasses = $this->arrayKeysToLowercase($this->newClasses);
550
+ $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions);
551
+
552
+ // Add the Exception classes to the Classes list.
553
+ $this->newClasses = array_merge($this->newClasses, $this->newExceptions);
554
+
555
+ $targets = array(
556
+ T_NEW,
557
+ T_CLASS,
558
+ T_DOUBLE_COLON,
559
+ T_FUNCTION,
560
+ T_CLOSURE,
561
+ T_CATCH,
562
+ );
563
+
564
+ if (defined('T_ANON_CLASS')) {
565
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
566
+ $targets[] = T_ANON_CLASS;
567
+ }
568
+
569
+ if (defined('T_RETURN_TYPE')) {
570
+ $targets[] = T_RETURN_TYPE;
571
+ }
572
+
573
+ return $targets;
574
+
575
+ }//end register()
576
+
577
+
578
+ /**
579
+ * Processes this test, when one of its tokens is encountered.
580
+ *
581
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
582
+ * @param int $stackPtr The position of the current token in
583
+ * the stack passed in $tokens.
584
+ *
585
+ * @return void
586
+ */
587
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
588
+ {
589
+ $tokens = $phpcsFile->getTokens();
590
+
591
+ switch ($tokens[$stackPtr]['type']) {
592
+ case 'T_FUNCTION':
593
+ case 'T_CLOSURE':
594
+ $this->processFunctionToken($phpcsFile, $stackPtr);
595
+
596
+ // Deal with older PHPCS version which don't recognize return type hints
597
+ // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
598
+ $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
599
+ if ($returnTypeHint !== false) {
600
+ $this->processReturnTypeToken($phpcsFile, $returnTypeHint);
601
+ }
602
+ break;
603
+
604
+ case 'T_CATCH':
605
+ $this->processCatchToken($phpcsFile, $stackPtr);
606
+ break;
607
+
608
+ case 'T_RETURN_TYPE':
609
+ $this->processReturnTypeToken($phpcsFile, $stackPtr);
610
+ break;
611
+
612
+ default:
613
+ $this->processSingularToken($phpcsFile, $stackPtr);
614
+ break;
615
+ }
616
+
617
+ }//end process()
618
+
619
+
620
+ /**
621
+ * Processes this test for when a token resulting in a singular class name is encountered.
622
+ *
623
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
624
+ * @param int $stackPtr The position of the current token in
625
+ * the stack passed in $tokens.
626
+ *
627
+ * @return void
628
+ */
629
+ private function processSingularToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
630
+ {
631
+ $tokens = $phpcsFile->getTokens();
632
+ $FQClassName = '';
633
+
634
+ if ($tokens[$stackPtr]['type'] === 'T_NEW') {
635
+ $FQClassName = $this->getFQClassNameFromNewToken($phpcsFile, $stackPtr);
636
+
637
+ } elseif ($tokens[$stackPtr]['type'] === 'T_CLASS' || $tokens[$stackPtr]['type'] === 'T_ANON_CLASS') {
638
+ $FQClassName = $this->getFQExtendedClassName($phpcsFile, $stackPtr);
639
+
640
+ } elseif ($tokens[$stackPtr]['type'] === 'T_DOUBLE_COLON') {
641
+ $FQClassName = $this->getFQClassNameFromDoubleColonToken($phpcsFile, $stackPtr);
642
+ }
643
+
644
+ if ($FQClassName === '') {
645
+ return;
646
+ }
647
+
648
+ $className = substr($FQClassName, 1); // Remove global namespace indicator.
649
+ $classNameLc = strtolower($className);
650
+
651
+ if (isset($this->newClasses[$classNameLc]) === false) {
652
+ return;
653
+ }
654
+
655
+ $itemInfo = array(
656
+ 'name' => $className,
657
+ 'nameLc' => $classNameLc,
658
+ );
659
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
660
+
661
+ }//end processSingularToken()
662
+
663
+
664
+ /**
665
+ * Processes this test for when a function token is encountered.
666
+ *
667
+ * - Detect new classes when used as a type hint.
668
+ *
669
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
670
+ * @param int $stackPtr The position of the current token in
671
+ * the stack passed in $tokens.
672
+ *
673
+ * @return void
674
+ */
675
+ private function processFunctionToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
676
+ {
677
+ // Retrieve typehints stripped of global NS indicator and/or nullable indicator.
678
+ $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr);
679
+ if (empty($typeHints) || is_array($typeHints) === false) {
680
+ return;
681
+ }
682
+
683
+ foreach ($typeHints as $hint) {
684
+
685
+ $typeHintLc = strtolower($hint);
686
+
687
+ if (isset($this->newClasses[$typeHintLc]) === true) {
688
+ $itemInfo = array(
689
+ 'name' => $hint,
690
+ 'nameLc' => $typeHintLc,
691
+ );
692
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
693
+ }
694
+ }
695
+ }
696
+
697
+
698
+ /**
699
+ * Processes this test for when a catch token is encountered.
700
+ *
701
+ * - Detect exceptions when used in a catch statement.
702
+ *
703
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
704
+ * @param int $stackPtr The position of the current token in
705
+ * the stack passed in $tokens.
706
+ *
707
+ * @return void
708
+ */
709
+ private function processCatchToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
710
+ {
711
+ $tokens = $phpcsFile->getTokens();
712
+
713
+ // Bow out during live coding.
714
+ if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) {
715
+ return;
716
+ }
717
+
718
+ $opener = $tokens[$stackPtr]['parenthesis_opener'];
719
+ $closer = ($tokens[$stackPtr]['parenthesis_closer'] + 1);
720
+ $name = '';
721
+ $listen = array(
722
+ // Parts of a (namespaced) class name.
723
+ T_STRING => true,
724
+ T_NS_SEPARATOR => true,
725
+ // End/split tokens.
726
+ T_VARIABLE => false,
727
+ T_BITWISE_OR => false,
728
+ T_CLOSE_CURLY_BRACKET => false, // Shouldn't be needed as we expect a var before this.
729
+ );
730
+
731
+ for ($i = ($opener + 1); $i < $closer; $i++) {
732
+ if (isset($listen[$tokens[$i]['code']]) === false) {
733
+ continue;
734
+ }
735
+
736
+ if ($listen[$tokens[$i]['code']] === true) {
737
+ $name .= $tokens[$i]['content'];
738
+ continue;
739
+ } else {
740
+ if (empty($name) === true) {
741
+ // Weird, we should have a name by the time we encounter a variable or |.
742
+ // So this may be the closer.
743
+ continue;
744
+ }
745
+
746
+ $name = ltrim($name, '\\');
747
+ $nameLC = strtolower($name);
748
+
749
+ if (isset($this->newExceptions[$nameLC]) === true) {
750
+ $itemInfo = array(
751
+ 'name' => $name,
752
+ 'nameLc' => $nameLC,
753
+ );
754
+ $this->handleFeature($phpcsFile, $i, $itemInfo);
755
+ }
756
+
757
+ // Reset for a potential multi-catch.
758
+ $name = '';
759
+ }
760
+ }
761
+ }
762
+
763
+
764
+ /**
765
+ * Processes this test for when a return type token is encountered.
766
+ *
767
+ * - Detect new classes when used as a return type declaration.
768
+ *
769
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
770
+ * @param int $stackPtr The position of the current token in
771
+ * the stack passed in $tokens.
772
+ *
773
+ * @return void
774
+ */
775
+ private function processReturnTypeToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
776
+ {
777
+ $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
778
+ $returnTypeHint = ltrim($returnTypeHint, '\\');
779
+ $returnTypeHintLc = strtolower($returnTypeHint);
780
+
781
+ if (isset($this->newClasses[$returnTypeHintLc]) === false) {
782
+ return;
783
+ }
784
+
785
+ // Still here ? Then this is a return type declaration using a new class.
786
+ $itemInfo = array(
787
+ 'name' => $returnTypeHint,
788
+ 'nameLc' => $returnTypeHintLc,
789
+ );
790
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
791
+ }
792
+
793
+
794
+ /**
795
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
796
+ *
797
+ * @param array $itemInfo Base information about the item.
798
+ *
799
+ * @return array Version and other information about the item.
800
+ */
801
+ public function getItemArray(array $itemInfo)
802
+ {
803
+ return $this->newClasses[$itemInfo['nameLc']];
804
+ }
805
+
806
+
807
+ /**
808
+ * Get the error message template for this sniff.
809
+ *
810
+ * @return string
811
+ */
812
+ protected function getErrorMsgTemplate()
813
+ {
814
+ return 'The built-in class ' . parent::getErrorMsgTemplate();
815
+ }
816
+
817
+
818
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewClosureSniff.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewClosure.
18
+ *
19
+ * Closures are available since PHP 5.3
20
+ *
21
+ * PHP version 5.3
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Wim Godden <wim@cu.be>
26
+ */
27
+ class NewClosureSniff 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()
35
+ {
36
+ return array(T_CLOSURE);
37
+
38
+ }//end register()
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsBelow('5.2')) {
52
+ $phpcsFile->addError(
53
+ 'Closures / anonymous functions are not available in PHP 5.2 or earlier',
54
+ $stackPtr,
55
+ 'Found'
56
+ );
57
+ }
58
+
59
+ /*
60
+ * Closures can only be declared as static since PHP 5.4.
61
+ */
62
+ $isStatic = $this->isClosureStatic($phpcsFile, $stackPtr);
63
+ if ($this->supportsBelow('5.3') && $isStatic === true) {
64
+ $phpcsFile->addError(
65
+ 'Closures / anonymous functions could not be declared as static in PHP 5.3 or earlier',
66
+ $stackPtr,
67
+ 'StaticFound'
68
+ );
69
+ }
70
+
71
+ $tokens = $phpcsFile->getTokens();
72
+
73
+ if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) {
74
+ // Live coding or parse error.
75
+ return;
76
+ }
77
+
78
+ $scopeStart = ($tokens[$stackPtr]['scope_opener'] + 1);
79
+ $scopeEnd = $tokens[$stackPtr]['scope_closer'];
80
+ $usesThis = $this->findThisUsageInClosure($phpcsFile, $scopeStart, $scopeEnd);
81
+
82
+ if ($this->supportsBelow('5.3')) {
83
+ /*
84
+ * Closures declared within classes only have access to $this since PHP 5.4.
85
+ */
86
+ if ($usesThis !== false) {
87
+ $thisFound = $usesThis;
88
+ do {
89
+ $phpcsFile->addError(
90
+ 'Closures / anonymous functions did not have access to $this in PHP 5.3 or earlier',
91
+ $thisFound,
92
+ 'ThisFound'
93
+ );
94
+
95
+ $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd);
96
+
97
+ } while ($thisFound !== false);
98
+ }
99
+
100
+ /*
101
+ * Closures declared within classes only have access to self/parent/static since PHP 5.4.
102
+ */
103
+ $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, $scopeStart, $scopeEnd);
104
+
105
+ if ($usesClassRef !== false) {
106
+ do {
107
+ $phpcsFile->addError(
108
+ 'Closures / anonymous functions could not use "%s::" in PHP 5.3 or earlier',
109
+ $usesClassRef,
110
+ 'ClassRefFound',
111
+ array(strtolower($tokens[$usesClassRef]['content']))
112
+ );
113
+
114
+ $usesClassRef = $this->findClassRefUsageInClosure($phpcsFile, ($usesClassRef + 1), $scopeEnd);
115
+
116
+ } while ($usesClassRef !== false);
117
+ }
118
+ }
119
+
120
+ /*
121
+ * Check for correct usage.
122
+ */
123
+ if ($this->supportsAbove('5.4') && $usesThis !== false) {
124
+
125
+ $thisFound = $usesThis;
126
+
127
+ do {
128
+ /*
129
+ * Closures only have access to $this if not declared as static.
130
+ */
131
+ if ($isStatic === true) {
132
+ $phpcsFile->addError(
133
+ 'Closures / anonymous functions declared as static do not have access to $this',
134
+ $thisFound,
135
+ 'ThisFoundInStatic'
136
+ );
137
+ }
138
+
139
+ /*
140
+ * Closures only have access to $this if used within a class context.
141
+ */
142
+ elseif ($this->inClassScope($phpcsFile, $stackPtr, false) === false) {
143
+ $phpcsFile->addWarning(
144
+ 'Closures / anonymous functions only have access to $this if used within a class or when bound to an object using bindTo(). Please verify.',
145
+ $thisFound,
146
+ 'ThisFoundOutsideClass'
147
+ );
148
+ }
149
+
150
+ $thisFound = $this->findThisUsageInClosure($phpcsFile, ($thisFound + 1), $scopeEnd);
151
+
152
+ } while ($thisFound !== false);
153
+ }
154
+
155
+ // Prevent double reporting for nested closures.
156
+ return $scopeEnd;
157
+
158
+ }//end process()
159
+
160
+
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.
167
+ *
168
+ * @return bool
169
+ */
170
+ protected function isClosureStatic(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
171
+ {
172
+ $tokens = $phpcsFile->getTokens();
173
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
174
+
175
+ return ($prevToken !== false && $tokens[$prevToken]['code'] === T_STATIC);
176
+ }
177
+
178
+
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.
185
+ *
186
+ * @return int|false The stackPtr to the first $this usage if found or false if
187
+ * $this is not used.
188
+ */
189
+ protected function findThisUsageInClosure(\PHP_CodeSniffer_File $phpcsFile, $startToken, $endToken)
190
+ {
191
+ // Make sure the $startToken is valid.
192
+ if ($startToken >= $endToken) {
193
+ return false;
194
+ }
195
+
196
+ return $phpcsFile->findNext(
197
+ T_VARIABLE,
198
+ $startToken,
199
+ $endToken,
200
+ false,
201
+ '$this'
202
+ );
203
+ }
204
+
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.
211
+ *
212
+ * @return int|false The stackPtr to the first classRef usage if found or false if
213
+ * they are not used.
214
+ */
215
+ protected function findClassRefUsageInClosure(\PHP_CodeSniffer_File $phpcsFile, $startToken, $endToken)
216
+ {
217
+ // Make sure the $startToken is valid.
218
+ if ($startToken >= $endToken) {
219
+ return false;
220
+ }
221
+
222
+ $tokens = $phpcsFile->getTokens();
223
+ $classRef = $phpcsFile->findNext(array(T_SELF, T_PARENT, T_STATIC), $startToken, $endToken);
224
+
225
+ if ($classRef === false || $tokens[$classRef]['code'] !== T_STATIC) {
226
+ return $classRef;
227
+ }
228
+
229
+ // T_STATIC, make sure it is used as a class reference.
230
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($classRef + 1), $endToken, true);
231
+ if ($next === false || $tokens[$next]['code'] !== T_DOUBLE_COLON) {
232
+ return false;
233
+ }
234
+
235
+ return $classRef;
236
+ }
237
+
238
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstVisibilitySniff.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewConstVisibility.
4
+ *
5
+ * PHP version 7.1
6
+ *
7
+ * @category PHP
8
+ * @package PHPCompatibility
9
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
+ */
11
+
12
+ namespace PHPCompatibility\Sniffs\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewConstVisibility.
18
+ *
19
+ * Visibility for class constants is available since PHP 7.1.
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 NewConstVisibilitySniff 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()
35
+ {
36
+ return array(T_CONST);
37
+
38
+ }//end register()
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsBelow('7.0') === false) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
57
+
58
+ // Is the previous token a visibility indicator ?
59
+ if ($prevToken === false || in_array($tokens[$prevToken]['code'], \PHP_CodeSniffer_Tokens::$scopeModifiers, true) === false) {
60
+ return;
61
+ }
62
+
63
+ // Is this a class constant ?
64
+ if ($this->isClassConstant($phpcsFile, $stackPtr) === false) {
65
+ // This may be a constant declaration in the global namespace with visibility,
66
+ // but that would throw a parse error, i.e. not our concern.
67
+ return;
68
+ }
69
+
70
+ $phpcsFile->addError(
71
+ 'Visibility indicators for class constants are not supported in PHP 7.0 or earlier. Found "%s const"',
72
+ $stackPtr,
73
+ 'Found',
74
+ array($tokens[$prevToken]['content'])
75
+ );
76
+
77
+ }//end process()
78
+
79
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstantScalarExpressionsSniff.php ADDED
@@ -0,0 +1,565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\NewConstantScalarExpressionsSniff.
19
+ *
20
+ * Since PHP 5.6, it is now possible to provide a scalar expression involving
21
+ * numeric and string literals and/or constants in contexts where PHP previously
22
+ * expected a static value, such as constant and property declarations and
23
+ * default function arguments.
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 NewConstantScalarExpressionsSniff extends Sniff
32
+ {
33
+
34
+ /**
35
+ * Error message.
36
+ *
37
+ * @var string
38
+ */
39
+ const ERROR_PHRASE = 'Constant scalar expressions are not allowed %s in PHP 5.5 or earlier.';
40
+
41
+ /**
42
+ * Partial error phrases to be used in combination with the error message constant.
43
+ *
44
+ * @var array
45
+ */
46
+ protected $errorPhrases = array(
47
+ 'const' => 'when defining constants using the const keyword',
48
+ 'property' => 'in property declarations',
49
+ 'staticvar' => 'in static variable declarations',
50
+ 'default' => 'in default function arguments',
51
+ );
52
+
53
+ /**
54
+ * Tokens which were allowed to be used in these declarations prior to PHP 5.6.
55
+ *
56
+ * This list will be enriched in the setProperties() method.
57
+ *
58
+ * @var array
59
+ */
60
+ protected $safeOperands = array(
61
+ T_LNUMBER => T_LNUMBER,
62
+ T_DNUMBER => T_DNUMBER,
63
+ T_CONSTANT_ENCAPSED_STRING => T_CONSTANT_ENCAPSED_STRING,
64
+ T_TRUE => T_TRUE,
65
+ T_FALSE => T_FALSE,
66
+ T_NULL => T_NULL,
67
+
68
+ T_LINE => T_LINE,
69
+ T_FILE => T_FILE,
70
+ T_DIR => T_DIR,
71
+ T_FUNC_C => T_FUNC_C,
72
+ T_CLASS_C => T_CLASS_C,
73
+ T_METHOD_C => T_METHOD_C,
74
+ T_NS_C => T_NS_C,
75
+
76
+ // Special cases:
77
+ T_NS_SEPARATOR => T_NS_SEPARATOR,
78
+ /*
79
+ * This can be neigh anything, but for any usage except constants,
80
+ * the T_STRING will be combined with non-allowed tokens, so we should be good.
81
+ */
82
+ T_STRING => T_STRING,
83
+ );
84
+
85
+
86
+ /**
87
+ * Returns an array of tokens this test wants to listen for.
88
+ *
89
+ * @return array
90
+ */
91
+ public function register()
92
+ {
93
+ // Set the properties up only once.
94
+ $this->setProperties();
95
+
96
+ return array(
97
+ T_CONST,
98
+ T_VARIABLE,
99
+ T_FUNCTION,
100
+ T_CLOSURE,
101
+ T_STATIC,
102
+ );
103
+ }
104
+
105
+
106
+ /**
107
+ * Make some adjustments to the $safeOperands property.
108
+ *
109
+ * @return void
110
+ */
111
+ public function setProperties()
112
+ {
113
+ /*
114
+ * Not available on PHPCS 1.x icw PHP 5.3.
115
+ * Not a problem for recognition as when the token is not available
116
+ * __TRAIT__ will be tokenized as T_STRING which will pass.
117
+ */
118
+ if (defined('T_TRAIT_C') === true) {
119
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_trait_cFound
120
+ $this->safeOperands[T_TRAIT_C] = T_TRAIT_C;
121
+ }
122
+
123
+ $emptyTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
124
+ $heredocTokens = \PHP_CodeSniffer_Tokens::$heredocTokens;
125
+ if (version_compare(PHPCSHelper::getVersion(), '2.0', '<')) {
126
+ // PHPCS 1.x compat.
127
+ $emptyTokens = array_combine($emptyTokens, $emptyTokens);
128
+ $heredocTokens = array_combine($heredocTokens, $heredocTokens);
129
+ }
130
+
131
+ $this->safeOperands = $this->safeOperands + $heredocTokens + $emptyTokens;
132
+ }
133
+
134
+
135
+ /**
136
+ * Do a version check to determine if this sniff needs to run at all.
137
+ *
138
+ * @return bool
139
+ */
140
+ protected function bowOutEarly()
141
+ {
142
+ return ($this->supportsBelow('5.5') !== true);
143
+ }
144
+
145
+
146
+ /**
147
+ * Processes this test, when one of its tokens is encountered.
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.
152
+ *
153
+ * @return void|int Null or integer stack pointer to skip forward.
154
+ */
155
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
156
+ {
157
+ if ($this->bowOutEarly() === true) {
158
+ return;
159
+ }
160
+
161
+ $tokens = $phpcsFile->getTokens();
162
+
163
+ switch ($tokens[$stackPtr]['type']) {
164
+ case 'T_FUNCTION':
165
+ case 'T_CLOSURE':
166
+ $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
167
+ if (empty($params)) {
168
+ // No parameters.
169
+ return;
170
+ }
171
+
172
+ $funcToken = $tokens[$stackPtr];
173
+
174
+ if (isset($funcToken['parenthesis_owner'], $funcToken['parenthesis_opener'], $funcToken['parenthesis_closer']) === false
175
+ || $funcToken['parenthesis_owner'] !== $stackPtr
176
+ || isset($tokens[$funcToken['parenthesis_opener']], $tokens[$funcToken['parenthesis_closer']]) === false
177
+ ) {
178
+ // Hmm.. something is going wrong as these should all be available & valid.
179
+ return;
180
+ }
181
+
182
+ $opener = $funcToken['parenthesis_opener'];
183
+ $closer = $funcToken['parenthesis_closer'];
184
+
185
+ // Which nesting level is the one we are interested in ?
186
+ $nestedParenthesisCount = 1;
187
+ if (isset($tokens[$opener]['nested_parenthesis'])) {
188
+ $nestedParenthesisCount += count($tokens[$opener]['nested_parenthesis']);
189
+ }
190
+
191
+ foreach ($params as $param) {
192
+ if (isset($param['default']) === false) {
193
+ continue;
194
+ }
195
+
196
+ $end = $param['token'];
197
+ while (($end = $phpcsFile->findNext(array(T_COMMA, T_CLOSE_PARENTHESIS), ($end + 1), ($closer + 1))) !== false) {
198
+ $maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $nestedParenthesisCount);
199
+ if ($maybeSkipTo !== true) {
200
+ $end = $maybeSkipTo;
201
+ continue;
202
+ }
203
+
204
+ // Ignore closing parenthesis/bracket if not 'ours'.
205
+ if ($tokens[$end]['code'] === T_CLOSE_PARENTHESIS && $end !== $closer) {
206
+ continue;
207
+ }
208
+
209
+ // Ok, we've found the end of the param default value declaration.
210
+ break;
211
+ }
212
+
213
+ if ($this->isValidAssignment($phpcsFile, $param['token'], $end) === false) {
214
+ $this->throwError($phpcsFile, $param['token'], 'default', $param['content']);
215
+ }
216
+ }
217
+
218
+ /*
219
+ * No need for the sniff to be triggered by the T_VARIABLEs in the function
220
+ * definition as we've already examined them above, so let's skip over them.
221
+ */
222
+ return $closer;
223
+
224
+ case 'T_VARIABLE':
225
+ case 'T_STATIC':
226
+ case 'T_CONST':
227
+ $type = 'const';
228
+
229
+ // Filter out non-property declarations.
230
+ if ($tokens[$stackPtr]['code'] === T_VARIABLE) {
231
+ if ($this->isClassProperty($phpcsFile, $stackPtr) === false) {
232
+ return;
233
+ }
234
+
235
+ $type = 'property';
236
+
237
+ // Move back one token to have the same starting point as the others.
238
+ $stackPtr = ($stackPtr - 1);
239
+ }
240
+
241
+ // Filter out late static binding and class properties.
242
+ if ($tokens[$stackPtr]['code'] === T_STATIC) {
243
+ $next = $phpcsFile->findNext(
244
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
245
+ ($stackPtr + 1),
246
+ null,
247
+ true,
248
+ null,
249
+ true
250
+ );
251
+ if ($next === false || $tokens[$next]['code'] !== T_VARIABLE) {
252
+ // Late static binding.
253
+ return;
254
+ }
255
+
256
+ if ($this->isClassProperty($phpcsFile, $next) === true) {
257
+ // Class properties are examined based on the T_VARIABLE token.
258
+ return;
259
+ }
260
+ unset($next);
261
+
262
+ $type = 'staticvar';
263
+ }
264
+
265
+ $endOfStatement = $phpcsFile->findNext(array(T_SEMICOLON, T_CLOSE_TAG), ($stackPtr + 1));
266
+ if ($endOfStatement === false) {
267
+ // No semi-colon - live coding.
268
+ return;
269
+ }
270
+
271
+ $targetNestingLevel = 0;
272
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
273
+ $targetNestingLevel = count($tokens[$stackPtr]['nested_parenthesis']);
274
+ }
275
+
276
+ // Examine each variable/constant in multi-declarations.
277
+ $start = $stackPtr;
278
+ $end = $stackPtr;
279
+ while (($end = $phpcsFile->findNext(array(T_COMMA, T_SEMICOLON, T_OPEN_SHORT_ARRAY, T_CLOSE_TAG), ($end + 1), ($endOfStatement + 1))) !== false) {
280
+
281
+ $maybeSkipTo = $this->isRealEndOfDeclaration($tokens, $end, $targetNestingLevel);
282
+ if ($maybeSkipTo !== true) {
283
+ $end = $maybeSkipTo;
284
+ continue;
285
+ }
286
+
287
+ $start = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($start + 1), $end, true);
288
+ if ($start === false
289
+ || ($tokens[$stackPtr]['code'] === T_CONST && $tokens[$start]['code'] !== T_STRING)
290
+ || ($tokens[$stackPtr]['code'] !== T_CONST && $tokens[$start]['code'] !== T_VARIABLE)
291
+ ) {
292
+ // Shouldn't be possible.
293
+ continue;
294
+ }
295
+
296
+ if ($this->isValidAssignment($phpcsFile, $start, $end) === false) {
297
+ // Create the "found" snippet.
298
+ $content = '';
299
+ $tokenCount = ($end - $start);
300
+ if ($tokenCount < 20) {
301
+ // Prevent large arrays from being added to the error message.
302
+ $content = $phpcsFile->getTokensAsString($start, ($tokenCount + 1));
303
+ }
304
+
305
+ $this->throwError($phpcsFile, $start, $type, $content);
306
+ }
307
+
308
+ $start = $end;
309
+ }
310
+
311
+ // Skip to the end of the statement to prevent duplicate messages for multi-declarations.
312
+ return $endOfStatement;
313
+ }
314
+ }
315
+
316
+
317
+ /**
318
+ * Is a value declared and is the value declared valid pre-PHP 5.6 ?
319
+ *
320
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
321
+ * @param int $stackPtr The position of the current token in the
322
+ * stack passed in $tokens.
323
+ * @param int $end The end of the value definition.
324
+ * This will normally be a comma or semi-colon.
325
+ *
326
+ * @return bool
327
+ */
328
+ protected function isValidAssignment(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $end)
329
+ {
330
+ $tokens = $phpcsFile->getTokens();
331
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), $end, true);
332
+ if ($next === false || $tokens[$next]['code'] !== T_EQUAL) {
333
+ // No value assigned.
334
+ return true;
335
+ }
336
+
337
+ return $this->isStaticValue($phpcsFile, $tokens, ($next + 1), ($end - 1));
338
+ }
339
+
340
+
341
+ /**
342
+ * Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ?
343
+ *
344
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
345
+ * @param array $tokens The token stack of the current file.
346
+ * @param int $start The stackPtr from which to start examining.
347
+ * @param int $end The end of the value definition (inclusive),
348
+ * i.e. this token will be examined as part of
349
+ * the snippet.
350
+ * @param bool $nestedArrays Optional. Array nesting level when examining
351
+ * the content of an array.
352
+ *
353
+ * @return bool
354
+ */
355
+ protected function isStaticValue(\PHP_CodeSniffer_File $phpcsFile, $tokens, $start, $end, $nestedArrays = 0)
356
+ {
357
+ $nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true);
358
+ if ($nextNonSimple === false) {
359
+ return true;
360
+ }
361
+
362
+ /*
363
+ * OK, so we have at least one token which needs extra examination.
364
+ */
365
+ switch ($tokens[$nextNonSimple]['code']) {
366
+ case T_MINUS:
367
+ case T_PLUS:
368
+ if ($this->isNumber($phpcsFile, $start, $end, true) !== false) {
369
+ // Int or float with sign.
370
+ return true;
371
+ }
372
+
373
+ return false;
374
+
375
+ case T_NAMESPACE:
376
+ case T_PARENT:
377
+ case T_SELF:
378
+ case T_DOUBLE_COLON:
379
+ $nextNonEmpty = $phpcsFile->findNext(
380
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
381
+ ($nextNonSimple + 1),
382
+ ($end + 1),
383
+ true
384
+ );
385
+
386
+ if ($tokens[$nextNonSimple]['code'] === T_NAMESPACE) {
387
+ // Allow only `namespace\...`.
388
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_NS_SEPARATOR) {
389
+ return false;
390
+ }
391
+ } elseif ($tokens[$nextNonSimple]['code'] === T_PARENT
392
+ || $tokens[$nextNonSimple]['code'] === T_SELF
393
+ ) {
394
+ // Allow only `parent::` and `self::`.
395
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_DOUBLE_COLON) {
396
+ return false;
397
+ }
398
+ } elseif ($tokens[$nextNonSimple]['code'] === T_DOUBLE_COLON) {
399
+ // Allow only `T_STRING::T_STRING`.
400
+ if ($nextNonEmpty === false || $tokens[$nextNonEmpty]['code'] !== T_STRING) {
401
+ return false;
402
+ }
403
+
404
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonSimple - 1), null, true);
405
+ // No need to worry about parent/self, that's handled above and
406
+ // the double colon is skipped over in that case.
407
+ if ($prevNonEmpty === false || $tokens[$prevNonEmpty]['code'] !== T_STRING) {
408
+ return false;
409
+ }
410
+ }
411
+
412
+ // Examine what comes after the namespace/parent/self/double colon, if anything.
413
+ return $this->isStaticValue($phpcsFile, $tokens, ($nextNonEmpty + 1), $end, $nestedArrays);
414
+
415
+ case T_ARRAY:
416
+ case T_OPEN_SHORT_ARRAY:
417
+ ++$nestedArrays;
418
+
419
+ $arrayItems = $this->getFunctionCallParameters($phpcsFile, $nextNonSimple);
420
+ if (empty($arrayItems) === false) {
421
+ foreach ($arrayItems as $item) {
422
+ // Check for a double arrow, but only if it's for this array item, not for a nested array.
423
+ $doubleArrow = false;
424
+
425
+ $maybeDoubleArrow = $phpcsFile->findNext(
426
+ array(T_DOUBLE_ARROW, T_ARRAY, T_OPEN_SHORT_ARRAY),
427
+ $item['start'],
428
+ ($item['end'] + 1)
429
+ );
430
+ if ($maybeDoubleArrow !== false && $tokens[$maybeDoubleArrow]['code'] === T_DOUBLE_ARROW) {
431
+ // Double arrow is for this nesting level.
432
+ $doubleArrow = $maybeDoubleArrow;
433
+ }
434
+
435
+ if ($doubleArrow === false) {
436
+ if ($this->isStaticValue($phpcsFile, $tokens, $item['start'], $item['end'], $nestedArrays) === false) {
437
+ return false;
438
+ }
439
+
440
+ } else {
441
+ // Examine array key.
442
+ if ($this->isStaticValue($phpcsFile, $tokens, $item['start'], ($doubleArrow - 1), $nestedArrays) === false) {
443
+ return false;
444
+ }
445
+
446
+ // Examine array value.
447
+ if ($this->isStaticValue($phpcsFile, $tokens, ($doubleArrow + 1), $item['end'], $nestedArrays) === false) {
448
+ return false;
449
+ }
450
+ }
451
+ }
452
+ }
453
+
454
+ --$nestedArrays;
455
+
456
+ /*
457
+ * Find the end of the array.
458
+ * We already know we will have a valid closer as otherwise we wouldn't have been
459
+ * able to get the array items.
460
+ */
461
+ $closer = ($nextNonSimple + 1);
462
+ if ($tokens[$nextNonSimple]['code'] === T_OPEN_SHORT_ARRAY
463
+ && isset($tokens[$nextNonSimple]['bracket_closer']) === true
464
+ ) {
465
+ $closer = $tokens[$nextNonSimple]['bracket_closer'];
466
+ } else {
467
+ $maybeOpener = $phpcsFile->findNext(
468
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
469
+ ($nextNonSimple + 1),
470
+ ($end + 1),
471
+ true
472
+ );
473
+ if ($tokens[$maybeOpener]['code'] === T_OPEN_PARENTHESIS) {
474
+ $opener = $maybeOpener;
475
+ if (isset($tokens[$opener]['parenthesis_closer']) === true) {
476
+ $closer = $tokens[$opener]['parenthesis_closer'];
477
+ }
478
+ }
479
+ }
480
+
481
+ if ($closer === $end) {
482
+ return true;
483
+ }
484
+
485
+ // Examine what comes after the array, if anything.
486
+ return $this->isStaticValue($phpcsFile, $tokens, ($closer + 1), $end, $nestedArrays);
487
+
488
+ }
489
+
490
+ // Ok, so this unsafe token was not one of the exceptions, i.e. this is a PHP 5.6+ syntax.
491
+ return false;
492
+ }
493
+
494
+
495
+ /**
496
+ * Throw an error if a scalar expression is found.
497
+ *
498
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
499
+ * @param int $stackPtr The position of the token to link the error to.
500
+ * @param string $type Type of usage found.
501
+ * @param string $content Optional. The value for the declaration as found.
502
+ *
503
+ * @return void
504
+ */
505
+ protected function throwError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $type, $content = '')
506
+ {
507
+ $error = static::ERROR_PHRASE;
508
+ $phrase = '';
509
+ $errorCode = 'Found';
510
+
511
+ if (isset($this->errorPhrases[$type]) === true) {
512
+ $errorCode = $this->stringToErrorCode($type) . 'Found';
513
+ $phrase = $this->errorPhrases[$type];
514
+ }
515
+
516
+ $data = array($phrase);
517
+
518
+ if (empty($content) === false) {
519
+ $error .= ' Found: %s';
520
+ $data[] = $content;
521
+ }
522
+
523
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
524
+ }
525
+
526
+
527
+ /**
528
+ * Helper function to find the end of multi variable/constant declarations.
529
+ *
530
+ * Checks whether a certain part of a declaration needs to be skipped over or
531
+ * if it is the real end of the declaration.
532
+ *
533
+ * @param array $tokens Token stack of the current file.
534
+ * @param int $endPtr The token to examine as a candidate end pointer.
535
+ * @param int $targetLevel Target nesting level.
536
+ *
537
+ * @return bool|int True if this is the real end. Int stackPtr to skip to if not.
538
+ */
539
+ private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel)
540
+ {
541
+ // Ignore anything within short array definition brackets for now.
542
+ if ($tokens[$endPtr]['code'] === T_OPEN_SHORT_ARRAY
543
+ && (isset($tokens[$endPtr]['bracket_opener'])
544
+ && $tokens[$endPtr]['bracket_opener'] === $endPtr)
545
+ && isset($tokens[$endPtr]['bracket_closer'])
546
+ ) {
547
+ // Skip forward to the end of the short array definition.
548
+ return $tokens[$endPtr]['bracket_closer'];
549
+ }
550
+
551
+ // Skip past comma's at a lower nesting level.
552
+ if ($tokens[$endPtr]['code'] === T_COMMA) {
553
+ // Check if a comma is at the nesting level we're targetting.
554
+ $nestingLevel = 0;
555
+ if (isset($tokens[$endPtr]['nested_parenthesis']) === true) {
556
+ $nestingLevel = count($tokens[$endPtr]['nested_parenthesis']);
557
+ }
558
+ if ($nestingLevel > $targetLevel) {
559
+ return $endPtr;
560
+ }
561
+ }
562
+
563
+ return true;
564
+ }
565
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewConstantsSniff.php ADDED
@@ -0,0 +1,3012 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewConstantsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\NewConstantsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class NewConstantsSniff extends AbstractNewFeatureSniff
22
+ {
23
+
24
+ /**
25
+ * A list of new PHP Constants, not present in older versions.
26
+ *
27
+ * The array lists : version number with false (not present) or true (present).
28
+ * If's sufficient to list the first version where the constant appears.
29
+ *
30
+ * Note: PHP Constants are case-sensitive!
31
+ *
32
+ * @var array(string => array(string => bool|string|null))
33
+ */
34
+ protected $newConstants = array(
35
+ 'E_STRICT' => array(
36
+ '4.4' => false,
37
+ '5.0' => true,
38
+ ),
39
+ // Curl:
40
+ 'CURLOPT_FTP_USE_EPRT' => array(
41
+ '4.4' => false,
42
+ '5.0' => true,
43
+ ),
44
+ 'CURLOPT_NOSIGNAL' => array(
45
+ '4.4' => false,
46
+ '5.0' => true,
47
+ ),
48
+ 'CURLOPT_UNRESTRICTED_AUTH' => array(
49
+ '4.4' => false,
50
+ '5.0' => true,
51
+ ),
52
+ 'CURLOPT_BUFFERSIZE' => array(
53
+ '4.4' => false,
54
+ '5.0' => true,
55
+ ),
56
+ 'CURLOPT_HTTPAUTH' => array(
57
+ '4.4' => false,
58
+ '5.0' => true,
59
+ ),
60
+ 'CURLOPT_PROXYPORT' => array(
61
+ '4.4' => false,
62
+ '5.0' => true,
63
+ ),
64
+ 'CURLOPT_PROXYTYPE' => array(
65
+ '4.4' => false,
66
+ '5.0' => true,
67
+ ),
68
+ 'CURLOPT_SSLCERTTYPE' => array(
69
+ '4.4' => false,
70
+ '5.0' => true,
71
+ ),
72
+ 'CURLOPT_HTTP200ALIASES' => array(
73
+ '4.4' => false,
74
+ '5.0' => true,
75
+ ),
76
+ // OpenSSL:
77
+ 'OPENSSL_ALGO_MD2' => array(
78
+ '4.4' => false,
79
+ '5.0' => true,
80
+ ),
81
+ 'OPENSSL_ALGO_MD4' => array(
82
+ '4.4' => false,
83
+ '5.0' => true,
84
+ ),
85
+ 'OPENSSL_ALGO_MD5' => array(
86
+ '4.4' => false,
87
+ '5.0' => true,
88
+ ),
89
+ 'OPENSSL_ALGO_SHA1' => array(
90
+ '4.4' => false,
91
+ '5.0' => true,
92
+ ),
93
+ 'OPENSSL_ALGO_DSS1' => array(
94
+ '4.4' => false,
95
+ '5.0' => true,
96
+ ),
97
+ // Tokenizer:
98
+ 'T_ABSTRACT' => array(
99
+ '4.4' => false,
100
+ '5.0' => true,
101
+ ),
102
+ 'T_CATCH' => array(
103
+ '4.4' => false,
104
+ '5.0' => true,
105
+ ),
106
+
107
+ 'SORT_LOCALE_STRING' => array(
108
+ '5.0.1' => false,
109
+ '5.0.2' => true,
110
+ ),
111
+ 'PHP_EOL' => array(
112
+ '5.0.1' => false,
113
+ '5.0.2' => true,
114
+ ),
115
+
116
+ 'PHP_INT_MAX' => array(
117
+ '5.0.4' => false,
118
+ '5.0.5' => true,
119
+ ),
120
+ 'PHP_INT_SIZE' => array(
121
+ '5.0.4' => false,
122
+ '5.0.5' => true,
123
+ ),
124
+
125
+ '__COMPILER_HALT_OFFSET__' => array(
126
+ '5.0' => false,
127
+ '5.1' => true,
128
+ ),
129
+ 'GLOB_ERR' => array(
130
+ '5.0' => false,
131
+ '5.1' => true,
132
+ ),
133
+ // Curl:
134
+ 'CURLOPT_AUTOREFERER' => array(
135
+ '5.0' => false,
136
+ '5.1' => true,
137
+ ),
138
+ 'CURLOPT_BINARYTRANSFER' => array(
139
+ '5.0' => false,
140
+ '5.1' => true,
141
+ ),
142
+ 'CURLOPT_COOKIESESSION' => array(
143
+ '5.0' => false,
144
+ '5.1' => true,
145
+ ),
146
+ 'CURLOPT_FTPSSLAUTH' => array(
147
+ '5.0' => false,
148
+ '5.1' => true,
149
+ ),
150
+ 'CURLOPT_PROXYAUTH' => array(
151
+ '5.0' => false,
152
+ '5.1' => true,
153
+ ),
154
+ 'CURLOPT_TIMECONDITION' => array(
155
+ '5.0' => false,
156
+ '5.1' => true,
157
+ ),
158
+ // POSIX:
159
+ 'POSIX_F_OK' => array(
160
+ '5.0' => false,
161
+ '5.1' => true,
162
+ ),
163
+ 'POSIX_R_OK' => array(
164
+ '5.0' => false,
165
+ '5.1' => true,
166
+ ),
167
+ 'POSIX_W_OK' => array(
168
+ '5.0' => false,
169
+ '5.1' => true,
170
+ ),
171
+ 'POSIX_X_OK' => array(
172
+ '5.0' => false,
173
+ '5.1' => true,
174
+ ),
175
+ 'POSIX_S_IFBLK' => array(
176
+ '5.0' => false,
177
+ '5.1' => true,
178
+ ),
179
+ 'POSIX_S_IFCHR' => array(
180
+ '5.0' => false,
181
+ '5.1' => true,
182
+ ),
183
+ 'POSIX_S_IFIFO' => array(
184
+ '5.0' => false,
185
+ '5.1' => true,
186
+ ),
187
+ 'POSIX_S_IFREG' => array(
188
+ '5.0' => false,
189
+ '5.1' => true,
190
+ ),
191
+ 'POSIX_S_IFSOCK' => array(
192
+ '5.0' => false,
193
+ '5.1' => true,
194
+ ),
195
+ // Streams:
196
+ 'STREAM_IPPROTO_ICMP' => array(
197
+ '5.0' => false,
198
+ '5.1' => true,
199
+ ),
200
+ 'STREAM_IPPROTO_IP' => array(
201
+ '5.0' => false,
202
+ '5.1' => true,
203
+ ),
204
+ 'STREAM_IPPROTO_RAW' => array(
205
+ '5.0' => false,
206
+ '5.1' => true,
207
+ ),
208
+ 'STREAM_IPPROTO_TCP' => array(
209
+ '5.0' => false,
210
+ '5.1' => true,
211
+ ),
212
+ 'STREAM_IPPROTO_UDP' => array(
213
+ '5.0' => false,
214
+ '5.1' => true,
215
+ ),
216
+ 'STREAM_PF_INET' => array(
217
+ '5.0' => false,
218
+ '5.1' => true,
219
+ ),
220
+ 'STREAM_PF_INET6' => array(
221
+ '5.0' => false,
222
+ '5.1' => true,
223
+ ),
224
+ 'STREAM_PF_UNIX' => array(
225
+ '5.0' => false,
226
+ '5.1' => true,
227
+ ),
228
+ 'STREAM_SOCK_DGRAM' => array(
229
+ '5.0' => false,
230
+ '5.1' => true,
231
+ ),
232
+ 'STREAM_SOCK_RAW' => array(
233
+ '5.0' => false,
234
+ '5.1' => true,
235
+ ),
236
+ 'STREAM_SOCK_RDM' => array(
237
+ '5.0' => false,
238
+ '5.1' => true,
239
+ ),
240
+ 'STREAM_SOCK_SEQPACKET' => array(
241
+ '5.0' => false,
242
+ '5.1' => true,
243
+ ),
244
+ 'STREAM_SOCK_STREAM' => array(
245
+ '5.0' => false,
246
+ '5.1' => true,
247
+ ),
248
+ // Tokenizer:
249
+ 'T_HALT_COMPILER' => array(
250
+ '5.0' => false,
251
+ '5.1' => true,
252
+ ),
253
+
254
+ // Date/Time:
255
+ 'DATE_ATOM' => array(
256
+ '5.1.0' => false,
257
+ '5.1.1' => true,
258
+ ),
259
+ 'DATE_COOKIE' => array(
260
+ '5.1.0' => false,
261
+ '5.1.1' => true,
262
+ ),
263
+ 'DATE_ISO8601' => array(
264
+ '5.1.0' => false,
265
+ '5.1.1' => true,
266
+ ),
267
+ 'DATE_RFC822' => array(
268
+ '5.1.0' => false,
269
+ '5.1.1' => true,
270
+ ),
271
+ 'DATE_RFC850' => array(
272
+ '5.1.0' => false,
273
+ '5.1.1' => true,
274
+ ),
275
+ 'DATE_RFC1036' => array(
276
+ '5.1.0' => false,
277
+ '5.1.1' => true,
278
+ ),
279
+ 'DATE_RFC1123' => array(
280
+ '5.1.0' => false,
281
+ '5.1.1' => true,
282
+ ),
283
+ 'DATE_RFC2822' => array(
284
+ '5.1.0' => false,
285
+ '5.1.1' => true,
286
+ ),
287
+ 'DATE_RFC3339' => array(
288
+ '5.1.0' => false,
289
+ '5.1.1' => true,
290
+ ),
291
+ 'DATE_RSS' => array(
292
+ '5.1.0' => false,
293
+ '5.1.1' => true,
294
+ ),
295
+ 'DATE_W3C' => array(
296
+ '5.1.0' => false,
297
+ '5.1.1' => true,
298
+ ),
299
+
300
+ // Date/Time:
301
+ 'SUNFUNCS_RET_TIMESTAMP' => array(
302
+ '5.1.1' => false,
303
+ '5.1.2' => true,
304
+ ),
305
+ 'SUNFUNCS_RET_STRING' => array(
306
+ '5.1.1' => false,
307
+ '5.1.2' => true,
308
+ ),
309
+ 'SUNFUNCS_RET_DOUBLE' => array(
310
+ '5.1.1' => false,
311
+ '5.1.2' => true,
312
+ ),
313
+ // XSL:
314
+ 'LIBXSLT_VERSION' => array(
315
+ '5.1.1' => false,
316
+ '5.1.2' => true,
317
+ ),
318
+ 'LIBXSLT_DOTTED_VERSION' => array(
319
+ '5.1.1' => false,
320
+ '5.1.2' => true,
321
+ ),
322
+ 'LIBEXSLT_VERSION' => array(
323
+ '5.1.1' => false,
324
+ '5.1.2' => true,
325
+ ),
326
+ 'LIBEXSLT_DOTTED_VERSION' => array(
327
+ '5.1.1' => false,
328
+ '5.1.2' => true,
329
+ ),
330
+ // URL:
331
+ 'PHP_URL_SCHEME' => array(
332
+ '5.1.1' => false,
333
+ '5.1.2' => true,
334
+ ),
335
+ 'PHP_URL_HOST' => array(
336
+ '5.1.1' => false,
337
+ '5.1.2' => true,
338
+ ),
339
+ 'PHP_URL_PORT' => array(
340
+ '5.1.1' => false,
341
+ '5.1.2' => true,
342
+ ),
343
+ 'PHP_URL_USER' => array(
344
+ '5.1.1' => false,
345
+ '5.1.2' => true,
346
+ ),
347
+ 'PHP_URL_PASS' => array(
348
+ '5.1.1' => false,
349
+ '5.1.2' => true,
350
+ ),
351
+ 'PHP_URL_PATH' => array(
352
+ '5.1.1' => false,
353
+ '5.1.2' => true,
354
+ ),
355
+ 'PHP_URL_QUERY' => array(
356
+ '5.1.1' => false,
357
+ '5.1.2' => true,
358
+ ),
359
+ 'PHP_URL_FRAGMENT' => array(
360
+ '5.1.1' => false,
361
+ '5.1.2' => true,
362
+ ),
363
+ 'PHP_QUERY_RFC1738' => array(
364
+ '5.1.1' => false,
365
+ '5.1.2' => true,
366
+ ),
367
+ 'PHP_QUERY_RFC3986' => array(
368
+ '5.1.1' => false,
369
+ '5.1.2' => true,
370
+ ),
371
+
372
+ // Curl:
373
+ 'CURLINFO_HEADER_OUT' => array(
374
+ '5.1.2' => false,
375
+ '5.1.3' => true,
376
+ ),
377
+
378
+ // Core:
379
+ 'E_RECOVERABLE_ERROR' => array(
380
+ '5.1' => false,
381
+ '5.2' => true,
382
+ ),
383
+ // Math:
384
+ 'M_EULER' => array(
385
+ '5.1' => false,
386
+ '5.2' => true,
387
+ ),
388
+ 'M_LNPI' => array(
389
+ '5.1' => false,
390
+ '5.2' => true,
391
+ ),
392
+ 'M_SQRT3' => array(
393
+ '5.1' => false,
394
+ '5.2' => true,
395
+ ),
396
+ 'M_SQRTPI' => array(
397
+ '5.1' => false,
398
+ '5.2' => true,
399
+ ),
400
+ 'PATHINFO_FILENAME' => array(
401
+ '5.1' => false,
402
+ '5.2' => true,
403
+ ),
404
+ 'UPLOAD_ERR_EXTENSION' => array(
405
+ '5.1' => false,
406
+ '5.2' => true,
407
+ ),
408
+ // Curl:
409
+ 'CURLE_FILESIZE_EXCEEDED' => array(
410
+ '5.1' => false,
411
+ '5.2' => true,
412
+ ),
413
+ 'CURLE_FTP_SSL_FAILED' => array(
414
+ '5.1' => false,
415
+ '5.2' => true,
416
+ ),
417
+ 'CURLE_LDAP_INVALID_URL' => array(
418
+ '5.1' => false,
419
+ '5.2' => true,
420
+ ),
421
+ 'CURLFTPAUTH_DEFAULT' => array(
422
+ '5.1' => false,
423
+ '5.2' => true,
424
+ ),
425
+ 'CURLFTPAUTH_SSL' => array(
426
+ '5.1' => false,
427
+ '5.2' => true,
428
+ ),
429
+ 'CURLFTPAUTH_TLS' => array(
430
+ '5.1' => false,
431
+ '5.2' => true,
432
+ ),
433
+ 'CURLFTPSSL_ALL' => array(
434
+ '5.1' => false,
435
+ '5.2' => true,
436
+ ),
437
+ 'CURLFTPSSL_CONTROL' => array(
438
+ '5.1' => false,
439
+ '5.2' => true,
440
+ ),
441
+ 'CURLFTPSSL_NONE' => array(
442
+ '5.1' => false,
443
+ '5.2' => true,
444
+ ),
445
+ 'CURLFTPSSL_TRY' => array(
446
+ '5.1' => false,
447
+ '5.2' => true,
448
+ ),
449
+ 'CURLOPT_FTP_SSL' => array(
450
+ '5.1' => false,
451
+ '5.2' => true,
452
+ ),
453
+ // Ming:
454
+ 'SWFTEXTFIELD_USEFONT' => array(
455
+ '5.1' => false,
456
+ '5.2' => true,
457
+ ),
458
+ 'SWFTEXTFIELD_AUTOSIZE' => array(
459
+ '5.1' => false,
460
+ '5.2' => true,
461
+ ),
462
+ 'SWF_SOUND_NOT_COMPRESSED' => array(
463
+ '5.1' => false,
464
+ '5.2' => true,
465
+ ),
466
+ 'SWF_SOUND_ADPCM_COMPRESSED' => array(
467
+ '5.1' => false,
468
+ '5.2' => true,
469
+ ),
470
+ 'SWF_SOUND_MP3_COMPRESSED' => array(
471
+ '5.1' => false,
472
+ '5.2' => true,
473
+ ),
474
+ 'SWF_SOUND_NOT_COMPRESSED_LE' => array(
475
+ '5.1' => false,
476
+ '5.2' => true,
477
+ ),
478
+ 'SWF_SOUND_NELLY_COMPRESSED' => array(
479
+ '5.1' => false,
480
+ '5.2' => true,
481
+ ),
482
+ 'SWF_SOUND_5KHZ' => array(
483
+ '5.1' => false,
484
+ '5.2' => true,
485
+ ),
486
+ 'SWF_SOUND_11KHZ' => array(
487
+ '5.1' => false,
488
+ '5.2' => true,
489
+ ),
490
+ 'SWF_SOUND_22KHZ' => array(
491
+ '5.1' => false,
492
+ '5.2' => true,
493
+ ),
494
+ 'SWF_SOUND_44KHZ' => array(
495
+ '5.1' => false,
496
+ '5.2' => true,
497
+ ),
498
+ 'SWF_SOUND_8BITS' => array(
499
+ '5.1' => false,
500
+ '5.2' => true,
501
+ ),
502
+ 'SWF_SOUND_16BITS' => array(
503
+ '5.1' => false,
504
+ '5.2' => true,
505
+ ),
506
+ 'SWF_SOUND_MONO' => array(
507
+ '5.1' => false,
508
+ '5.2' => true,
509
+ ),
510
+ 'SWF_SOUND_STEREO' => array(
511
+ '5.1' => false,
512
+ '5.2' => true,
513
+ ),
514
+ // OpenSSL:
515
+ 'OPENSSL_KEYTYPE_EC' => array(
516
+ '5.1' => false,
517
+ '5.2' => true,
518
+ ),
519
+ 'OPENSSL_VERSION_NUMBER' => array(
520
+ '5.1' => false,
521
+ '5.2' => true,
522
+ ),
523
+ 'OPENSSL_VERSION_TEXT' => array(
524
+ '5.1' => false,
525
+ '5.2' => true,
526
+ ),
527
+ // PCRE:
528
+ 'PREG_BACKTRACK_LIMIT_ERROR' => array(
529
+ '5.1' => false,
530
+ '5.2' => true,
531
+ ),
532
+ 'PREG_BAD_UTF8_ERROR' => array(
533
+ '5.1' => false,
534
+ '5.2' => true,
535
+ ),
536
+ 'PREG_INTERNAL_ERROR' => array(
537
+ '5.1' => false,
538
+ '5.2' => true,
539
+ ),
540
+ 'PREG_NO_ERROR' => array(
541
+ '5.1' => false,
542
+ '5.2' => true,
543
+ ),
544
+ 'PREG_RECURSION_LIMIT_ERROR' => array(
545
+ '5.1' => false,
546
+ '5.2' => true,
547
+ ),
548
+ // Snmp:
549
+ 'SNMP_OID_OUTPUT_FULL' => array(
550
+ '5.1' => false,
551
+ '5.2' => true,
552
+ ),
553
+ 'SNMP_OID_OUTPUT_NUMERIC' => array(
554
+ '5.1' => false,
555
+ '5.2' => true,
556
+ ),
557
+ // Semaphore:
558
+ 'MSG_EAGAIN' => array(
559
+ '5.1' => false,
560
+ '5.2' => true,
561
+ ),
562
+ 'MSG_ENOMSG' => array(
563
+ '5.1' => false,
564
+ '5.2' => true,
565
+ ),
566
+
567
+ // Curl:
568
+ 'CURLOPT_TCP_NODELAY' => array(
569
+ '5.2.0' => false,
570
+ '5.2.1' => true,
571
+ ),
572
+
573
+ // Stream:
574
+ 'STREAM_SHUT_RD' => array(
575
+ '5.2.0' => false,
576
+ '5.2.1' => true,
577
+ ),
578
+ 'STREAM_SHUT_WR' => array(
579
+ '5.2.0' => false,
580
+ '5.2.1' => true,
581
+ ),
582
+ 'STREAM_SHUT_RDWR' => array(
583
+ '5.2.0' => false,
584
+ '5.2.1' => true,
585
+ ),
586
+
587
+ 'GMP_VERSION' => array(
588
+ '5.2.1' => false,
589
+ '5.2.2' => true,
590
+ ),
591
+
592
+ // Curl:
593
+ 'CURLOPT_TIMEOUT_MS' => array(
594
+ '5.2.2' => false,
595
+ '5.2.3' => true,
596
+ ),
597
+ 'CURLOPT_CONNECTTIMEOUT_MS' => array(
598
+ '5.2.2' => false,
599
+ '5.2.3' => true,
600
+ ),
601
+
602
+ // Curl:
603
+ 'CURLOPT_PRIVATE' => array(
604
+ '5.2.3' => false,
605
+ '5.2.4' => true,
606
+ ),
607
+ 'CURLINFO_PRIVATE' => array(
608
+ '5.2.3' => false,
609
+ '5.2.4' => true,
610
+ ),
611
+ // GD:
612
+ 'GD_VERSION' => array(
613
+ '5.2.3' => false,
614
+ '5.2.4' => true,
615
+ ),
616
+ 'GD_MAJOR_VERSION' => array(
617
+ '5.2.3' => false,
618
+ '5.2.4' => true,
619
+ ),
620
+ 'GD_MINOR_VERSION' => array(
621
+ '5.2.3' => false,
622
+ '5.2.4' => true,
623
+ ),
624
+ 'GD_RELEASE_VERSION' => array(
625
+ '5.2.3' => false,
626
+ '5.2.4' => true,
627
+ ),
628
+ 'GD_EXTRA_VERSION' => array(
629
+ '5.2.3' => false,
630
+ '5.2.4' => true,
631
+ ),
632
+ // PCRE:
633
+ 'PCRE_VERSION' => array(
634
+ '5.2.3' => false,
635
+ '5.2.4' => true,
636
+ ),
637
+
638
+ 'PHP_MAJOR_VERSION' => array(
639
+ '5.2.6' => false,
640
+ '5.2.7' => true,
641
+ ),
642
+ 'PHP_MINOR_VERSION' => array(
643
+ '5.2.6' => false,
644
+ '5.2.7' => true,
645
+ ),
646
+ 'PHP_RELEASE_VERSION' => array(
647
+ '5.2.6' => false,
648
+ '5.2.7' => true,
649
+ ),
650
+ 'PHP_VERSION_ID' => array(
651
+ '5.2.6' => false,
652
+ '5.2.7' => true,
653
+ ),
654
+ 'PHP_EXTRA_VERSION' => array(
655
+ '5.2.6' => false,
656
+ '5.2.7' => true,
657
+ ),
658
+ 'PHP_ZTS' => array(
659
+ '5.2.6' => false,
660
+ '5.2.7' => true,
661
+ ),
662
+ 'PHP_DEBUG' => array(
663
+ '5.2.6' => false,
664
+ '5.2.7' => true,
665
+ ),
666
+ 'FILE_BINARY' => array(
667
+ '5.2.6' => false,
668
+ '5.2.7' => true,
669
+ ),
670
+ 'FILE_TEXT' => array(
671
+ '5.2.6' => false,
672
+ '5.2.7' => true,
673
+ ),
674
+ // Sockets:
675
+ 'TCP_NODELAY' => array(
676
+ '5.2.6' => false,
677
+ '5.2.7' => true,
678
+ ),
679
+
680
+ // Curl:
681
+ 'CURLOPT_PROTOCOLS' => array(
682
+ '5.2.9' => false,
683
+ '5.2.10' => true,
684
+ ),
685
+ 'CURLOPT_REDIR_PROTOCOLS' => array(
686
+ '5.2.9' => false,
687
+ '5.2.10' => true,
688
+ ),
689
+ 'CURLPROXY_SOCKS4' => array(
690
+ '5.2.9' => false,
691
+ '5.2.10' => true,
692
+ ),
693
+
694
+ // Libxml:
695
+ 'LIBXML_PARSEHUGE' => array(
696
+ '5.2.11' => false,
697
+ '5.2.12' => true,
698
+ ),
699
+
700
+ // Core:
701
+ 'ENT_IGNORE' => array(
702
+ '5.2' => false,
703
+ '5.3' => true,
704
+ ),
705
+ 'E_DEPRECATED' => array(
706
+ '5.2' => false,
707
+ '5.3' => true,
708
+ ),
709
+ 'E_USER_DEPRECATED' => array(
710
+ '5.2' => false,
711
+ '5.3' => true,
712
+ ),
713
+ 'INI_SCANNER_NORMAL' => array(
714
+ '5.2' => false,
715
+ '5.3' => true,
716
+ ),
717
+ 'INI_SCANNER_RAW' => array(
718
+ '5.2' => false,
719
+ '5.3' => true,
720
+ ),
721
+ 'PHP_MAXPATHLEN' => array(
722
+ '5.2' => false,
723
+ '5.3' => true,
724
+ ),
725
+ 'PHP_WINDOWS_NT_DOMAIN_CONTROLLER' => array(
726
+ '5.2' => false,
727
+ '5.3' => true,
728
+ ),
729
+ 'PHP_WINDOWS_NT_SERVER' => array(
730
+ '5.2' => false,
731
+ '5.3' => true,
732
+ ),
733
+ 'PHP_WINDOWS_NT_WORKSTATION' => array(
734
+ '5.2' => false,
735
+ '5.3' => true,
736
+ ),
737
+ 'PHP_WINDOWS_VERSION_BUILD' => array(
738
+ '5.2' => false,
739
+ '5.3' => true,
740
+ ),
741
+ 'PHP_WINDOWS_VERSION_MAJOR' => array(
742
+ '5.2' => false,
743
+ '5.3' => true,
744
+ ),
745
+ 'PHP_WINDOWS_VERSION_MINOR' => array(
746
+ '5.2' => false,
747
+ '5.3' => true,
748
+ ),
749
+ 'PHP_WINDOWS_VERSION_PLATFORM' => array(
750
+ '5.2' => false,
751
+ '5.3' => true,
752
+ ),
753
+ 'PHP_WINDOWS_VERSION_PRODUCTTYPE' => array(
754
+ '5.2' => false,
755
+ '5.3' => true,
756
+ ),
757
+ 'PHP_WINDOWS_VERSION_SP_MAJOR' => array(
758
+ '5.2' => false,
759
+ '5.3' => true,
760
+ ),
761
+ 'PHP_WINDOWS_VERSION_SP_MINOR' => array(
762
+ '5.2' => false,
763
+ '5.3' => true,
764
+ ),
765
+ 'PHP_WINDOWS_VERSION_SUITEMASK' => array(
766
+ '5.2' => false,
767
+ '5.3' => true,
768
+ ),
769
+ // Curl:
770
+ 'CURLINFO_CERTINFO' => array(
771
+ '5.2' => false,
772
+ '5.3' => true,
773
+ ),
774
+ 'CURLOPT_PROGRESSFUNCTION' => array(
775
+ '5.2' => false,
776
+ '5.3' => true,
777
+ ),
778
+ 'CURLE_SSH' => array(
779
+ '5.2' => false,
780
+ '5.3' => true,
781
+ ),
782
+ // GD:
783
+ 'IMG_FILTER_PIXELATE' => array(
784
+ '5.2' => false,
785
+ '5.3' => true,
786
+ ),
787
+ 'IMAGETYPE_ICO' => array(
788
+ '5.2' => false,
789
+ '5.3' => true,
790
+ ),
791
+ // Fileinfo:
792
+ 'FILEINFO_MIME_TYPE' => array(
793
+ '5.2' => false,
794
+ '5.3' => true,
795
+ ),
796
+ 'FILEINFO_MIME_ENCODING' => array(
797
+ '5.2' => false,
798
+ '5.3' => true,
799
+ ),
800
+ // JSON:
801
+ 'JSON_ERROR_CTRL_CHAR' => array(
802
+ '5.2' => false,
803
+ '5.3' => true,
804
+ ),
805
+ 'JSON_ERROR_DEPTH' => array(
806
+ '5.2' => false,
807
+ '5.3' => true,
808
+ ),
809
+ 'JSON_ERROR_NONE' => array(
810
+ '5.2' => false,
811
+ '5.3' => true,
812
+ ),
813
+ 'JSON_ERROR_STATE_MISMATCH' => array(
814
+ '5.2' => false,
815
+ '5.3' => true,
816
+ ),
817
+ 'JSON_ERROR_SYNTAX' => array(
818
+ '5.2' => false,
819
+ '5.3' => true,
820
+ ),
821
+ 'JSON_FORCE_OBJECT' => array(
822
+ '5.2' => false,
823
+ '5.3' => true,
824
+ ),
825
+ 'JSON_HEX_TAG' => array(
826
+ '5.2' => false,
827
+ '5.3' => true,
828
+ ),
829
+ 'JSON_HEX_AMP' => array(
830
+ '5.2' => false,
831
+ '5.3' => true,
832
+ ),
833
+ 'JSON_HEX_APOS' => array(
834
+ '5.2' => false,
835
+ '5.3' => true,
836
+ ),
837
+ 'JSON_HEX_QUOT' => array(
838
+ '5.2' => false,
839
+ '5.3' => true,
840
+ ),
841
+ // LDAP:
842
+ 'LDAP_OPT_NETWORK_TIMEOUT' => array(
843
+ '5.2' => false,
844
+ '5.3' => true,
845
+ ),
846
+ // Libxml:
847
+ 'LIBXML_LOADED_VERSION' => array(
848
+ '5.2' => false,
849
+ '5.3' => true,
850
+ ),
851
+ // Math:
852
+ 'PHP_ROUND_HALF_UP' => array(
853
+ '5.2' => false,
854
+ '5.3' => true,
855
+ ),
856
+ 'PHP_ROUND_HALF_DOWN' => array(
857
+ '5.2' => false,
858
+ '5.3' => true,
859
+ ),
860
+ 'PHP_ROUND_HALF_EVEN' => array(
861
+ '5.2' => false,
862
+ '5.3' => true,
863
+ ),
864
+ 'PHP_ROUND_HALF_ODD' => array(
865
+ '5.2' => false,
866
+ '5.3' => true,
867
+ ),
868
+ // Mysqli
869
+ 'MYSQLI_OPT_INT_AND_FLOAT_NATIVE' => array(
870
+ '5.2' => false,
871
+ '5.3' => true,
872
+ ),
873
+ 'MYSQLI_OPT_NET_CMD_BUFFER_SIZE' => array(
874
+ '5.2' => false,
875
+ '5.3' => true,
876
+ ),
877
+ 'MYSQLI_OPT_NET_READ_BUFFER_SIZE' => array(
878
+ '5.2' => false,
879
+ '5.3' => true,
880
+ ),
881
+ 'MYSQLI_OPT_SSL_VERIFY_SERVER_CERT' => array(
882
+ '5.2' => false,
883
+ '5.3' => true,
884
+ ),
885
+ // OCI8:
886
+ 'OCI_CRED_EXT' => array(
887
+ '5.2' => false,
888
+ '5.3' => true,
889
+ ),
890
+ // PCRE:
891
+ 'PREG_BAD_UTF8_OFFSET_ERROR' => array(
892
+ '5.2' => false,
893
+ '5.3' => true,
894
+ ),
895
+ // PCNTL:
896
+ 'BUS_ADRALN' => array(
897
+ '5.2' => false,
898
+ '5.3' => true,
899
+ ),
900
+ 'BUS_ADRERR' => array(
901
+ '5.2' => false,
902
+ '5.3' => true,
903
+ ),
904
+ 'BUS_OBJERR' => array(
905
+ '5.2' => false,
906
+ '5.3' => true,
907
+ ),
908
+ 'CLD_CONTIUNED' => array(
909
+ '5.2' => false,
910
+ '5.3' => true,
911
+ ),
912
+ 'CLD_DUMPED' => array(
913
+ '5.2' => false,
914
+ '5.3' => true,
915
+ ),
916
+ 'CLD_EXITED' => array(
917
+ '5.2' => false,
918
+ '5.3' => true,
919
+ ),
920
+ 'CLD_KILLED' => array(
921
+ '5.2' => false,
922
+ '5.3' => true,
923
+ ),
924
+ 'CLD_STOPPED' => array(
925
+ '5.2' => false,
926
+ '5.3' => true,
927
+ ),
928
+ 'CLD_TRAPPED' => array(
929
+ '5.2' => false,
930
+ '5.3' => true,
931
+ ),
932
+ 'FPE_FLTDIV' => array(
933
+ '5.2' => false,
934
+ '5.3' => true,
935
+ ),
936
+ 'FPE_FLTINV' => array(
937
+ '5.2' => false,
938
+ '5.3' => true,
939
+ ),
940
+ 'FPE_FLTOVF' => array(
941
+ '5.2' => false,
942
+ '5.3' => true,
943
+ ),
944
+ 'FPE_FLTRES' => array(
945
+ '5.2' => false,
946
+ '5.3' => true,
947
+ ),
948
+ 'FPE_FLTSUB' => array(
949
+ '5.2' => false,
950
+ '5.3' => true,
951
+ ),
952
+ 'FPE_FLTUND' => array(
953
+ '5.2' => false,
954
+ '5.3' => true,
955
+ ),
956
+ 'FPE_INTDIV' => array(
957
+ '5.2' => false,
958
+ '5.3' => true,
959
+ ),
960
+ 'FPE_INTOVF' => array(
961
+ '5.2' => false,
962
+ '5.3' => true,
963
+ ),
964
+ 'ILL_BADSTK' => array(
965
+ '5.2' => false,
966
+ '5.3' => true,
967
+ ),
968
+ 'ILL_COPROC' => array(
969
+ '5.2' => false,
970
+ '5.3' => true,
971
+ ),
972
+ 'ILL_ILLADR' => array(
973
+ '5.2' => false,
974
+ '5.3' => true,
975
+ ),
976
+ 'ILL_ILLOPC' => array(
977
+ '5.2' => false,
978
+ '5.3' => true,
979
+ ),
980
+ 'ILL_ILLOPN' => array(
981
+ '5.2' => false,
982
+ '5.3' => true,
983
+ ),
984
+ 'ILL_ILLTRP' => array(
985
+ '5.2' => false,
986
+ '5.3' => true,
987
+ ),
988
+ 'ILL_PRVOPC' => array(
989
+ '5.2' => false,
990
+ '5.3' => true,
991
+ ),
992
+ 'ILL_PRVREG' => array(
993
+ '5.2' => false,
994
+ '5.3' => true,
995
+ ),
996
+ 'POLL_ERR' => array(
997
+ '5.2' => false,
998
+ '5.3' => true,
999
+ ),
1000
+ 'POLL_HUP' => array(
1001
+ '5.2' => false,
1002
+ '5.3' => true,
1003
+ ),
1004
+ 'POLL_IN' => array(
1005
+ '5.2' => false,
1006
+ '5.3' => true,
1007
+ ),
1008
+ 'POLL_MSG' => array(
1009
+ '5.2' => false,
1010
+ '5.3' => true,
1011
+ ),
1012
+ 'POLL_OUT' => array(
1013
+ '5.2' => false,
1014
+ '5.3' => true,
1015
+ ),
1016
+ 'POLL_PRI' => array(
1017
+ '5.2' => false,
1018
+ '5.3' => true,
1019
+ ),
1020
+ 'SEGV_ACCERR' => array(
1021
+ '5.2' => false,
1022
+ '5.3' => true,
1023
+ ),
1024
+ 'SEGV_MAPERR' => array(
1025
+ '5.2' => false,
1026
+ '5.3' => true,
1027
+ ),
1028
+ 'SI_ASYNCIO' => array(
1029
+ '5.2' => false,
1030
+ '5.3' => true,
1031
+ ),
1032
+ 'SI_KERNEL' => array(
1033
+ '5.2' => false,
1034
+ '5.3' => true,
1035
+ ),
1036
+ 'SI_MSGGQ' => array(
1037
+ '5.2' => false,
1038
+ '5.3' => true,
1039
+ ),
1040
+ 'SI_NOINFO' => array(
1041
+ '5.2' => false,
1042
+ '5.3' => true,
1043
+ ),
1044
+ 'SI_QUEUE' => array(
1045
+ '5.2' => false,
1046
+ '5.3' => true,
1047
+ ),
1048
+ 'SI_SIGIO' => array(
1049
+ '5.2' => false,
1050
+ '5.3' => true,
1051
+ ),
1052
+ 'SI_TIMER' => array(
1053
+ '5.2' => false,
1054
+ '5.3' => true,
1055
+ ),
1056
+ 'SI_TKILL' => array(
1057
+ '5.2' => false,
1058
+ '5.3' => true,
1059
+ ),
1060
+ 'SI_USER' => array(
1061
+ '5.2' => false,
1062
+ '5.3' => true,
1063
+ ),
1064
+ 'SIG_BLOCK' => array(
1065
+ '5.2' => false,
1066
+ '5.3' => true,
1067
+ ),
1068
+ 'SIG_SETMASK' => array(
1069
+ '5.2' => false,
1070
+ '5.3' => true,
1071
+ ),
1072
+ 'SIG_UNBLOCK' => array(
1073
+ '5.2' => false,
1074
+ '5.3' => true,
1075
+ ),
1076
+ 'TRAP_BRKPT' => array(
1077
+ '5.2' => false,
1078
+ '5.3' => true,
1079
+ ),
1080
+ 'TRAP_TRACE' => array(
1081
+ '5.2' => false,
1082
+ '5.3' => true,
1083
+ ),
1084
+ // Tokenizer:
1085
+ 'T_DIR' => array(
1086
+ '5.2' => false,
1087
+ '5.3' => true,
1088
+ ),
1089
+ 'T_GOTO' => array(
1090
+ '5.2' => false,
1091
+ '5.3' => true,
1092
+ ),
1093
+ 'T_NAMESPACE' => array(
1094
+ '5.2' => false,
1095
+ '5.3' => true,
1096
+ ),
1097
+ 'T_NS_C' => array(
1098
+ '5.2' => false,
1099
+ '5.3' => true,
1100
+ ),
1101
+ 'T_NS_SEPARATOR' => array(
1102
+ '5.2' => false,
1103
+ '5.3' => true,
1104
+ ),
1105
+ 'T_USE' => array(
1106
+ '5.2' => false,
1107
+ '5.3' => true,
1108
+ ),
1109
+
1110
+ // OCI8:
1111
+ 'OCI_NO_AUTO_COMMIT' => array(
1112
+ '5.3.1' => false,
1113
+ '5.3.2' => true,
1114
+ ),
1115
+ // OpenSSL:
1116
+ 'OPENSSL_TLSEXT_SERVER_NAME' => array(
1117
+ '5.3.1' => false,
1118
+ '5.3.2' => true,
1119
+ ),
1120
+
1121
+ // JSON:
1122
+ 'JSON_ERROR_UTF8' => array(
1123
+ '5.3.2' => false,
1124
+ '5.3.3' => true,
1125
+ ),
1126
+ 'JSON_NUMERIC_CHECK' => array(
1127
+ '5.3.2' => false,
1128
+ '5.3.3' => true,
1129
+ ),
1130
+
1131
+ 'DEBUG_BACKTRACE_IGNORE_ARGS' => array(
1132
+ '5.3.5' => false,
1133
+ '5.3.6' => true,
1134
+ ),
1135
+
1136
+ 'CURLINFO_REDIRECT_URL' => array(
1137
+ '5.3.6' => false,
1138
+ '5.3.7' => true,
1139
+ ),
1140
+ 'PHP_MANDIR' => array(
1141
+ '5.3.6' => false,
1142
+ '5.3.7' => true,
1143
+ ),
1144
+
1145
+ 'PHP_BINARY' => array(
1146
+ '5.3' => false,
1147
+ '5.4' => true,
1148
+ ),
1149
+ 'SORT_NATURAL' => array(
1150
+ '5.3' => false,
1151
+ '5.4' => true,
1152
+ ),
1153
+ 'SORT_FLAG_CASE' => array(
1154
+ '5.3' => false,
1155
+ '5.4' => true,
1156
+ ),
1157
+ 'ENT_HTML401' => array(
1158
+ '5.3' => false,
1159
+ '5.4' => true,
1160
+ ),
1161
+ 'ENT_XML1' => array(
1162
+ '5.3' => false,
1163
+ '5.4' => true,
1164
+ ),
1165
+ 'ENT_XHTML' => array(
1166
+ '5.3' => false,
1167
+ '5.4' => true,
1168
+ ),
1169
+ 'ENT_HTML5' => array(
1170
+ '5.3' => false,
1171
+ '5.4' => true,
1172
+ ),
1173
+ 'ENT_SUBSTITUTE' => array(
1174
+ '5.3' => false,
1175
+ '5.4' => true,
1176
+ ),
1177
+ 'ENT_DISALLOWED' => array(
1178
+ '5.3' => false,
1179
+ '5.4' => true,
1180
+ ),
1181
+ 'IPPROTO_IP' => array(
1182
+ '5.3' => false,
1183
+ '5.4' => true,
1184
+ ),
1185
+ 'IPPROTO_IPV6' => array(
1186
+ '5.3' => false,
1187
+ '5.4' => true,
1188
+ ),
1189
+ 'IPV6_MULTICAST_HOPS' => array(
1190
+ '5.3' => false,
1191
+ '5.4' => true,
1192
+ ),
1193
+ 'IPV6_MULTICAST_IF' => array(
1194
+ '5.3' => false,
1195
+ '5.4' => true,
1196
+ ),
1197
+ 'IPV6_MULTICAST_LOOP' => array(
1198
+ '5.3' => false,
1199
+ '5.4' => true,
1200
+ ),
1201
+ 'IP_MULTICAST_IF' => array(
1202
+ '5.3' => false,
1203
+ '5.4' => true,
1204
+ ),
1205
+ 'IP_MULTICAST_LOOP' => array(
1206
+ '5.3' => false,
1207
+ '5.4' => true,
1208
+ ),
1209
+ 'IP_MULTICAST_TTL' => array(
1210
+ '5.3' => false,
1211
+ '5.4' => true,
1212
+ ),
1213
+ 'MCAST_JOIN_GROUP' => array(
1214
+ '5.3' => false,
1215
+ '5.4' => true,
1216
+ ),
1217
+ 'MCAST_LEAVE_GROUP' => array(
1218
+ '5.3' => false,
1219
+ '5.4' => true,
1220
+ ),
1221
+ 'MCAST_BLOCK_SOURCE' => array(
1222
+ '5.3' => false,
1223
+ '5.4' => true,
1224
+ ),
1225
+ 'MCAST_UNBLOCK_SOURCE' => array(
1226
+ '5.3' => false,
1227
+ '5.4' => true,
1228
+ ),
1229
+ 'MCAST_JOIN_SOURCE_GROUP' => array(
1230
+ '5.3' => false,
1231
+ '5.4' => true,
1232
+ ),
1233
+ 'MCAST_LEAVE_SOURCE_GROUP' => array(
1234
+ '5.3' => false,
1235
+ '5.4' => true,
1236
+ ),
1237
+ // Curl:
1238
+ 'CURLOPT_MAX_RECV_SPEED_LARGE' => array(
1239
+ '5.3' => false,
1240
+ '5.4' => true,
1241
+ ),
1242
+ 'CURLOPT_MAX_SEND_SPEED_LARGE' => array(
1243
+ '5.3' => false,
1244
+ '5.4' => true,
1245
+ ),
1246
+ // Directories:
1247
+ 'SCANDIR_SORT_ASCENDING' => array(
1248
+ '5.3' => false,
1249
+ '5.4' => true,
1250
+ ),
1251
+ 'SCANDIR_SORT_DESCENDING' => array(
1252
+ '5.3' => false,
1253
+ '5.4' => true,
1254
+ ),
1255
+ 'SCANDIR_SORT_NONE' => array(
1256
+ '5.3' => false,
1257
+ '5.4' => true,
1258
+ ),
1259
+ // LibXML:
1260
+ 'LIBXML_HTML_NODEFDTD' => array(
1261
+ '5.3' => false,
1262
+ '5.4' => true,
1263
+ ),
1264
+ 'LIBXML_HTML_NOIMPLIED' => array(
1265
+ '5.3' => false,
1266
+ '5.4' => true,
1267
+ ),
1268
+ 'LIBXML_PEDANTIC' => array(
1269
+ '5.3' => false,
1270
+ '5.4' => true,
1271
+ ),
1272
+ // OpenSSL:
1273
+ 'OPENSSL_CIPHER_AES_128_CBC' => array(
1274
+ '5.3' => false,
1275
+ '5.4' => true,
1276
+ ),
1277
+ 'OPENSSL_CIPHER_AES_192_CBC' => array(
1278
+ '5.3' => false,
1279
+ '5.4' => true,
1280
+ ),
1281
+ 'OPENSSL_CIPHER_AES_256_CBC' => array(
1282
+ '5.3' => false,
1283
+ '5.4' => true,
1284
+ ),
1285
+ 'OPENSSL_RAW_DATA' => array(
1286
+ '5.3' => false,
1287
+ '5.4' => true,
1288
+ ),
1289
+ 'OPENSSL_ZERO_PADDING' => array(
1290
+ '5.3' => false,
1291
+ '5.4' => true,
1292
+ ),
1293
+ // Output buffering:
1294
+ 'PHP_OUTPUT_HANDLER_CLEAN' => array(
1295
+ '5.3' => false,
1296
+ '5.4' => true,
1297
+ ),
1298
+ 'PHP_OUTPUT_HANDLER_CLEANABLE' => array(
1299
+ '5.3' => false,
1300
+ '5.4' => true,
1301
+ ),
1302
+ 'PHP_OUTPUT_HANDLER_DISABLED' => array(
1303
+ '5.3' => false,
1304
+ '5.4' => true,
1305
+ ),
1306
+ 'PHP_OUTPUT_HANDLER_FINAL' => array(
1307
+ '5.3' => false,
1308
+ '5.4' => true,
1309
+ ),
1310
+ 'PHP_OUTPUT_HANDLER_FLUSH' => array(
1311
+ '5.3' => false,
1312
+ '5.4' => true,
1313
+ ),
1314
+ 'PHP_OUTPUT_HANDLER_FLUSHABLE' => array(
1315
+ '5.3' => false,
1316
+ '5.4' => true,
1317
+ ),
1318
+ 'PHP_OUTPUT_HANDLER_REMOVABLE' => array(
1319
+ '5.3' => false,
1320
+ '5.4' => true,
1321
+ ),
1322
+ 'PHP_OUTPUT_HANDLER_STARTED' => array(
1323
+ '5.3' => false,
1324
+ '5.4' => true,
1325
+ ),
1326
+ 'PHP_OUTPUT_HANDLER_STDFLAGS' => array(
1327
+ '5.3' => false,
1328
+ '5.4' => true,
1329
+ ),
1330
+ 'PHP_OUTPUT_HANDLER_WRITE' => array(
1331
+ '5.3' => false,
1332
+ '5.4' => true,
1333
+ ),
1334
+ // Sessions:
1335
+ 'PHP_SESSION_ACTIVE' => array(
1336
+ '5.3' => false,
1337
+ '5.4' => true,
1338
+ ),
1339
+ 'PHP_SESSION_DISABLED' => array(
1340
+ '5.3' => false,
1341
+ '5.4' => true,
1342
+ ),
1343
+ 'PHP_SESSION_NONE' => array(
1344
+ '5.3' => false,
1345
+ '5.4' => true,
1346
+ ),
1347
+ // Streams:
1348
+ 'STREAM_META_ACCESS' => array(
1349
+ '5.3' => false,
1350
+ '5.4' => true,
1351
+ ),
1352
+ 'STREAM_META_GROUP' => array(
1353
+ '5.3' => false,
1354
+ '5.4' => true,
1355
+ ),
1356
+ 'STREAM_META_GROUP_NAME' => array(
1357
+ '5.3' => false,
1358
+ '5.4' => true,
1359
+ ),
1360
+ 'STREAM_META_OWNER' => array(
1361
+ '5.3' => false,
1362
+ '5.4' => true,
1363
+ ),
1364
+ 'STREAM_META_OWNER_NAME' => array(
1365
+ '5.3' => false,
1366
+ '5.4' => true,
1367
+ ),
1368
+ 'STREAM_META_TOUCH' => array(
1369
+ '5.3' => false,
1370
+ '5.4' => true,
1371
+ ),
1372
+ // Intl:
1373
+ 'U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR' => array(
1374
+ '5.3' => false,
1375
+ '5.4' => true,
1376
+ ),
1377
+ 'IDNA_CHECK_BIDI' => array(
1378
+ '5.3' => false,
1379
+ '5.4' => true,
1380
+ ),
1381
+ 'IDNA_CHECK_CONTEXTJ' => array(
1382
+ '5.3' => false,
1383
+ '5.4' => true,
1384
+ ),
1385
+ 'IDNA_NONTRANSITIONAL_TO_ASCII' => array(
1386
+ '5.3' => false,
1387
+ '5.4' => true,
1388
+ ),
1389
+ 'IDNA_NONTRANSITIONAL_TO_UNICODE' => array(
1390
+ '5.3' => false,
1391
+ '5.4' => true,
1392
+ ),
1393
+ 'INTL_IDNA_VARIANT_2003' => array(
1394
+ '5.3' => false,
1395
+ '5.4' => true,
1396
+ ),
1397
+ 'INTL_IDNA_VARIANT_UTS46' => array(
1398
+ '5.3' => false,
1399
+ '5.4' => true,
1400
+ ),
1401
+ 'IDNA_ERROR_EMPTY_LABEL' => array(
1402
+ '5.3' => false,
1403
+ '5.4' => true,
1404
+ ),
1405
+ 'IDNA_ERROR_LABEL_TOO_LONG' => array(
1406
+ '5.3' => false,
1407
+ '5.4' => true,
1408
+ ),
1409
+ 'IDNA_ERROR_DOMAIN_NAME_TOO_LONG' => array(
1410
+ '5.3' => false,
1411
+ '5.4' => true,
1412
+ ),
1413
+ 'IDNA_ERROR_LEADING_HYPHEN' => array(
1414
+ '5.3' => false,
1415
+ '5.4' => true,
1416
+ ),
1417
+ 'IDNA_ERROR_TRAILING_HYPHEN' => array(
1418
+ '5.3' => false,
1419
+ '5.4' => true,
1420
+ ),
1421
+ 'IDNA_ERROR_HYPHEN_3_4' => array(
1422
+ '5.3' => false,
1423
+ '5.4' => true,
1424
+ ),
1425
+ 'IDNA_ERROR_LEADING_COMBINING_MARK' => array(
1426
+ '5.3' => false,
1427
+ '5.4' => true,
1428
+ ),
1429
+ 'IDNA_ERROR_DISALLOWED' => array(
1430
+ '5.3' => false,
1431
+ '5.4' => true,
1432
+ ),
1433
+ 'IDNA_ERROR_PUNYCODE' => array(
1434
+ '5.3' => false,
1435
+ '5.4' => true,
1436
+ ),
1437
+ 'IDNA_ERROR_LABEL_HAS_DOT' => array(
1438
+ '5.3' => false,
1439
+ '5.4' => true,
1440
+ ),
1441
+ 'IDNA_ERROR_INVALID_ACE_LABEL' => array(
1442
+ '5.3' => false,
1443
+ '5.4' => true,
1444
+ ),
1445
+ 'IDNA_ERROR_BIDI' => array(
1446
+ '5.3' => false,
1447
+ '5.4' => true,
1448
+ ),
1449
+ 'IDNA_ERROR_CONTEXTJ' => array(
1450
+ '5.3' => false,
1451
+ '5.4' => true,
1452
+ ),
1453
+ // Json:
1454
+ 'JSON_PRETTY_PRINT' => array(
1455
+ '5.3' => false,
1456
+ '5.4' => true,
1457
+ ),
1458
+ 'JSON_UNESCAPED_SLASHES' => array(
1459
+ '5.3' => false,
1460
+ '5.4' => true,
1461
+ ),
1462
+ 'JSON_UNESCAPED_UNICODE' => array(
1463
+ '5.3' => false,
1464
+ '5.4' => true,
1465
+ ),
1466
+ 'JSON_BIGINT_AS_STRING' => array(
1467
+ '5.3' => false,
1468
+ '5.4' => true,
1469
+ ),
1470
+ 'JSON_OBJECT_AS_ARRAY' => array(
1471
+ '5.3' => false,
1472
+ '5.4' => true,
1473
+ ),
1474
+ // Snmp:
1475
+ 'SNMP_OID_OUTPUT_SUFFIX' => array(
1476
+ '5.3' => false,
1477
+ '5.4' => true,
1478
+ ),
1479
+ 'SNMP_OID_OUTPUT_MODULE' => array(
1480
+ '5.3' => false,
1481
+ '5.4' => true,
1482
+ ),
1483
+ 'SNMP_OID_OUTPUT_UCD' => array(
1484
+ '5.3' => false,
1485
+ '5.4' => true,
1486
+ ),
1487
+ 'SNMP_OID_OUTPUT_NONE' => array(
1488
+ '5.3' => false,
1489
+ '5.4' => true,
1490
+ ),
1491
+ // Tokenizer:
1492
+ 'T_INSTEADOF' => array(
1493
+ '5.3' => false,
1494
+ '5.4' => true,
1495
+ ),
1496
+ 'T_TRAIT' => array(
1497
+ '5.3' => false,
1498
+ '5.4' => true,
1499
+ ),
1500
+ 'T_TRAIT_C' => array(
1501
+ '5.3' => false,
1502
+ '5.4' => true,
1503
+ ),
1504
+
1505
+ // Curl:
1506
+ 'CURLINFO_PRIMARY_IP' => array(
1507
+ '5.4.6' => false,
1508
+ '5.4.7' => true,
1509
+ ),
1510
+ 'CURLINFO_PRIMARY_PORT' => array(
1511
+ '5.4.6' => false,
1512
+ '5.4.7' => true,
1513
+ ),
1514
+ 'CURLINFO_LOCAL_IP' => array(
1515
+ '5.4.6' => false,
1516
+ '5.4.7' => true,
1517
+ ),
1518
+ 'CURLINFO_LOCAL_PORT' => array(
1519
+ '5.4.6' => false,
1520
+ '5.4.7' => true,
1521
+ ),
1522
+
1523
+ // OpenSSL:
1524
+ 'OPENSSL_ALGO_RMD160' => array(
1525
+ '5.4.7' => false,
1526
+ '5.4.8' => true,
1527
+ ),
1528
+ 'OPENSSL_ALGO_SHA224' => array(
1529
+ '5.4.7' => false,
1530
+ '5.4.8' => true,
1531
+ ),
1532
+ 'OPENSSL_ALGO_SHA256' => array(
1533
+ '5.4.7' => false,
1534
+ '5.4.8' => true,
1535
+ ),
1536
+ 'OPENSSL_ALGO_SHA384' => array(
1537
+ '5.4.7' => false,
1538
+ '5.4.8' => true,
1539
+ ),
1540
+ 'OPENSSL_ALGO_SHA512' => array(
1541
+ '5.4.7' => false,
1542
+ '5.4.8' => true,
1543
+ ),
1544
+
1545
+ // Filter:
1546
+ 'FILTER_VALIDATE_MAC' => array(
1547
+ '5.4' => false,
1548
+ '5.5' => true,
1549
+ ),
1550
+ // GD
1551
+ 'IMG_AFFINE_TRANSLATE' => array(
1552
+ '5.4' => false,
1553
+ '5.5' => true,
1554
+ ),
1555
+ 'IMG_AFFINE_SCALE' => array(
1556
+ '5.4' => false,
1557
+ '5.5' => true,
1558
+ ),
1559
+ 'IMG_AFFINE_ROTATE' => array(
1560
+ '5.4' => false,
1561
+ '5.5' => true,
1562
+ ),
1563
+ 'IMG_AFFINE_SHEAR_HORIZONTAL' => array(
1564
+ '5.4' => false,
1565
+ '5.5' => true,
1566
+ ),
1567
+ 'IMG_AFFINE_SHEAR_VERTICAL' => array(
1568
+ '5.4' => false,
1569
+ '5.5' => true,
1570
+ ),
1571
+ 'IMG_CROP_DEFAULT' => array(
1572
+ '5.4' => false,
1573
+ '5.5' => true,
1574
+ ),
1575
+ 'IMG_CROP_TRANSPARENT' => array(
1576
+ '5.4' => false,
1577
+ '5.5' => true,
1578
+ ),
1579
+ 'IMG_CROP_BLACK' => array(
1580
+ '5.4' => false,
1581
+ '5.5' => true,
1582
+ ),
1583
+ 'IMG_CROP_WHITE' => array(
1584
+ '5.4' => false,
1585
+ '5.5' => true,
1586
+ ),
1587
+ 'IMG_CROP_SIDES' => array(
1588
+ '5.4' => false,
1589
+ '5.5' => true,
1590
+ ),
1591
+ 'IMG_FLIP_BOTH' => array(
1592
+ '5.4' => false,
1593
+ '5.5' => true,
1594
+ ),
1595
+ 'IMG_FLIP_HORIZONTAL' => array(
1596
+ '5.4' => false,
1597
+ '5.5' => true,
1598
+ ),
1599
+ 'IMG_FLIP_VERTICAL' => array(
1600
+ '5.4' => false,
1601
+ '5.5' => true,
1602
+ ),
1603
+ 'IMG_BELL' => array(
1604
+ '5.4' => false,
1605
+ '5.5' => true,
1606
+ ),
1607
+ 'IMG_BESSEL' => array(
1608
+ '5.4' => false,
1609
+ '5.5' => true,
1610
+ ),
1611
+ 'IMG_BILINEAR_FIXED' => array(
1612
+ '5.4' => false,
1613
+ '5.5' => true,
1614
+ ),
1615
+ 'IMG_BICUBIC' => array(
1616
+ '5.4' => false,
1617
+ '5.5' => true,
1618
+ ),
1619
+ 'IMG_BICUBIC_FIXED' => array(
1620
+ '5.4' => false,
1621
+ '5.5' => true,
1622
+ ),
1623
+ 'IMG_BLACKMAN' => array(
1624
+ '5.4' => false,
1625
+ '5.5' => true,
1626
+ ),
1627
+ 'IMG_BOX' => array(
1628
+ '5.4' => false,
1629
+ '5.5' => true,
1630
+ ),
1631
+ 'IMG_BSPLINE' => array(
1632
+ '5.4' => false,
1633
+ '5.5' => true,
1634
+ ),
1635
+ 'IMG_CATMULLROM' => array(
1636
+ '5.4' => false,
1637
+ '5.5' => true,
1638
+ ),
1639
+ 'IMG_GAUSSIAN' => array(
1640
+ '5.4' => false,
1641
+ '5.5' => true,
1642
+ ),
1643
+ 'IMG_GENERALIZED_CUBIC' => array(
1644
+ '5.4' => false,
1645
+ '5.5' => true,
1646
+ ),
1647
+ 'IMG_HERMITE' => array(
1648
+ '5.4' => false,
1649
+ '5.5' => true,
1650
+ ),
1651
+ 'IMG_HAMMING' => array(
1652
+ '5.4' => false,
1653
+ '5.5' => true,
1654
+ ),
1655
+ 'IMG_HANNING' => array(
1656
+ '5.4' => false,
1657
+ '5.5' => true,
1658
+ ),
1659
+ 'IMG_MITCHELL' => array(
1660
+ '5.4' => false,
1661
+ '5.5' => true,
1662
+ ),
1663
+ 'IMG_POWER' => array(
1664
+ '5.4' => false,
1665
+ '5.5' => true,
1666
+ ),
1667
+ 'IMG_QUADRATIC' => array(
1668
+ '5.4' => false,
1669
+ '5.5' => true,
1670
+ ),
1671
+ 'IMG_SINC' => array(
1672
+ '5.4' => false,
1673
+ '5.5' => true,
1674
+ ),
1675
+ 'IMG_NEAREST_NEIGHBOUR' => array(
1676
+ '5.4' => false,
1677
+ '5.5' => true,
1678
+ ),
1679
+ 'IMG_WEIGHTED4' => array(
1680
+ '5.4' => false,
1681
+ '5.5' => true,
1682
+ ),
1683
+ 'IMG_TRIANGLE' => array(
1684
+ '5.4' => false,
1685
+ '5.5' => true,
1686
+ ),
1687
+ // JSON:
1688
+ 'JSON_ERROR_RECURSION' => array(
1689
+ '5.4' => false,
1690
+ '5.5' => true,
1691
+ ),
1692
+ 'JSON_ERROR_INF_OR_NAN' => array(
1693
+ '5.4' => false,
1694
+ '5.5' => true,
1695
+ ),
1696
+ 'JSON_ERROR_UNSUPPORTED_TYPE' => array(
1697
+ '5.4' => false,
1698
+ '5.5' => true,
1699
+ ),
1700
+ 'JSON_PARTIAL_OUTPUT_ON_ERROR' => array(
1701
+ '5.4' => false,
1702
+ '5.5' => true,
1703
+ ),
1704
+ // MySQLi
1705
+ 'MYSQLI_SERVER_PUBLIC_KEY' => array(
1706
+ '5.4' => false,
1707
+ '5.5' => true,
1708
+ ),
1709
+ // Curl:
1710
+ 'CURLOPT_SHARE' => array(
1711
+ '5.4' => false,
1712
+ '5.5' => true,
1713
+ ),
1714
+ 'CURLOPT_SSL_OPTIONS' => array(
1715
+ '5.4' => false,
1716
+ '5.5' => true,
1717
+ ),
1718
+ 'CURLSSLOPT_ALLOW_BEAST' => array(
1719
+ '5.4' => false,
1720
+ '5.5' => true,
1721
+ ),
1722
+ 'CURLOPT_USERNAME' => array(
1723
+ '5.4' => false,
1724
+ '5.5' => true,
1725
+ ),
1726
+ 'CURLINFO_RESPONSE_CODE' => array(
1727
+ '5.4' => false,
1728
+ '5.5' => true,
1729
+ ),
1730
+ 'CURLINFO_HTTP_CONNECTCODE' => array(
1731
+ '5.4' => false,
1732
+ '5.5' => true,
1733
+ ),
1734
+ 'CURLINFO_HTTPAUTH_AVAIL' => array(
1735
+ '5.4' => false,
1736
+ '5.5' => true,
1737
+ ),
1738
+ 'CURLINFO_PROXYAUTH_AVAIL' => array(
1739
+ '5.4' => false,
1740
+ '5.5' => true,
1741
+ ),
1742
+ 'CURLINFO_OS_ERRNO' => array(
1743
+ '5.4' => false,
1744
+ '5.5' => true,
1745
+ ),
1746
+ 'CURLINFO_NUM_CONNECTS' => array(
1747
+ '5.4' => false,
1748
+ '5.5' => true,
1749
+ ),
1750
+ 'CURLINFO_SSL_ENGINES' => array(
1751
+ '5.4' => false,
1752
+ '5.5' => true,
1753
+ ),
1754
+ 'CURLINFO_COOKIELIST' => array(
1755
+ '5.4' => false,
1756
+ '5.5' => true,
1757
+ ),
1758
+ 'CURLINFO_FTP_ENTRY_PATH' => array(
1759
+ '5.4' => false,
1760
+ '5.5' => true,
1761
+ ),
1762
+ 'CURLINFO_APPCONNECT_TIME' => array(
1763
+ '5.4' => false,
1764
+ '5.5' => true,
1765
+ ),
1766
+ 'CURLINFO_CONDITION_UNMET' => array(
1767
+ '5.4' => false,
1768
+ '5.5' => true,
1769
+ ),
1770
+ 'CURLINFO_RTSP_CLIENT_CSEQ' => array(
1771
+ '5.4' => false,
1772
+ '5.5' => true,
1773
+ ),
1774
+ 'CURLINFO_RTSP_CSEQ_RECV' => array(
1775
+ '5.4' => false,
1776
+ '5.5' => true,
1777
+ ),
1778
+ 'CURLINFO_RTSP_SERVER_CSEQ' => array(
1779
+ '5.4' => false,
1780
+ '5.5' => true,
1781
+ ),
1782
+ 'CURLINFO_RTSP_SESSION_ID' => array(
1783
+ '5.4' => false,
1784
+ '5.5' => true,
1785
+ ),
1786
+ 'CURLMOPT_PIPELINING' => array(
1787
+ '5.4' => false,
1788
+ '5.5' => true,
1789
+ ),
1790
+ 'CURLMOPT_MAXCONNECTS' => array(
1791
+ '5.4' => false,
1792
+ '5.5' => true,
1793
+ ),
1794
+ 'CURLPAUSE_ALL' => array(
1795
+ '5.4' => false,
1796
+ '5.5' => true,
1797
+ ),
1798
+ 'CURLPAUSE_CONT' => array(
1799
+ '5.4' => false,
1800
+ '5.5' => true,
1801
+ ),
1802
+ 'CURLPAUSE_RECV' => array(
1803
+ '5.4' => false,
1804
+ '5.5' => true,
1805
+ ),
1806
+ 'CURLPAUSE_RECV_CONT' => array(
1807
+ '5.4' => false,
1808
+ '5.5' => true,
1809
+ ),
1810
+ 'CURLPAUSE_SEND' => array(
1811
+ '5.4' => false,
1812
+ '5.5' => true,
1813
+ ),
1814
+ 'CURLPAUSE_SEND_CONT' => array(
1815
+ '5.4' => false,
1816
+ '5.5' => true,
1817
+ ),
1818
+ // Soap:
1819
+ 'SOAP_SSL_METHOD_TLS' => array(
1820
+ '5.4' => false,
1821
+ '5.5' => true,
1822
+ ),
1823
+ 'SOAP_SSL_METHOD_SSLv2' => array(
1824
+ '5.4' => false,
1825
+ '5.5' => true,
1826
+ ),
1827
+ 'SOAP_SSL_METHOD_SSLv3' => array(
1828
+ '5.4' => false,
1829
+ '5.5' => true,
1830
+ ),
1831
+ 'SOAP_SSL_METHOD_SSLv23' => array(
1832
+ '5.4' => false,
1833
+ '5.5' => true,
1834
+ ),
1835
+ // Tokenizer:
1836
+ 'T_FINALLY' => array(
1837
+ '5.4' => false,
1838
+ '5.5' => true,
1839
+ ),
1840
+ 'T_YIELD' => array(
1841
+ '5.4' => false,
1842
+ '5.5' => true,
1843
+ ),
1844
+ // Core/Password Hashing:
1845
+ 'PASSWORD_BCRYPT' => array(
1846
+ '5.4' => false,
1847
+ '5.5' => true,
1848
+ ),
1849
+ 'PASSWORD_DEFAULT' => array(
1850
+ '5.4' => false,
1851
+ '5.5' => true,
1852
+ ),
1853
+ 'PASSWORD_BCRYPT_DEFAULT_COST' => array(
1854
+ '5.4' => false,
1855
+ '5.5' => true,
1856
+ ),
1857
+
1858
+
1859
+ // Libxml:
1860
+ 'LIBXML_SCHEMA_CREATE' => array(
1861
+ '5.5.1' => false,
1862
+ '5.5.2' => true,
1863
+ ),
1864
+
1865
+ // Curl:
1866
+ 'CURL_SSLVERSION_TLSv1_0' => array(
1867
+ '5.5.18' => false,
1868
+ '5.5.19' => true,
1869
+ ),
1870
+ 'CURL_SSLVERSION_TLSv1_1' => array(
1871
+ '5.5.18' => false,
1872
+ '5.5.19' => true,
1873
+ ),
1874
+ 'CURL_SSLVERSION_TLSv1_2' => array(
1875
+ '5.5.18' => false,
1876
+ '5.5.19' => true,
1877
+ ),
1878
+
1879
+ 'CURLPROXY_SOCKS4A' => array(
1880
+ '5.5.22' => false,
1881
+ '5.5.23' => true,
1882
+ ),
1883
+ 'CURLPROXY_SOCKS5_HOSTNAME' => array(
1884
+ '5.5.22' => false,
1885
+ '5.5.23' => true,
1886
+ ),
1887
+
1888
+ 'CURL_VERSION_HTTP2' => array(
1889
+ '5.5.23' => false,
1890
+ '5.5.24' => true,
1891
+ ),
1892
+
1893
+ 'ARRAY_FILTER_USE_KEY' => array(
1894
+ '5.5' => false,
1895
+ '5.6' => true,
1896
+ ),
1897
+ 'ARRAY_FILTER_USE_BOTH' => array(
1898
+ '5.5' => false,
1899
+ '5.6' => true,
1900
+ ),
1901
+ // LDAP:
1902
+ 'LDAP_ESCAPE_DN' => array(
1903
+ '5.5' => false,
1904
+ '5.6' => true,
1905
+ ),
1906
+ 'LDAP_ESCAPE_FILTER' => array(
1907
+ '5.5' => false,
1908
+ '5.6' => true,
1909
+ ),
1910
+ // OpenSSL:
1911
+ 'OPENSSL_DEFAULT_STREAM_CIPHERS' => array(
1912
+ '5.5' => false,
1913
+ '5.6' => true,
1914
+ ),
1915
+ 'STREAM_CRYPTO_METHOD_ANY_CLIENT' => array(
1916
+ '5.5' => false,
1917
+ '5.6' => true,
1918
+ ),
1919
+ 'STREAM_CRYPTO_METHOD_ANY_SERVER' => array(
1920
+ '5.5' => false,
1921
+ '5.6' => true,
1922
+ ),
1923
+ 'STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT' => array(
1924
+ '5.5' => false,
1925
+ '5.6' => true,
1926
+ ),
1927
+ 'STREAM_CRYPTO_METHOD_TLSv1_0_SERVER' => array(
1928
+ '5.5' => false,
1929
+ '5.6' => true,
1930
+ ),
1931
+ 'STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT' => array(
1932
+ '5.5' => false,
1933
+ '5.6' => true,
1934
+ ),
1935
+ 'STREAM_CRYPTO_METHOD_TLSv1_1_SERVER' => array(
1936
+ '5.5' => false,
1937
+ '5.6' => true,
1938
+ ),
1939
+ 'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT' => array(
1940
+ '5.5' => false,
1941
+ '5.6' => true,
1942
+ ),
1943
+ 'STREAM_CRYPTO_METHOD_TLSv1_2_SERVER' => array(
1944
+ '5.5' => false,
1945
+ '5.6' => true,
1946
+ ),
1947
+ // PostgreSQL:
1948
+ 'PGSQL_CONNECT_ASYNC' => array(
1949
+ '5.5' => false,
1950
+ '5.6' => true,
1951
+ ),
1952
+ 'PGSQL_CONNECTION_AUTH_OK' => array(
1953
+ '5.5' => false,
1954
+ '5.6' => true,
1955
+ ),
1956
+ 'PGSQL_CONNECTION_AWAITING_RESPONSE' => array(
1957
+ '5.5' => false,
1958
+ '5.6' => true,
1959
+ ),
1960
+ 'PGSQL_CONNECTION_MADE' => array(
1961
+ '5.5' => false,
1962
+ '5.6' => true,
1963
+ ),
1964
+ 'PGSQL_CONNECTION_SETENV' => array(
1965
+ '5.5' => false,
1966
+ '5.6' => true,
1967
+ ),
1968
+ 'PGSQL_CONNECTION_SSL_STARTUP' => array(
1969
+ '5.5' => false,
1970
+ '5.6' => true,
1971
+ ),
1972
+ 'PGSQL_CONNECTION_STARTED' => array(
1973
+ '5.5' => false,
1974
+ '5.6' => true,
1975
+ ),
1976
+ 'PGSQL_DML_ESCAPE' => array(
1977
+ '5.5' => false,
1978
+ '5.6' => true,
1979
+ ),
1980
+ 'PGSQL_POLLING_ACTIVE' => array(
1981
+ '5.5' => false,
1982
+ '5.6' => true,
1983
+ ),
1984
+ 'PGSQL_POLLING_FAILED' => array(
1985
+ '5.5' => false,
1986
+ '5.6' => true,
1987
+ ),
1988
+ 'PGSQL_POLLING_OK' => array(
1989
+ '5.5' => false,
1990
+ '5.6' => true,
1991
+ ),
1992
+ 'PGSQL_POLLING_READING' => array(
1993
+ '5.5' => false,
1994
+ '5.6' => true,
1995
+ ),
1996
+ 'PGSQL_POLLING_WRITING' => array(
1997
+ '5.5' => false,
1998
+ '5.6' => true,
1999
+ ),
2000
+ // Tokenizer:
2001
+ 'T_ELLIPSIS' => array(
2002
+ '5.5' => false,
2003
+ '5.6' => true,
2004
+ ),
2005
+ 'T_POW' => array(
2006
+ '5.5' => false,
2007
+ '5.6' => true,
2008
+ ),
2009
+ 'T_POW_EQUAL' => array(
2010
+ '5.5' => false,
2011
+ '5.6' => true,
2012
+ ),
2013
+
2014
+ 'INI_SCANNER_TYPED' => array(
2015
+ '5.6.0' => false,
2016
+ '5.6.1' => true,
2017
+ ),
2018
+
2019
+ 'JSON_PRESERVE_ZERO_FRACTION' => array(
2020
+ '5.6.5' => false,
2021
+ '5.6.6' => true,
2022
+ ),
2023
+
2024
+ 'MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT' => array(
2025
+ '5.6.15' => false,
2026
+ '5.6.16' => true,
2027
+ ),
2028
+
2029
+ // GD:
2030
+ // Also introduced in 7.0.10.
2031
+ 'IMG_WEBP' => array(
2032
+ '5.6.24' => false,
2033
+ '5.6.25' => true,
2034
+ ),
2035
+
2036
+
2037
+ 'TOKEN_PARSE' => array(
2038
+ '5.6' => false,
2039
+ '7.0' => true,
2040
+ ),
2041
+ 'FILTER_VALIDATE_DOMAIN' => array(
2042
+ '5.6' => false,
2043
+ '7.0' => true,
2044
+ ),
2045
+ 'PHP_INT_MIN' => array(
2046
+ '5.6' => false,
2047
+ '7.0' => true,
2048
+ ),
2049
+ // Curl:
2050
+ 'CURLPIPE_NOTHING' => array(
2051
+ '5.6' => false,
2052
+ '7.0' => true,
2053
+ ),
2054
+ 'CURLPIPE_HTTP1' => array(
2055
+ '5.6' => false,
2056
+ '7.0' => true,
2057
+ ),
2058
+ 'CURLPIPE_MULTIPLEX' => array(
2059
+ '5.6' => false,
2060
+ '7.0' => true,
2061
+ ),
2062
+ // JSON:
2063
+ 'JSON_ERROR_INVALID_PROPERTY_NAME' => array(
2064
+ '5.6' => false,
2065
+ '7.0' => true,
2066
+ ),
2067
+ 'JSON_ERROR_UTF16' => array(
2068
+ '5.6' => false,
2069
+ '7.0' => true,
2070
+ ),
2071
+ // LibXML:
2072
+ 'LIBXML_BIGLINES' => array(
2073
+ '5.6' => false,
2074
+ '7.0' => true,
2075
+ ),
2076
+ // PCRE:
2077
+ 'PREG_JIT_STACKLIMIT_ERROR' => array(
2078
+ '5.6' => false,
2079
+ '7.0' => true,
2080
+ ),
2081
+ // POSIX:
2082
+ 'POSIX_RLIMIT_AS' => array(
2083
+ '5.6' => false,
2084
+ '7.0' => true,
2085
+ ),
2086
+ 'POSIX_RLIMIT_CORE' => array(
2087
+ '5.6' => false,
2088
+ '7.0' => true,
2089
+ ),
2090
+ 'POSIX_RLIMIT_CPU' => array(
2091
+ '5.6' => false,
2092
+ '7.0' => true,
2093
+ ),
2094
+ 'POSIX_RLIMIT_DATA' => array(
2095
+ '5.6' => false,
2096
+ '7.0' => true,
2097
+ ),
2098
+ 'POSIX_RLIMIT_FSIZE' => array(
2099
+ '5.6' => false,
2100
+ '7.0' => true,
2101
+ ),
2102
+ 'POSIX_RLIMIT_LOCKS' => array(
2103
+ '5.6' => false,
2104
+ '7.0' => true,
2105
+ ),
2106
+ 'POSIX_RLIMIT_MEMLOCK' => array(
2107
+ '5.6' => false,
2108
+ '7.0' => true,
2109
+ ),
2110
+ 'POSIX_RLIMIT_MSGQUEUE' => array(
2111
+ '5.6' => false,
2112
+ '7.0' => true,
2113
+ ),
2114
+ 'POSIX_RLIMIT_NICE' => array(
2115
+ '5.6' => false,
2116
+ '7.0' => true,
2117
+ ),
2118
+ 'POSIX_RLIMIT_NOFILE' => array(
2119
+ '5.6' => false,
2120
+ '7.0' => true,
2121
+ ),
2122
+ 'POSIX_RLIMIT_NPROC' => array(
2123
+ '5.6' => false,
2124
+ '7.0' => true,
2125
+ ),
2126
+ 'POSIX_RLIMIT_RSS' => array(
2127
+ '5.6' => false,
2128
+ '7.0' => true,
2129
+ ),
2130
+ 'POSIX_RLIMIT_RTPRIO' => array(
2131
+ '5.6' => false,
2132
+ '7.0' => true,
2133
+ ),
2134
+ 'POSIX_RLIMIT_RTTIME' => array(
2135
+ '5.6' => false,
2136
+ '7.0' => true,
2137
+ ),
2138
+ 'POSIX_RLIMIT_SIGPENDING' => array(
2139
+ '5.6' => false,
2140
+ '7.0' => true,
2141
+ ),
2142
+ 'POSIX_RLIMIT_STACK' => array(
2143
+ '5.6' => false,
2144
+ '7.0' => true,
2145
+ ),
2146
+ 'POSIX_RLIMIT_INFINITY' => array(
2147
+ '5.6' => false,
2148
+ '7.0' => true,
2149
+ ),
2150
+ // Tokenizer:
2151
+ 'T_SPACESHIP' => array(
2152
+ '5.6' => false,
2153
+ '7.0' => true,
2154
+ ),
2155
+ // Zlib:
2156
+ // The first three are in the PHP 5.4 changelog, but the Extension constant page says 7.0.
2157
+ 'ZLIB_ENCODING_RAW' => array(
2158
+ '5.6' => false,
2159
+ '7.0' => true,
2160
+ ),
2161
+ 'ZLIB_ENCODING_DEFLATE' => array(
2162
+ '5.6' => false,
2163
+ '7.0' => true,
2164
+ ),
2165
+ 'ZLIB_ENCODING_GZIP' => array(
2166
+ '5.6' => false,
2167
+ '7.0' => true,
2168
+ ),
2169
+ 'ZLIB_FILTERED' => array(
2170
+ '5.6' => false,
2171
+ '7.0' => true,
2172
+ ),
2173
+ 'ZLIB_HUFFMAN_ONLY' => array(
2174
+ '5.6' => false,
2175
+ '7.0' => true,
2176
+ ),
2177
+ 'ZLIB_FIXED' => array(
2178
+ '5.6' => false,
2179
+ '7.0' => true,
2180
+ ),
2181
+ 'ZLIB_RLE' => array(
2182
+ '5.6' => false,
2183
+ '7.0' => true,
2184
+ ),
2185
+ 'ZLIB_DEFAULT_STRATEGY' => array(
2186
+ '5.6' => false,
2187
+ '7.0' => true,
2188
+ ),
2189
+ 'ZLIB_BLOCK' => array(
2190
+ '5.6' => false,
2191
+ '7.0' => true,
2192
+ ),
2193
+ 'ZLIB_FINISH' => array(
2194
+ '5.6' => false,
2195
+ '7.0' => true,
2196
+ ),
2197
+ 'ZLIB_FULL_FLUSH' => array(
2198
+ '5.6' => false,
2199
+ '7.0' => true,
2200
+ ),
2201
+ 'ZLIB_NO_FLUSH' => array(
2202
+ '5.6' => false,
2203
+ '7.0' => true,
2204
+ ),
2205
+ 'ZLIB_PARTIAL_FLUSH' => array(
2206
+ '5.6' => false,
2207
+ '7.0' => true,
2208
+ ),
2209
+ 'ZLIB_SYNC_FLUSH' => array(
2210
+ '5.6' => false,
2211
+ '7.0' => true,
2212
+ ),
2213
+
2214
+ 'CURL_HTTP_VERSION_2' => array(
2215
+ '7.0.6' => false,
2216
+ '7.0.7' => true,
2217
+ ),
2218
+ 'CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE' => array(
2219
+ '7.0.6' => false,
2220
+ '7.0.7' => true,
2221
+ ),
2222
+ 'CURL_HTTP_VERSION_2TLS' => array(
2223
+ '7.0.6' => false,
2224
+ '7.0.7' => true,
2225
+ ),
2226
+ 'CURL_REDIR_POST_301' => array(
2227
+ '7.0.6' => false,
2228
+ '7.0.7' => true,
2229
+ ),
2230
+ 'CURL_REDIR_POST_302' => array(
2231
+ '7.0.6' => false,
2232
+ '7.0.7' => true,
2233
+ ),
2234
+ 'CURL_REDIR_POST_303' => array(
2235
+ '7.0.6' => false,
2236
+ '7.0.7' => true,
2237
+ ),
2238
+ 'CURL_REDIR_POST_ALL' => array(
2239
+ '7.0.6' => false,
2240
+ '7.0.7' => true,
2241
+ ),
2242
+ 'CURL_VERSION_KERBEROS5' => array(
2243
+ '7.0.6' => false,
2244
+ '7.0.7' => true,
2245
+ ),
2246
+ 'CURL_VERSION_PSL' => array(
2247
+ '7.0.6' => false,
2248
+ '7.0.7' => true,
2249
+ ),
2250
+ 'CURL_VERSION_UNIX_SOCKETS' => array(
2251
+ '7.0.6' => false,
2252
+ '7.0.7' => true,
2253
+ ),
2254
+ 'CURLAUTH_NEGOTIATE' => array(
2255
+ '7.0.6' => false,
2256
+ '7.0.7' => true,
2257
+ ),
2258
+ 'CURLAUTH_NTLM_WB' => array(
2259
+ '7.0.6' => false,
2260
+ '7.0.7' => true,
2261
+ ),
2262
+ 'CURLFTP_CREATE_DIR' => array(
2263
+ '7.0.6' => false,
2264
+ '7.0.7' => true,
2265
+ ),
2266
+ 'CURLFTP_CREATE_DIR_NONE' => array(
2267
+ '7.0.6' => false,
2268
+ '7.0.7' => true,
2269
+ ),
2270
+ 'CURLFTP_CREATE_DIR_RETRY' => array(
2271
+ '7.0.6' => false,
2272
+ '7.0.7' => true,
2273
+ ),
2274
+ 'CURLHEADER_SEPARATE' => array(
2275
+ '7.0.6' => false,
2276
+ '7.0.7' => true,
2277
+ ),
2278
+ 'CURLHEADER_UNIFIED' => array(
2279
+ '7.0.6' => false,
2280
+ '7.0.7' => true,
2281
+ ),
2282
+ 'CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE' => array(
2283
+ '7.0.6' => false,
2284
+ '7.0.7' => true,
2285
+ ),
2286
+ 'CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE' => array(
2287
+ '7.0.6' => false,
2288
+ '7.0.7' => true,
2289
+ ),
2290
+ 'CURLMOPT_MAX_HOST_CONNECTIONS' => array(
2291
+ '7.0.6' => false,
2292
+ '7.0.7' => true,
2293
+ ),
2294
+ 'CURLMOPT_MAX_PIPELINE_LENGTH' => array(
2295
+ '7.0.6' => false,
2296
+ '7.0.7' => true,
2297
+ ),
2298
+ 'CURLMOPT_MAX_TOTAL_CONNECTIONS' => array(
2299
+ '7.0.6' => false,
2300
+ '7.0.7' => true,
2301
+ ),
2302
+ 'CURLOPT_CONNECT_TO' => array(
2303
+ '7.0.6' => false,
2304
+ '7.0.7' => true,
2305
+ ),
2306
+ 'CURLOPT_DEFAULT_PROTOCOL' => array(
2307
+ '7.0.6' => false,
2308
+ '7.0.7' => true,
2309
+ ),
2310
+ 'CURLOPT_DNS_INTERFACE' => array(
2311
+ '7.0.6' => false,
2312
+ '7.0.7' => true,
2313
+ ),
2314
+ 'CURLOPT_DNS_LOCAL_IP4' => array(
2315
+ '7.0.6' => false,
2316
+ '7.0.7' => true,
2317
+ ),
2318
+ 'CURLOPT_DNS_LOCAL_IP6' => array(
2319
+ '7.0.6' => false,
2320
+ '7.0.7' => true,
2321
+ ),
2322
+ 'CURLOPT_EXPECT_100_TIMEOUT_MS' => array(
2323
+ '7.0.6' => false,
2324
+ '7.0.7' => true,
2325
+ ),
2326
+ 'CURLOPT_HEADEROPT' => array(
2327
+ '7.0.6' => false,
2328
+ '7.0.7' => true,
2329
+ ),
2330
+ 'CURLOPT_LOGIN_OPTIONS' => array(
2331
+ '7.0.6' => false,
2332
+ '7.0.7' => true,
2333
+ ),
2334
+ 'CURLOPT_PATH_AS_IS' => array(
2335
+ '7.0.6' => false,
2336
+ '7.0.7' => true,
2337
+ ),
2338
+ 'CURLOPT_PINNEDPUBLICKEY' => array(
2339
+ '7.0.6' => false,
2340
+ '7.0.7' => true,
2341
+ ),
2342
+ 'CURLOPT_PIPEWAIT' => array(
2343
+ '7.0.6' => false,
2344
+ '7.0.7' => true,
2345
+ ),
2346
+ 'CURLOPT_PROXY_SERVICE_NAME' => array(
2347
+ '7.0.6' => false,
2348
+ '7.0.7' => true,
2349
+ ),
2350
+ 'CURLOPT_PROXYHEADER' => array(
2351
+ '7.0.6' => false,
2352
+ '7.0.7' => true,
2353
+ ),
2354
+ 'CURLOPT_SASL_IR' => array(
2355
+ '7.0.6' => false,
2356
+ '7.0.7' => true,
2357
+ ),
2358
+ 'CURLOPT_SERVICE_NAME' => array(
2359
+ '7.0.6' => false,
2360
+ '7.0.7' => true,
2361
+ ),
2362
+ 'CURLOPT_SSL_ENABLE_ALPN' => array(
2363
+ '7.0.6' => false,
2364
+ '7.0.7' => true,
2365
+ ),
2366
+ 'CURLOPT_SSL_ENABLE_NPN' => array(
2367
+ '7.0.6' => false,
2368
+ '7.0.7' => true,
2369
+ ),
2370
+ 'CURLOPT_SSL_FALSESTART' => array(
2371
+ '7.0.6' => false,
2372
+ '7.0.7' => true,
2373
+ ),
2374
+ 'CURLOPT_SSL_VERIFYSTATUS' => array(
2375
+ '7.0.6' => false,
2376
+ '7.0.7' => true,
2377
+ ),
2378
+ 'CURLOPT_STREAM_WEIGHT' => array(
2379
+ '7.0.6' => false,
2380
+ '7.0.7' => true,
2381
+ ),
2382
+ 'CURLOPT_TCP_FASTOPEN' => array(
2383
+ '7.0.6' => false,
2384
+ '7.0.7' => true,
2385
+ ),
2386
+ 'CURLOPT_TFTP_NO_OPTIONS' => array(
2387
+ '7.0.6' => false,
2388
+ '7.0.7' => true,
2389
+ ),
2390
+ 'CURLOPT_UNIX_SOCKET_PATH' => array(
2391
+ '7.0.6' => false,
2392
+ '7.0.7' => true,
2393
+ ),
2394
+ 'CURLOPT_XOAUTH2_BEARER' => array(
2395
+ '7.0.6' => false,
2396
+ '7.0.7' => true,
2397
+ ),
2398
+ 'CURLPROTO_SMB' => array(
2399
+ '7.0.6' => false,
2400
+ '7.0.7' => true,
2401
+ ),
2402
+ 'CURLPROTO_SMBS' => array(
2403
+ '7.0.6' => false,
2404
+ '7.0.7' => true,
2405
+ ),
2406
+ 'CURLPROXY_HTTP_1_0' => array(
2407
+ '7.0.6' => false,
2408
+ '7.0.7' => true,
2409
+ ),
2410
+ 'CURLSSH_AUTH_AGENT' => array(
2411
+ '7.0.6' => false,
2412
+ '7.0.7' => true,
2413
+ ),
2414
+ 'CURLSSLOPT_NO_REVOKE' => array(
2415
+ '7.0.6' => false,
2416
+ '7.0.7' => true,
2417
+ ),
2418
+
2419
+ 'PHP_FD_SETSIZE' => array(
2420
+ '7.0' => false,
2421
+ '7.1' => true,
2422
+ ),
2423
+ // Curl:
2424
+ 'CURLMOPT_PUSHFUNCTION' => array(
2425
+ '7.0' => false,
2426
+ '7.1' => true,
2427
+ ),
2428
+ 'CURL_PUSH_OK' => array(
2429
+ '7.0' => false,
2430
+ '7.1' => true,
2431
+ ),
2432
+ 'CURL_PUSH_DENY' => array(
2433
+ '7.0' => false,
2434
+ '7.1' => true,
2435
+ ),
2436
+ // Filter:
2437
+ 'FILTER_FLAG_EMAIL_UNICODE' => array(
2438
+ '7.0' => false,
2439
+ '7.1' => true,
2440
+ ),
2441
+ // GD:
2442
+ 'IMAGETYPE_WEBP' => array(
2443
+ '7.0' => false,
2444
+ '7.1' => true,
2445
+ ),
2446
+ // Json:
2447
+ 'JSON_UNESCAPED_LINE_TERMINATORS' => array(
2448
+ '7.0' => false,
2449
+ '7.1' => true,
2450
+ ),
2451
+ // LDAP:
2452
+ 'LDAP_OPT_X_SASL_NOCANON' => array(
2453
+ '7.0' => false,
2454
+ '7.1' => true,
2455
+ ),
2456
+ 'LDAP_OPT_X_SASL_USERNAME' => array(
2457
+ '7.0' => false,
2458
+ '7.1' => true,
2459
+ ),
2460
+ 'LDAP_OPT_X_TLS_CACERTDIR' => array(
2461
+ '7.0' => false,
2462
+ '7.1' => true,
2463
+ ),
2464
+ 'LDAP_OPT_X_TLS_CACERTFILE' => array(
2465
+ '7.0' => false,
2466
+ '7.1' => true,
2467
+ ),
2468
+ 'LDAP_OPT_X_TLS_CERTFILE' => array(
2469
+ '7.0' => false,
2470
+ '7.1' => true,
2471
+ ),
2472
+ 'LDAP_OPT_X_TLS_CIPHER_SUITE' => array(
2473
+ '7.0' => false,
2474
+ '7.1' => true,
2475
+ ),
2476
+ 'LDAP_OPT_X_TLS_KEYFILE' => array(
2477
+ '7.0' => false,
2478
+ '7.1' => true,
2479
+ ),
2480
+ 'LDAP_OPT_X_TLS_RANDOM_FILE' => array(
2481
+ '7.0' => false,
2482
+ '7.1' => true,
2483
+ ),
2484
+ 'LDAP_OPT_X_TLS_CRLCHECK' => array(
2485
+ '7.0' => false,
2486
+ '7.1' => true,
2487
+ ),
2488
+ 'LDAP_OPT_X_TLS_CRL_NONE' => array(
2489
+ '7.0' => false,
2490
+ '7.1' => true,
2491
+ ),
2492
+ 'LDAP_OPT_X_TLS_CRL_PEER' => array(
2493
+ '7.0' => false,
2494
+ '7.1' => true,
2495
+ ),
2496
+ 'LDAP_OPT_X_TLS_CRL_ALL' => array(
2497
+ '7.0' => false,
2498
+ '7.1' => true,
2499
+ ),
2500
+ 'LDAP_OPT_X_TLS_DHFILE' => array(
2501
+ '7.0' => false,
2502
+ '7.1' => true,
2503
+ ),
2504
+ 'LDAP_OPT_X_TLS_CRLFILE' => array(
2505
+ '7.0' => false,
2506
+ '7.1' => true,
2507
+ ),
2508
+ 'LDAP_OPT_X_TLS_PROTOCOL_MIN' => array(
2509
+ '7.0' => false,
2510
+ '7.1' => true,
2511
+ ),
2512
+ 'LDAP_OPT_X_TLS_PROTOCOL_SSL2' => array(
2513
+ '7.0' => false,
2514
+ '7.1' => true,
2515
+ ),
2516
+ 'LDAP_OPT_X_TLS_PROTOCOL_SSL3' => array(
2517
+ '7.0' => false,
2518
+ '7.1' => true,
2519
+ ),
2520
+ 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_0' => array(
2521
+ '7.0' => false,
2522
+ '7.1' => true,
2523
+ ),
2524
+ 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_1' => array(
2525
+ '7.0' => false,
2526
+ '7.1' => true,
2527
+ ),
2528
+ 'LDAP_OPT_X_TLS_PROTOCOL_TLS1_2' => array(
2529
+ '7.0' => false,
2530
+ '7.1' => true,
2531
+ ),
2532
+ 'LDAP_OPT_X_TLS_PACKAGE' => array(
2533
+ '7.0' => false,
2534
+ '7.1' => true,
2535
+ ),
2536
+ 'LDAP_OPT_X_KEEPALIVE_IDLE' => array(
2537
+ '7.0' => false,
2538
+ '7.1' => true,
2539
+ ),
2540
+ 'LDAP_OPT_X_KEEPALIVE_PROBES' => array(
2541
+ '7.0' => false,
2542
+ '7.1' => true,
2543
+ ),
2544
+ 'LDAP_OPT_X_KEEPALIVE_INTERVAL' => array(
2545
+ '7.0' => false,
2546
+ '7.1' => true,
2547
+ ),
2548
+ // PostgreSQL:
2549
+ 'PGSQL_NOTICE_LAST' => array(
2550
+ '7.0' => false,
2551
+ '7.1' => true,
2552
+ ),
2553
+ 'PGSQL_NOTICE_ALL' => array(
2554
+ '7.0' => false,
2555
+ '7.1' => true,
2556
+ ),
2557
+ 'PGSQL_NOTICE_CLEAR' => array(
2558
+ '7.0' => false,
2559
+ '7.1' => true,
2560
+ ),
2561
+ // SPL:
2562
+ 'MT_RAND_PHP' => array(
2563
+ '7.0' => false,
2564
+ '7.1' => true,
2565
+ ),
2566
+
2567
+ // SQLite3:
2568
+ 'SQLITE3_DETERMINISTIC' => array(
2569
+ '7.1.3' => false,
2570
+ '7.1.4' => true,
2571
+ ),
2572
+
2573
+ // Core:
2574
+ 'PHP_OS_FAMILY' => array(
2575
+ '7.1' => false,
2576
+ '7.2' => true,
2577
+ ),
2578
+ 'PHP_FLOAT_DIG' => array(
2579
+ '7.1' => false,
2580
+ '7.2' => true,
2581
+ ),
2582
+ 'PHP_FLOAT_EPSILON' => array(
2583
+ '7.1' => false,
2584
+ '7.2' => true,
2585
+ ),
2586
+ 'PHP_FLOAT_MIN' => array(
2587
+ '7.1' => false,
2588
+ '7.2' => true,
2589
+ ),
2590
+ 'PHP_FLOAT_MAX' => array(
2591
+ '7.1' => false,
2592
+ '7.2' => true,
2593
+ ),
2594
+
2595
+ // Core/Password Hashing:
2596
+ 'PASSWORD_ARGON2I' => array(
2597
+ '7.1' => false,
2598
+ '7.2' => true,
2599
+ ),
2600
+ 'PASSWORD_ARGON2_DEFAULT_MEMORY_COST' => array(
2601
+ '7.1' => false,
2602
+ '7.2' => true,
2603
+ ),
2604
+ 'PASSWORD_ARGON2_DEFAULT_TIME_COST' => array(
2605
+ '7.1' => false,
2606
+ '7.2' => true,
2607
+ ),
2608
+ 'PASSWORD_ARGON2_DEFAULT_THREADS' => array(
2609
+ '7.1' => false,
2610
+ '7.2' => true,
2611
+ ),
2612
+
2613
+ // Fileinfo:
2614
+ 'FILEINFO_EXTENSION' => array(
2615
+ '7.1' => false,
2616
+ '7.2' => true,
2617
+ ),
2618
+
2619
+ // GD:
2620
+ 'IMG_EFFECT_MULTIPLY' => array(
2621
+ '7.1' => false,
2622
+ '7.2' => true,
2623
+ ),
2624
+ 'IMG_BMP' => array(
2625
+ '7.1' => false,
2626
+ '7.2' => true,
2627
+ ),
2628
+
2629
+ // JSON:
2630
+ 'JSON_INVALID_UTF8_IGNORE' => array(
2631
+ '7.1' => false,
2632
+ '7.2' => true,
2633
+ ),
2634
+ 'JSON_INVALID_UTF8_SUBSTITUTE' => array(
2635
+ '7.1' => false,
2636
+ '7.2' => true,
2637
+ ),
2638
+
2639
+ // LDAP:
2640
+ 'LDAP_EXOP_START_TLS' => array(
2641
+ '7.1' => false,
2642
+ '7.2' => true,
2643
+ ),
2644
+ 'LDAP_EXOP_MODIFY_PASSWD' => array(
2645
+ '7.1' => false,
2646
+ '7.2' => true,
2647
+ ),
2648
+ 'LDAP_EXOP_REFRESH' => array(
2649
+ '7.1' => false,
2650
+ '7.2' => true,
2651
+ ),
2652
+ 'LDAP_EXOP_WHO_AM_I' => array(
2653
+ '7.1' => false,
2654
+ '7.2' => true,
2655
+ ),
2656
+ 'LDAP_EXOP_TURN' => array(
2657
+ '7.1' => false,
2658
+ '7.2' => true,
2659
+ ),
2660
+
2661
+ // PCRE:
2662
+ 'PREG_UNMATCHED_AS_NULL' => array(
2663
+ '7.1' => false,
2664
+ '7.2' => true,
2665
+ ),
2666
+
2667
+ // Sodium:
2668
+ 'SODIUM_LIBRARY_VERSION' => array(
2669
+ '7.1' => false,
2670
+ '7.2' => true,
2671
+ ),
2672
+ 'SODIUM_LIBRARY_MAJOR_VERSION' => array(
2673
+ '7.1' => false,
2674
+ '7.2' => true,
2675
+ ),
2676
+ 'SODIUM_LIBRARY_MINOR_VERSION' => array(
2677
+ '7.1' => false,
2678
+ '7.2' => true,
2679
+ ),
2680
+ 'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' => array(
2681
+ '7.1' => false,
2682
+ '7.2' => true,
2683
+ ),
2684
+ 'SODIUM_CRYPTO_AEAD_AES256GCM_NSECBYTES' => array(
2685
+ '7.1' => false,
2686
+ '7.2' => true,
2687
+ ),
2688
+ 'SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES' => array(
2689
+ '7.1' => false,
2690
+ '7.2' => true,
2691
+ ),
2692
+ 'SODIUM_CRYPTO_AEAD_AES256GCM_ABYTES' => array(
2693
+ '7.1' => false,
2694
+ '7.2' => true,
2695
+ ),
2696
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES' => array(
2697
+ '7.1' => false,
2698
+ '7.2' => true,
2699
+ ),
2700
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NSECBYTES' => array(
2701
+ '7.1' => false,
2702
+ '7.2' => true,
2703
+ ),
2704
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES' => array(
2705
+ '7.1' => false,
2706
+ '7.2' => true,
2707
+ ),
2708
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_ABYTES' => array(
2709
+ '7.1' => false,
2710
+ '7.2' => true,
2711
+ ),
2712
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES' => array(
2713
+ '7.1' => false,
2714
+ '7.2' => true,
2715
+ ),
2716
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NSECBYTES' => array(
2717
+ '7.1' => false,
2718
+ '7.2' => true,
2719
+ ),
2720
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES' => array(
2721
+ '7.1' => false,
2722
+ '7.2' => true,
2723
+ ),
2724
+ 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_ABYTES' => array(
2725
+ '7.1' => false,
2726
+ '7.2' => true,
2727
+ ),
2728
+ 'SODIUM_CRYPTO_AUTH_BYTES' => array(
2729
+ '7.1' => false,
2730
+ '7.2' => true,
2731
+ ),
2732
+ 'SODIUM_CRYPTO_AUTH_KEYBYTES' => array(
2733
+ '7.1' => false,
2734
+ '7.2' => true,
2735
+ ),
2736
+ 'SODIUM_CRYPTO_BOX_SEALBYTES' => array(
2737
+ '7.1' => false,
2738
+ '7.2' => true,
2739
+ ),
2740
+ 'SODIUM_CRYPTO_BOX_SECRETKEYBYTES' => array(
2741
+ '7.1' => false,
2742
+ '7.2' => true,
2743
+ ),
2744
+ 'SODIUM_CRYPTO_BOX_PUBLICKEYBYTES' => array(
2745
+ '7.1' => false,
2746
+ '7.2' => true,
2747
+ ),
2748
+ 'SODIUM_CRYPTO_BOX_KEYPAIRBYTES' => array(
2749
+ '7.1' => false,
2750
+ '7.2' => true,
2751
+ ),
2752
+ 'SODIUM_CRYPTO_BOX_MACBYTES' => array(
2753
+ '7.1' => false,
2754
+ '7.2' => true,
2755
+ ),
2756
+ 'SODIUM_CRYPTO_BOX_NONCEBYTES' => array(
2757
+ '7.1' => false,
2758
+ '7.2' => true,
2759
+ ),
2760
+ 'SODIUM_CRYPTO_BOX_SEEDBYTES' => array(
2761
+ '7.1' => false,
2762
+ '7.2' => true,
2763
+ ),
2764
+ 'SODIUM_CRYPTO_KDF_BYTES_MIN' => array(
2765
+ '7.1' => false,
2766
+ '7.2' => true,
2767
+ ),
2768
+ 'SODIUM_CRYPTO_KDF_BYTES_MAX' => array(
2769
+ '7.1' => false,
2770
+ '7.2' => true,
2771
+ ),
2772
+ 'SODIUM_CRYPTO_KDF_CONTEXTBYTES' => array(
2773
+ '7.1' => false,
2774
+ '7.2' => true,
2775
+ ),
2776
+ 'SODIUM_CRYPTO_KDF_KEYBYTES' => array(
2777
+ '7.1' => false,
2778
+ '7.2' => true,
2779
+ ),
2780
+ 'SODIUM_CRYPTO_KX_SEEDBYTES' => array(
2781
+ '7.1' => false,
2782
+ '7.2' => true,
2783
+ ),
2784
+ 'SODIUM_CRYPTO_KX_SESSIONKEYBYTES' => array(
2785
+ '7.1' => false,
2786
+ '7.2' => true,
2787
+ ),
2788
+ 'SODIUM_CRYPTO_KX_PUBLICKEYBYTES' => array(
2789
+ '7.1' => false,
2790
+ '7.2' => true,
2791
+ ),
2792
+ 'SODIUM_CRYPTO_KX_SECRETKEYBYTES' => array(
2793
+ '7.1' => false,
2794
+ '7.2' => true,
2795
+ ),
2796
+ 'SODIUM_CRYPTO_KX_KEYPAIRBYTES' => array(
2797
+ '7.1' => false,
2798
+ '7.2' => true,
2799
+ ),
2800
+ 'SODIUM_CRYPTO_GENERICHASH_BYTES' => array(
2801
+ '7.1' => false,
2802
+ '7.2' => true,
2803
+ ),
2804
+ 'SODIUM_CRYPTO_GENERICHASH_BYTES_MIN' => array(
2805
+ '7.1' => false,
2806
+ '7.2' => true,
2807
+ ),
2808
+ 'SODIUM_CRYPTO_GENERICHASH_BYTES_MAX' => array(
2809
+ '7.1' => false,
2810
+ '7.2' => true,
2811
+ ),
2812
+ 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES' => array(
2813
+ '7.1' => false,
2814
+ '7.2' => true,
2815
+ ),
2816
+ 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MIN' => array(
2817
+ '7.1' => false,
2818
+ '7.2' => true,
2819
+ ),
2820
+ 'SODIUM_CRYPTO_GENERICHASH_KEYBYTES_MAX' => array(
2821
+ '7.1' => false,
2822
+ '7.2' => true,
2823
+ ),
2824
+ 'SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13' => array(
2825
+ '7.1' => false,
2826
+ '7.2' => true,
2827
+ ),
2828
+ 'SODIUM_CRYPTO_PWHASH_ALG_DEFAULT' => array(
2829
+ '7.1' => false,
2830
+ '7.2' => true,
2831
+ ),
2832
+ 'SODIUM_CRYPTO_PWHASH_SALTBYTES' => array(
2833
+ '7.1' => false,
2834
+ '7.2' => true,
2835
+ ),
2836
+ 'SODIUM_CRYPTO_PWHASH_STRPREFIX' => array(
2837
+ '7.1' => false,
2838
+ '7.2' => true,
2839
+ ),
2840
+ 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE' => array(
2841
+ '7.1' => false,
2842
+ '7.2' => true,
2843
+ ),
2844
+ 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE' => array(
2845
+ '7.1' => false,
2846
+ '7.2' => true,
2847
+ ),
2848
+ 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE' => array(
2849
+ '7.1' => false,
2850
+ '7.2' => true,
2851
+ ),
2852
+ 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE' => array(
2853
+ '7.1' => false,
2854
+ '7.2' => true,
2855
+ ),
2856
+ 'SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE' => array(
2857
+ '7.1' => false,
2858
+ '7.2' => true,
2859
+ ),
2860
+ 'SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE' => array(
2861
+ '7.1' => false,
2862
+ '7.2' => true,
2863
+ ),
2864
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES' => array(
2865
+ '7.1' => false,
2866
+ '7.2' => true,
2867
+ ),
2868
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX' => array(
2869
+ '7.1' => false,
2870
+ '7.2' => true,
2871
+ ),
2872
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE' => array(
2873
+ '7.1' => false,
2874
+ '7.2' => true,
2875
+ ),
2876
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE' => array(
2877
+ '7.1' => false,
2878
+ '7.2' => true,
2879
+ ),
2880
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_SENSITIVE' => array(
2881
+ '7.1' => false,
2882
+ '7.2' => true,
2883
+ ),
2884
+ 'SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_SENSITIVE' => array(
2885
+ '7.1' => false,
2886
+ '7.2' => true,
2887
+ ),
2888
+ 'SODIUM_CRYPTO_SCALARMULT_BYTES' => array(
2889
+ '7.1' => false,
2890
+ '7.2' => true,
2891
+ ),
2892
+ 'SODIUM_CRYPTO_SCALARMULT_SCALARBYTES' => array(
2893
+ '7.1' => false,
2894
+ '7.2' => true,
2895
+ ),
2896
+ 'SODIUM_CRYPTO_SHORTHASH_BYTES' => array(
2897
+ '7.1' => false,
2898
+ '7.2' => true,
2899
+ ),
2900
+ 'SODIUM_CRYPTO_SHORTHASH_KEYBYTES' => array(
2901
+ '7.1' => false,
2902
+ '7.2' => true,
2903
+ ),
2904
+ 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES' => array(
2905
+ '7.1' => false,
2906
+ '7.2' => true,
2907
+ ),
2908
+ 'SODIUM_CRYPTO_SECRETBOX_MACBYTES' => array(
2909
+ '7.1' => false,
2910
+ '7.2' => true,
2911
+ ),
2912
+ 'SODIUM_CRYPTO_SECRETBOX_NONCEBYTES' => array(
2913
+ '7.1' => false,
2914
+ '7.2' => true,
2915
+ ),
2916
+ 'SODIUM_CRYPTO_SIGN_BYTES' => array(
2917
+ '7.1' => false,
2918
+ '7.2' => true,
2919
+ ),
2920
+ 'SODIUM_CRYPTO_SIGN_SEEDBYTES' => array(
2921
+ '7.1' => false,
2922
+ '7.2' => true,
2923
+ ),
2924
+ 'SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES' => array(
2925
+ '7.1' => false,
2926
+ '7.2' => true,
2927
+ ),
2928
+ 'SODIUM_CRYPTO_SIGN_SECRETKEYBYTES' => array(
2929
+ '7.1' => false,
2930
+ '7.2' => true,
2931
+ ),
2932
+ 'SODIUM_CRYPTO_SIGN_KEYPAIRBYTES' => array(
2933
+ '7.1' => false,
2934
+ '7.2' => true,
2935
+ ),
2936
+ 'SODIUM_CRYPTO_STREAM_NONCEBYTES' => array(
2937
+ '7.1' => false,
2938
+ '7.2' => true,
2939
+ ),
2940
+ 'SODIUM_CRYPTO_STREAM_KEYBYTES' => array(
2941
+ '7.1' => false,
2942
+ '7.2' => true,
2943
+ ),
2944
+ );
2945
+
2946
+
2947
+ /**
2948
+ * Returns an array of tokens this test wants to listen for.
2949
+ *
2950
+ * @return array
2951
+ */
2952
+ public function register()
2953
+ {
2954
+ return array(T_STRING);
2955
+
2956
+ }//end register()
2957
+
2958
+ /**
2959
+ * Processes this test, when one of its tokens is encountered.
2960
+ *
2961
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
2962
+ * @param int $stackPtr The position of the current token in the
2963
+ * stack passed in $tokens.
2964
+ *
2965
+ * @return void
2966
+ */
2967
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
2968
+ {
2969
+ $tokens = $phpcsFile->getTokens();
2970
+ $constantName = $tokens[$stackPtr]['content'];
2971
+
2972
+ if (isset($this->newConstants[$constantName]) === false) {
2973
+ return;
2974
+ }
2975
+
2976
+ if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false) {
2977
+ return;
2978
+ }
2979
+
2980
+ $itemInfo = array(
2981
+ 'name' => $constantName,
2982
+ );
2983
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
2984
+
2985
+ }//end process()
2986
+
2987
+
2988
+ /**
2989
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
2990
+ *
2991
+ * @param array $itemInfo Base information about the item.
2992
+ *
2993
+ * @return array Version and other information about the item.
2994
+ */
2995
+ public function getItemArray(array $itemInfo)
2996
+ {
2997
+ return $this->newConstants[$itemInfo['name']];
2998
+ }
2999
+
3000
+
3001
+ /**
3002
+ * Get the error message template for this sniff.
3003
+ *
3004
+ * @return string
3005
+ */
3006
+ protected function getErrorMsgTemplate()
3007
+ {
3008
+ return 'The constant "%s" is not present in PHP version %s or earlier';
3009
+ }
3010
+
3011
+
3012
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewExecutionDirectivesSniff.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewExecutionDirectivesSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+ use PHPCompatibility\PHPCSHelper;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewExecutionDirectivesSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
21
+ */
22
+ class NewExecutionDirectivesSniff extends AbstractNewFeatureSniff
23
+ {
24
+
25
+ /**
26
+ * A list of new execution directives
27
+ *
28
+ * The array lists : version number with false (not present) or true (present).
29
+ * If the execution order is conditional, add the condition as a string to the version nr.
30
+ * If's sufficient to list the first version where the execution directive appears.
31
+ *
32
+ * @var array(string => array(string => int|string|null))
33
+ */
34
+ protected $newDirectives = array(
35
+ 'ticks' => array(
36
+ '3.1' => false,
37
+ '4.0' => true,
38
+ 'valid_value_callback' => 'isNumeric',
39
+ ),
40
+ 'encoding' => array(
41
+ '5.2' => false,
42
+ '5.3' => '--enable-zend-multibyte', // Directive ignored unless.
43
+ '5.4' => true,
44
+ 'valid_value_callback' => 'validEncoding',
45
+ ),
46
+ 'strict_types' => array(
47
+ '5.6' => false,
48
+ '7.0' => true,
49
+ 'valid_values' => array(1),
50
+ ),
51
+ );
52
+
53
+
54
+ /**
55
+ * Tokens to ignore when trying to find the value for the directive.
56
+ *
57
+ * @var array
58
+ */
59
+ protected $ignoreTokens = array();
60
+
61
+
62
+ /**
63
+ * Returns an array of tokens this test wants to listen for.
64
+ *
65
+ * @return array
66
+ */
67
+ public function register()
68
+ {
69
+ $this->ignoreTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
70
+ $this->ignoreTokens[T_EQUAL] = T_EQUAL;
71
+
72
+ return array(T_DECLARE);
73
+ }//end register()
74
+
75
+
76
+ /**
77
+ * Processes this test, when one of its tokens is encountered.
78
+ *
79
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
80
+ * @param int $stackPtr The position of the current token in
81
+ * the stack passed in $tokens.
82
+ *
83
+ * @return void
84
+ */
85
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
86
+ {
87
+ $tokens = $phpcsFile->getTokens();
88
+
89
+ if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === true) {
90
+ $openParenthesis = $tokens[$stackPtr]['parenthesis_opener'];
91
+ $closeParenthesis = $tokens[$stackPtr]['parenthesis_closer'];
92
+ } else {
93
+ if (version_compare(PHPCSHelper::getVersion(), '2.3.4', '>=')) {
94
+ return;
95
+ }
96
+
97
+ // Deal with PHPCS 1.x which does not set the parenthesis properly for declare statements.
98
+ $openParenthesis = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($stackPtr + 1), null, false, null, true);
99
+ if ($openParenthesis === false || isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
100
+ return;
101
+ }
102
+ $closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer'];
103
+ }
104
+
105
+ $directivePtr = $phpcsFile->findNext(T_STRING, ($openParenthesis + 1), $closeParenthesis, false);
106
+ if ($directivePtr === false) {
107
+ return;
108
+ }
109
+
110
+ $directiveContent = $tokens[$directivePtr]['content'];
111
+
112
+ if (isset($this->newDirectives[$directiveContent]) === false) {
113
+ $error = 'Declare can only be used with the directives %s. Found: %s';
114
+ $data = array(
115
+ implode(', ', array_keys($this->newDirectives)),
116
+ $directiveContent,
117
+ );
118
+
119
+ $phpcsFile->addError($error, $stackPtr, 'InvalidDirectiveFound', $data);
120
+
121
+ } else {
122
+ // Check for valid directive for version.
123
+ $itemInfo = array(
124
+ 'name' => $directiveContent,
125
+ );
126
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
127
+
128
+ // Check for valid directive value.
129
+ $valuePtr = $phpcsFile->findNext($this->ignoreTokens, $directivePtr + 1, $closeParenthesis, true);
130
+ if ($valuePtr === false) {
131
+ return;
132
+ }
133
+
134
+ $this->addWarningOnInvalidValue($phpcsFile, $valuePtr, $directiveContent);
135
+ }
136
+
137
+ }//end process()
138
+
139
+
140
+ /**
141
+ * Determine whether an error/warning should be thrown for an item based on collected information.
142
+ *
143
+ * @param array $errorInfo Detail information about an item.
144
+ *
145
+ * @return bool
146
+ */
147
+ protected function shouldThrowError(array $errorInfo)
148
+ {
149
+ return ($errorInfo['not_in_version'] !== '' || $errorInfo['conditional_version'] !== '');
150
+ }
151
+
152
+
153
+ /**
154
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
155
+ *
156
+ * @param array $itemInfo Base information about the item.
157
+ *
158
+ * @return array Version and other information about the item.
159
+ */
160
+ public function getItemArray(array $itemInfo)
161
+ {
162
+ return $this->newDirectives[$itemInfo['name']];
163
+ }
164
+
165
+
166
+ /**
167
+ * Get an array of the non-PHP-version array keys used in a sub-array.
168
+ *
169
+ * @return array
170
+ */
171
+ protected function getNonVersionArrayKeys()
172
+ {
173
+ return array(
174
+ 'valid_value_callback',
175
+ 'valid_values',
176
+ );
177
+ }
178
+
179
+
180
+ /**
181
+ * Retrieve the relevant detail (version) information for use in an error message.
182
+ *
183
+ * @param array $itemArray Version and other information about the item.
184
+ * @param array $itemInfo Base information about the item.
185
+ *
186
+ * @return array
187
+ */
188
+ public function getErrorInfo(array $itemArray, array $itemInfo)
189
+ {
190
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
191
+ $errorInfo['conditional_version'] = '';
192
+ $errorInfo['condition'] = '';
193
+
194
+ $versionArray = $this->getVersionArray($itemArray);
195
+
196
+ if (empty($versionArray) === false) {
197
+ foreach ($versionArray as $version => $present) {
198
+ if (is_string($present) === true && $this->supportsBelow($version) === true) {
199
+ // We cannot test for compilation option (ok, except by scraping the output of phpinfo...).
200
+ $errorInfo['conditional_version'] = $version;
201
+ $errorInfo['condition'] = $present;
202
+ }
203
+ }
204
+ }
205
+
206
+ return $errorInfo;
207
+ }
208
+
209
+
210
+ /**
211
+ * Get the error message template for this sniff.
212
+ *
213
+ * @return string
214
+ */
215
+ protected function getErrorMsgTemplate()
216
+ {
217
+ return 'Directive ' . parent::getErrorMsgTemplate();
218
+ }
219
+
220
+
221
+ /**
222
+ * Generates the error or warning for this item.
223
+ *
224
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
225
+ * @param int $stackPtr The position of the relevant token in
226
+ * the stack.
227
+ * @param array $itemInfo Base information about the item.
228
+ * @param array $errorInfo Array with detail (version) information
229
+ * relevant to the item.
230
+ *
231
+ * @return void
232
+ */
233
+ public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
234
+ {
235
+ if ($errorInfo['not_in_version'] !== '') {
236
+ parent::addError($phpcsFile, $stackPtr, $itemInfo, $errorInfo);
237
+ } elseif ($errorInfo['conditional_version'] !== '') {
238
+ $error = 'Directive %s is present in PHP version %s but will be disregarded unless PHP is compiled with %s';
239
+ $errorCode = $this->stringToErrorCode($itemInfo['name']) . 'WithConditionFound';
240
+ $data = array(
241
+ $itemInfo['name'],
242
+ $errorInfo['conditional_version'],
243
+ $errorInfo['condition'],
244
+ );
245
+
246
+ $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
247
+ }
248
+
249
+ }//end addError()
250
+
251
+
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.
258
+ * @param string $directive The directive.
259
+ *
260
+ * @return void
261
+ */
262
+ protected function addWarningOnInvalidValue(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $directive)
263
+ {
264
+ $tokens = $phpcsFile->getTokens();
265
+
266
+ $value = $tokens[$stackPtr]['content'];
267
+ if (in_array($tokens[$stackPtr]['code'], \PHP_CodeSniffer_Tokens::$stringTokens, true) === true) {
268
+ $value = $this->stripQuotes($value);
269
+ }
270
+
271
+ $isError = false;
272
+ if (isset($this->newDirectives[$directive]['valid_values'])) {
273
+ if (in_array($value, $this->newDirectives[$directive]['valid_values']) === false) {
274
+ $isError = true;
275
+ }
276
+ } elseif (isset($this->newDirectives[$directive]['valid_value_callback'])) {
277
+ $valid = call_user_func(array($this, $this->newDirectives[$directive]['valid_value_callback']), $value);
278
+ if ($valid === false) {
279
+ $isError = true;
280
+ }
281
+ }
282
+
283
+ if ($isError === true) {
284
+ $error = 'The execution directive %s does not seem to have a valid value. Please review. Found: %s';
285
+ $errorCode = $this->stringToErrorCode($directive) . 'InvalidValueFound';
286
+ $data = array(
287
+ $directive,
288
+ $value,
289
+ );
290
+
291
+ $phpcsFile->addWarning($error, $stackPtr, $errorCode, $data);
292
+ }
293
+ }//end addWarningOnInvalidValue()
294
+
295
+
296
+ /**
297
+ * Check whether a value is numeric.
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
304
+ */
305
+ protected function isNumeric($value)
306
+ {
307
+ return is_numeric($value);
308
+ }
309
+
310
+
311
+ /**
312
+ * Check whether a value is a valid encoding.
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
319
+ */
320
+ protected function validEncoding($value)
321
+ {
322
+ static $encodings;
323
+ if (isset($encodings) === false && function_exists('mb_list_encodings')) {
324
+ $encodings = mb_list_encodings();
325
+ }
326
+
327
+ if (empty($encodings) || is_array($encodings) === false) {
328
+ // If we can't test the encoding, let it pass through.
329
+ return true;
330
+ }
331
+
332
+ return in_array($value, $encodings, true);
333
+ }
334
+
335
+
336
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionArrayDereferencingSniff.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewFunctionArrayDereferencingSniff.
18
+ *
19
+ * PHP version 5.4
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Wim Godden <wim.godden@cu.be>
24
+ */
25
+ class NewFunctionArrayDereferencingSniff extends Sniff
26
+ {
27
+ /**
28
+ * Returns an array of tokens this test wants to listen for.
29
+ *
30
+ * @return array
31
+ */
32
+ public function register()
33
+ {
34
+ return array(T_STRING);
35
+ }//end register()
36
+
37
+ /**
38
+ * Processes this test, when one of its tokens is encountered.
39
+ *
40
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
41
+ * @param int $stackPtr The position of the current token in
42
+ * the stack passed in $tokens.
43
+ *
44
+ * @return void
45
+ */
46
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
47
+ {
48
+ if ($this->supportsBelow('5.3') === false) {
49
+ return;
50
+ }
51
+
52
+ $tokens = $phpcsFile->getTokens();
53
+
54
+ // Next non-empty token should be the open parenthesis.
55
+ $openParenthesis = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
56
+ if ($openParenthesis === false || $tokens[$openParenthesis]['code'] !== T_OPEN_PARENTHESIS) {
57
+ return;
58
+ }
59
+
60
+ // Don't throw errors during live coding.
61
+ if (isset($tokens[$openParenthesis]['parenthesis_closer']) === false) {
62
+ return;
63
+ }
64
+
65
+ // Is this T_STRING really a function or method call ?
66
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
67
+ if ($prevToken !== false && in_array($tokens[$prevToken]['code'], array(T_DOUBLE_COLON, T_OBJECT_OPERATOR), true) === false) {
68
+ $ignore = array(
69
+ T_FUNCTION,
70
+ T_CONST,
71
+ T_USE,
72
+ T_NEW,
73
+ T_CLASS,
74
+ T_INTERFACE,
75
+ );
76
+
77
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
78
+ // Not a call to a PHP function or method.
79
+ return;
80
+ }
81
+ }
82
+
83
+ $closeParenthesis = $tokens[$openParenthesis]['parenthesis_closer'];
84
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($closeParenthesis + 1), null, true, null, true);
85
+ if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['type'] === 'T_OPEN_SQUARE_BRACKET') {
86
+ $phpcsFile->addError(
87
+ 'Function array dereferencing is not present in PHP version 5.3 or earlier',
88
+ $nextNonEmpty,
89
+ 'Found'
90
+ );
91
+ }
92
+
93
+ }//end process()
94
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionParametersSniff.php ADDED
@@ -0,0 +1,991 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewFunctionParametersSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\newFunctionParametersSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Wim Godden <wim.godden@cu.be>
20
+ */
21
+ class NewFunctionParametersSniff extends AbstractNewFeatureSniff
22
+ {
23
+ /**
24
+ * A list of new functions, not present in older versions.
25
+ *
26
+ * The array lists : version number with false (not present) or true (present).
27
+ * The index is the location of the parameter in the parameter list, starting at 0 !
28
+ * If's sufficient to list the first version where the function appears.
29
+ *
30
+ * @var array
31
+ */
32
+ protected $newFunctionParameters = array(
33
+ 'array_filter' => array(
34
+ 2 => array(
35
+ 'name' => 'flag',
36
+ '5.5' => false,
37
+ '5.6' => true,
38
+ ),
39
+ ),
40
+ 'array_slice' => array(
41
+ 1 => array(
42
+ 'name' => 'preserve_keys',
43
+ '5.0.1' => false,
44
+ '5.0.2' => true,
45
+ ),
46
+ ),
47
+ 'array_unique' => array(
48
+ 1 => array(
49
+ 'name' => 'sort_flags',
50
+ '5.2.8' => false,
51
+ '5.2.9' => true,
52
+ ),
53
+ ),
54
+ 'assert' => array(
55
+ 1 => array(
56
+ 'name' => 'description',
57
+ '5.4.7' => false,
58
+ '5.4.8' => true,
59
+ ),
60
+ ),
61
+ 'base64_decode' => array(
62
+ 1 => array(
63
+ 'name' => 'strict',
64
+ '5.1' => false,
65
+ '5.2' => true,
66
+ ),
67
+ ),
68
+ 'bcmod' => array(
69
+ 2 => array(
70
+ 'name' => 'scale',
71
+ '7.1' => false,
72
+ '7.2' => true,
73
+ ),
74
+ ),
75
+ 'class_implements' => array(
76
+ 1 => array(
77
+ 'name' => 'autoload',
78
+ '5.0' => false,
79
+ '5.1' => true,
80
+ ),
81
+ ),
82
+ 'class_parents' => array(
83
+ 1 => array(
84
+ 'name' => 'autoload',
85
+ '5.0' => false,
86
+ '5.1' => true,
87
+ ),
88
+ ),
89
+ 'clearstatcache' => array(
90
+ 0 => array(
91
+ 'name' => 'clear_realpath_cache',
92
+ '5.2' => false,
93
+ '5.3' => true,
94
+ ),
95
+ 1 => array(
96
+ 'name' => 'filename',
97
+ '5.2' => false,
98
+ '5.3' => true,
99
+ ),
100
+ ),
101
+ 'copy' => array(
102
+ 2 => array(
103
+ 'name' => 'context',
104
+ '5.2' => false,
105
+ '5.3' => true,
106
+ ),
107
+ ),
108
+ 'curl_multi_info_read' => array(
109
+ 1 => array(
110
+ 'name' => 'msgs_in_queue',
111
+ '5.1' => false,
112
+ '5.2' => true,
113
+ ),
114
+ ),
115
+ 'debug_backtrace' => array(
116
+ 0 => array(
117
+ 'name' => 'options',
118
+ '5.2.4' => false,
119
+ '5.2.5' => true,
120
+ ),
121
+ 1 => array(
122
+ 'name' => 'limit',
123
+ '5.3' => false,
124
+ '5.4' => true,
125
+ ),
126
+ ),
127
+ 'debug_print_backtrace' => array(
128
+ 0 => array(
129
+ 'name' => 'options',
130
+ '5.3.5' => false,
131
+ '5.3.6' => true,
132
+ ),
133
+ 1 => array(
134
+ 'name' => 'limit',
135
+ '5.3' => false,
136
+ '5.4' => true,
137
+ ),
138
+ ),
139
+ 'dirname' => array(
140
+ 1 => array(
141
+ 'name' => 'levels',
142
+ '5.6' => false,
143
+ '7.0' => true,
144
+ ),
145
+ ),
146
+ 'dns_get_record' => array(
147
+ 4 => array(
148
+ 'name' => 'raw',
149
+ '5.3' => false,
150
+ '5.4' => true,
151
+ ),
152
+ ),
153
+ 'fgetcsv' => array(
154
+ 4 => array(
155
+ 'name' => 'escape',
156
+ '5.2' => false,
157
+ '5.3' => true,
158
+ ),
159
+ ),
160
+ 'fputcsv' => array(
161
+ 4 => array(
162
+ 'name' => 'escape_char',
163
+ '5.5.3' => false,
164
+ '5.5.4' => true,
165
+ ),
166
+ ),
167
+ 'file_get_contents' => array(
168
+ 3 => array(
169
+ 'name' => 'offset',
170
+ '5.0' => false,
171
+ '5.1' => true,
172
+ ),
173
+ 4 => array(
174
+ 'name' => 'maxlen',
175
+ '5.0' => false,
176
+ '5.1' => true,
177
+ ),
178
+ ),
179
+ 'filter_input_array' => array(
180
+ 2 => array(
181
+ 'name' => 'add_empty',
182
+ '5.3' => false,
183
+ '5.4' => true,
184
+ ),
185
+ ),
186
+ 'filter_var_array' => array(
187
+ 2 => array(
188
+ 'name' => 'add_empty',
189
+ '5.3' => false,
190
+ '5.4' => true,
191
+ ),
192
+ ),
193
+ 'getenv' => array(
194
+ 1 => array(
195
+ 'name' => 'local_only',
196
+ '5.5.37' => false,
197
+ '5.5.38' => true, // Also introduced in PHP 5.6.24 and 7.0.9.
198
+ ),
199
+ ),
200
+ 'getopt' => array(
201
+ 2 => array(
202
+ 'name' => 'optind',
203
+ '7.0' => false,
204
+ '7.1' => true,
205
+ ),
206
+ ),
207
+ 'gettimeofday' => array(
208
+ 0 => array(
209
+ 'name' => 'return_float',
210
+ '5.0' => false,
211
+ '5.1' => true,
212
+ ),
213
+ ),
214
+ 'get_defined_functions' => array(
215
+ 0 => array(
216
+ 'name' => 'exclude_disabled',
217
+ '7.0.14' => false,
218
+ '7.0.15' => true,
219
+ ),
220
+ ),
221
+ 'get_headers' => array(
222
+ 2 => array(
223
+ 'name' => 'context',
224
+ '7.0' => false,
225
+ '7.1' => true,
226
+ ),
227
+ ),
228
+ 'get_html_translation_table' => array(
229
+ 2 => array(
230
+ 'name' => 'encoding',
231
+ '5.3.3' => false,
232
+ '5.3.4' => true,
233
+ ),
234
+ ),
235
+ 'get_loaded_extensions' => array(
236
+ 0 => array(
237
+ 'name' => 'zend_extensions',
238
+ '5.2.3' => false,
239
+ '5.2.4' => true,
240
+ ),
241
+ ),
242
+ 'gzcompress' => array(
243
+ 2 => array(
244
+ 'name' => 'encoding',
245
+ '5.3' => false,
246
+ '5.4' => true,
247
+ ),
248
+ ),
249
+ 'gzdeflate' => array(
250
+ 2 => array(
251
+ 'name' => 'encoding',
252
+ '5.3' => false,
253
+ '5.4' => true,
254
+ ),
255
+ ),
256
+ 'htmlentities' => array(
257
+ 3 => array(
258
+ 'name' => 'double_encode',
259
+ '5.2.2' => false,
260
+ '5.2.3' => true,
261
+ ),
262
+ ),
263
+ 'htmlspecialchars' => array(
264
+ 3 => array(
265
+ 'name' => 'double_encode',
266
+ '5.2.2' => false,
267
+ '5.2.3' => true,
268
+ ),
269
+ ),
270
+ 'http_build_query' => array(
271
+ 2 => array(
272
+ 'name' => 'arg_separator',
273
+ '5.1.1' => false,
274
+ '5.1.2' => true,
275
+ ),
276
+ 3 => array(
277
+ 'name' => 'enc_type',
278
+ '5.3' => false,
279
+ '5.4' => true,
280
+ ),
281
+ ),
282
+ 'idn_to_ascii' => array(
283
+ 2 => array(
284
+ 'name' => 'variant',
285
+ '5.3' => false,
286
+ '5.4' => true,
287
+ ),
288
+ 3 => array(
289
+ 'name' => 'idna_info',
290
+ '5.3' => false,
291
+ '5.4' => true,
292
+ ),
293
+ ),
294
+ 'idn_to_utf8' => array(
295
+ 2 => array(
296
+ 'name' => 'variant',
297
+ '5.3' => false,
298
+ '5.4' => true,
299
+ ),
300
+ 3 => array(
301
+ 'name' => 'idna_info',
302
+ '5.3' => false,
303
+ '5.4' => true,
304
+ ),
305
+ ),
306
+ 'imagecolorset' => array(
307
+ 5 => array(
308
+ 'name' => 'alpha',
309
+ '5.3' => false,
310
+ '5.4' => true,
311
+ ),
312
+ ),
313
+ 'imagepng' => array(
314
+ 2 => array(
315
+ 'name' => 'quality',
316
+ '5.1.1' => false,
317
+ '5.1.2' => true,
318
+ ),
319
+ 3 => array(
320
+ 'name' => 'filters',
321
+ '5.1.2' => false,
322
+ '5.1.3' => true,
323
+ ),
324
+ ),
325
+ 'imagerotate' => array(
326
+ 3 => array(
327
+ 'name' => 'ignore_transparent',
328
+ '5.0' => false,
329
+ '5.1' => true,
330
+ ),
331
+ ),
332
+ 'imap_open' => array(
333
+ 4 => array(
334
+ 'name' => 'n_retries',
335
+ '5.1' => false,
336
+ '5.2' => true,
337
+ ),
338
+ 5 => array(
339
+ 'name' => 'params',
340
+ '5.3.1' => false,
341
+ '5.3.2' => true,
342
+ ),
343
+ ),
344
+ 'imap_reopen' => array(
345
+ 3 => array(
346
+ 'name' => 'n_retries',
347
+ '5.1' => false,
348
+ '5.2' => true,
349
+ ),
350
+ ),
351
+ 'ini_get_all' => array(
352
+ 1 => array(
353
+ 'name' => 'details',
354
+ '5.2' => false,
355
+ '5.3' => true,
356
+ ),
357
+ ),
358
+ 'is_a' => array(
359
+ 2 => array(
360
+ 'name' => 'allow_string',
361
+ '5.3.8' => false,
362
+ '5.3.9' => true,
363
+ ),
364
+ ),
365
+ 'is_subclass_of' => array(
366
+ 2 => array(
367
+ 'name' => 'allow_string',
368
+ '5.3.8' => false,
369
+ '5.3.9' => true,
370
+ ),
371
+ ),
372
+ 'iterator_to_array' => array(
373
+ 1 => array(
374
+ 'name' => 'use_keys',
375
+ '5.2.0' => false,
376
+ '5.2.1' => true,
377
+ ),
378
+ ),
379
+ 'json_decode' => array(
380
+ 2 => array(
381
+ 'name' => 'depth',
382
+ '5.2' => false,
383
+ '5.3' => true,
384
+ ),
385
+ 3 => array(
386
+ 'name' => 'options',
387
+ '5.3' => false,
388
+ '5.4' => true,
389
+ ),
390
+ ),
391
+ 'json_encode' => array(
392
+ 1 => array(
393
+ 'name' => 'options',
394
+ '5.2' => false,
395
+ '5.3' => true,
396
+ ),
397
+ 2 => array(
398
+ 'name' => 'depth',
399
+ '5.4' => false,
400
+ '5.5' => true,
401
+ ),
402
+ ),
403
+ 'memory_get_peak_usage' => array(
404
+ 0 => array(
405
+ 'name' => 'real_usage',
406
+ '5.1' => false,
407
+ '5.2' => true,
408
+ ),
409
+ ),
410
+ 'memory_get_usage' => array(
411
+ 0 => array(
412
+ 'name' => 'real_usage',
413
+ '5.1' => false,
414
+ '5.2' => true,
415
+ ),
416
+ ),
417
+ 'mb_encode_numericentity' => array(
418
+ 3 => array(
419
+ 'name' => 'is_hex',
420
+ '5.3' => false,
421
+ '5.4' => true,
422
+ ),
423
+ ),
424
+ 'mb_strrpos' => array(
425
+ /*
426
+ * Note: the actual position is 2, but the original 3rd
427
+ * parameter 'encoding' was moved to the 4th position.
428
+ * So the only way to detect if offset is used is when
429
+ * both offset and encoding are set.
430
+ */
431
+ 3 => array(
432
+ 'name' => 'offset',
433
+ '5.1' => false,
434
+ '5.2' => true,
435
+ ),
436
+ ),
437
+ 'mssql_connect' => array(
438
+ 3 => array(
439
+ 'name' => 'new_link',
440
+ '5.0' => false,
441
+ '5.1' => true,
442
+ ),
443
+ ),
444
+ 'mysqli_commit' => array(
445
+ 1 => array(
446
+ 'name' => 'flags',
447
+ '5.4' => false,
448
+ '5.5' => true,
449
+ ),
450
+ 2 => array(
451
+ 'name' => 'name',
452
+ '5.4' => false,
453
+ '5.5' => true,
454
+ ),
455
+ ),
456
+ 'mysqli_rollback' => array(
457
+ 1 => array(
458
+ 'name' => 'flags',
459
+ '5.4' => false,
460
+ '5.5' => true,
461
+ ),
462
+ 2 => array(
463
+ 'name' => 'name',
464
+ '5.4' => false,
465
+ '5.5' => true,
466
+ ),
467
+ ),
468
+ 'nl2br' => array(
469
+ 1 => array(
470
+ 'name' => 'is_xhtml',
471
+ '5.2' => false,
472
+ '5.3' => true,
473
+ ),
474
+ ),
475
+ 'openssl_decrypt' => array(
476
+ 4 => array(
477
+ 'name' => 'iv',
478
+ '5.3.2' => false,
479
+ '5.3.3' => true,
480
+ ),
481
+ 5 => array(
482
+ 'name' => 'tag',
483
+ '7.0' => false,
484
+ '7.1' => true,
485
+ ),
486
+ 6 => array(
487
+ 'name' => 'aad',
488
+ '7.0' => false,
489
+ '7.1' => true,
490
+ ),
491
+ ),
492
+ 'openssl_encrypt' => array(
493
+ 4 => array(
494
+ 'name' => 'iv',
495
+ '5.3.2' => false,
496
+ '5.3.3' => true,
497
+ ),
498
+ 5 => array(
499
+ 'name' => 'tag',
500
+ '7.0' => false,
501
+ '7.1' => true,
502
+ ),
503
+ 6 => array(
504
+ 'name' => 'aad',
505
+ '7.0' => false,
506
+ '7.1' => true,
507
+ ),
508
+ 7 => array(
509
+ 'name' => 'tag_length',
510
+ '7.0' => false,
511
+ '7.1' => true,
512
+ ),
513
+ ),
514
+ 'openssl_open' => array(
515
+ 4 => array(
516
+ 'name' => 'method',
517
+ '5.2' => false,
518
+ '5.3' => true,
519
+ ),
520
+ 5 => array(
521
+ 'name' => 'iv',
522
+ '5.6' => false,
523
+ '7.0' => true,
524
+ ),
525
+ ),
526
+ 'openssl_pkcs7_verify' => array(
527
+ 5 => array(
528
+ 'name' => 'content',
529
+ '5.0' => false,
530
+ '5.1' => true,
531
+ ),
532
+ 6 => array(
533
+ 'name' => 'p7bfilename',
534
+ '7.1' => false,
535
+ '7.2' => true,
536
+ ),
537
+ ),
538
+ 'openssl_seal' => array(
539
+ 4 => array(
540
+ 'name' => 'method',
541
+ '5.2' => false,
542
+ '5.3' => true,
543
+ ),
544
+ 5 => array(
545
+ 'name' => 'iv',
546
+ '5.6' => false,
547
+ '7.0' => true,
548
+ ),
549
+ ),
550
+ 'openssl_verify' => array(
551
+ 3 => array(
552
+ 'name' => 'signature_alg',
553
+ '5.1' => false,
554
+ '5.2' => true,
555
+ ),
556
+ ),
557
+ 'parse_ini_file' => array(
558
+ 2 => array(
559
+ 'name' => 'scanner_mode',
560
+ '5.2' => false,
561
+ '5.3' => true,
562
+ ),
563
+ ),
564
+ 'parse_url' => array(
565
+ 1 => array(
566
+ 'name' => 'component',
567
+ '5.1.1' => false,
568
+ '5.1.2' => true,
569
+ ),
570
+ ),
571
+ 'pg_fetch_all' => array(
572
+ 1 => array(
573
+ 'name' => 'result_type',
574
+ '7.0' => false,
575
+ '7.1' => true,
576
+ ),
577
+ ),
578
+ 'pg_last_notice' => array(
579
+ 1 => array(
580
+ 'name' => 'option',
581
+ '7.0' => false,
582
+ '7.1' => true,
583
+ ),
584
+ ),
585
+ 'pg_lo_create' => array(
586
+ 1 => array(
587
+ 'name' => 'object_id',
588
+ '5.2' => false,
589
+ '5.3' => true,
590
+ ),
591
+ ),
592
+ 'pg_lo_import' => array(
593
+ 2 => array(
594
+ 'name' => 'object_id',
595
+ '5.2' => false,
596
+ '5.3' => true,
597
+ ),
598
+ ),
599
+ 'pg_select' => array(
600
+ 4 => array(
601
+ 'name' => 'result_type',
602
+ '7.0' => false,
603
+ '7.1' => true,
604
+ ),
605
+ ),
606
+ 'php_uname' => array(
607
+ 0 => array(
608
+ 'name' => 'mode',
609
+ '5.6' => false,
610
+ '7.0' => true,
611
+ ),
612
+ ),
613
+ 'preg_replace' => array(
614
+ 4 => array(
615
+ 'name' => 'count',
616
+ '5.0' => false,
617
+ '5.1' => true,
618
+ ),
619
+ ),
620
+ 'preg_replace_callback' => array(
621
+ 4 => array(
622
+ 'name' => 'count',
623
+ '5.0' => false,
624
+ '5.1' => true,
625
+ ),
626
+ ),
627
+ 'round' => array(
628
+ 2 => array(
629
+ 'name' => 'mode',
630
+ '5.2' => false,
631
+ '5.3' => true,
632
+ ),
633
+ ),
634
+ 'sem_acquire' => array(
635
+ 1 => array(
636
+ 'name' => 'nowait',
637
+ '5.6' => false,
638
+ '5.6.1' => true,
639
+ ),
640
+ ),
641
+ 'session_regenerate_id' => array(
642
+ 0 => array(
643
+ 'name' => 'delete_old_session',
644
+ '5.0' => false,
645
+ '5.1' => true,
646
+ ),
647
+ ),
648
+ 'session_set_cookie_params' => array(
649
+ 4 => array(
650
+ 'name' => 'httponly',
651
+ '5.1' => false,
652
+ '5.2' => true,
653
+ ),
654
+ ),
655
+ 'session_set_save_handler' => array(
656
+ 6 => array(
657
+ 'name' => 'create_sid',
658
+ '5.5.0' => false,
659
+ '5.5.1' => true,
660
+ ),
661
+ 7 => array(
662
+ 'name' => 'validate_sid',
663
+ '5.6' => false,
664
+ '7.0' => true,
665
+ ),
666
+ 8 => array(
667
+ 'name' => 'update_timestamp',
668
+ '5.6' => false,
669
+ '7.0' => true,
670
+ ),
671
+ ),
672
+ 'session_start' => array(
673
+ 0 => array(
674
+ 'name' => 'options',
675
+ '5.6' => false,
676
+ '7.0' => true,
677
+ ),
678
+ ),
679
+ 'setcookie' => array(
680
+ 6 => array(
681
+ 'name' => 'httponly',
682
+ '5.1' => false,
683
+ '5.2' => true,
684
+ ),
685
+ ),
686
+ 'setrawcookie' => array(
687
+ 6 => array(
688
+ 'name' => 'httponly',
689
+ '5.1' => false,
690
+ '5.2' => true,
691
+ ),
692
+ ),
693
+ 'simplexml_load_file' => array(
694
+ 4 => array(
695
+ 'name' => 'is_prefix',
696
+ '5.1' => false,
697
+ '5.2' => true,
698
+ ),
699
+ ),
700
+ 'simplexml_load_string' => array(
701
+ 4 => array(
702
+ 'name' => 'is_prefix',
703
+ '5.1' => false,
704
+ '5.2' => true,
705
+ ),
706
+ ),
707
+ 'spl_autoload_register' => array(
708
+ 2 => array(
709
+ 'name' => 'prepend',
710
+ '5.2' => false,
711
+ '5.3' => true,
712
+ ),
713
+ ),
714
+ 'stream_context_create' => array(
715
+ 1 => array(
716
+ 'name' => 'params',
717
+ '5.2' => false,
718
+ '5.3' => true,
719
+ ),
720
+ ),
721
+ 'stream_copy_to_stream' => array(
722
+ 3 => array(
723
+ 'name' => 'offset',
724
+ '5.0' => false,
725
+ '5.1' => true,
726
+ ),
727
+ ),
728
+ 'stream_get_contents' => array(
729
+ 2 => array(
730
+ 'name' => 'offset',
731
+ '5.0' => false,
732
+ '5.1' => true,
733
+ ),
734
+ ),
735
+ 'stream_wrapper_register' => array(
736
+ 2 => array(
737
+ 'name' => 'flags',
738
+ '5.2.3' => false,
739
+ '5.2.4' => true,
740
+ ),
741
+ ),
742
+ 'stristr' => array(
743
+ 2 => array(
744
+ 'name' => 'before_needle',
745
+ '5.2' => false,
746
+ '5.3' => true,
747
+ ),
748
+ ),
749
+ 'strstr' => array(
750
+ 2 => array(
751
+ 'name' => 'before_needle',
752
+ '5.2' => false,
753
+ '5.3' => true,
754
+ ),
755
+ ),
756
+ 'str_word_count' => array(
757
+ 2 => array(
758
+ 'name' => 'charlist',
759
+ '5.0' => false,
760
+ '5.1' => true,
761
+ ),
762
+ ),
763
+ 'substr_count' => array(
764
+ 2 => array(
765
+ 'name' => 'offset',
766
+ '5.0' => false,
767
+ '5.1' => true,
768
+ ),
769
+ 3 => array(
770
+ 'name' => 'length',
771
+ '5.0' => false,
772
+ '5.1' => true,
773
+ ),
774
+ ),
775
+ 'sybase_connect' => array(
776
+ 5 => array(
777
+ 'name' => 'new',
778
+ '5.2' => false,
779
+ '5.3' => true,
780
+ ),
781
+ ),
782
+ 'timezone_transitions_get' => array(
783
+ 1 => array(
784
+ 'name' => 'timestamp_begin',
785
+ '5.2' => false,
786
+ '5.3' => true,
787
+ ),
788
+ 2 => array(
789
+ 'name' => 'timestamp_end',
790
+ '5.2' => false,
791
+ '5.3' => true,
792
+ ),
793
+ ),
794
+ 'timezone_identifiers_list' => array(
795
+ 0 => array(
796
+ 'name' => 'what',
797
+ '5.2' => false,
798
+ '5.3' => true,
799
+ ),
800
+ 1 => array(
801
+ 'name' => 'country',
802
+ '5.2' => false,
803
+ '5.3' => true,
804
+ ),
805
+ ),
806
+ 'token_get_all' => array(
807
+ 1 => array(
808
+ 'name' => 'flags',
809
+ '5.6' => false,
810
+ '7.0' => true,
811
+ ),
812
+ ),
813
+ 'ucwords' => array(
814
+ 1 => array(
815
+ 'name' => 'delimiters',
816
+ '5.4.31' => false,
817
+ '5.5.15' => false,
818
+ '5.4.32' => true,
819
+ '5.5.16' => true,
820
+ ),
821
+ ),
822
+ 'unpack' => array(
823
+ 2 => array(
824
+ 'name' => 'offset',
825
+ '7.0' => false,
826
+ '7.1' => true,
827
+ ),
828
+ ),
829
+ 'unserialize' => array(
830
+ 1 => array(
831
+ 'name' => 'options',
832
+ '5.6' => false,
833
+ '7.0' => true,
834
+ ),
835
+ ),
836
+ );
837
+
838
+
839
+ /**
840
+ * Returns an array of tokens this test wants to listen for.
841
+ *
842
+ * @return array
843
+ */
844
+ public function register()
845
+ {
846
+ // Handle case-insensitivity of function names.
847
+ $this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters);
848
+
849
+ return array(T_STRING);
850
+ }//end register()
851
+
852
+ /**
853
+ * Processes this test, when one of its tokens is encountered.
854
+ *
855
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
856
+ * @param int $stackPtr The position of the current token in
857
+ * the stack passed in $tokens.
858
+ *
859
+ * @return void
860
+ */
861
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
862
+ {
863
+ $tokens = $phpcsFile->getTokens();
864
+
865
+ $ignore = array(
866
+ T_DOUBLE_COLON,
867
+ T_OBJECT_OPERATOR,
868
+ T_FUNCTION,
869
+ T_CONST,
870
+ );
871
+
872
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
873
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
874
+ // Not a call to a PHP function.
875
+ return;
876
+ }
877
+
878
+ $function = $tokens[$stackPtr]['content'];
879
+ $functionLc = strtolower($function);
880
+
881
+ if (isset($this->newFunctionParameters[$functionLc]) === false) {
882
+ return;
883
+ }
884
+
885
+ $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
886
+ if ($parameterCount === 0) {
887
+ return;
888
+ }
889
+
890
+ // If the parameter count returned > 0, we know there will be valid open parenthesis.
891
+ $openParenthesis = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
892
+ $parameterOffsetFound = $parameterCount - 1;
893
+
894
+ foreach ($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) {
895
+ if ($offset <= $parameterOffsetFound) {
896
+ $itemInfo = array(
897
+ 'name' => $function,
898
+ 'nameLc' => $functionLc,
899
+ 'offset' => $offset,
900
+ );
901
+ $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
902
+ }
903
+ }
904
+
905
+ }//end process()
906
+
907
+
908
+ /**
909
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
910
+ *
911
+ * @param array $itemInfo Base information about the item.
912
+ *
913
+ * @return array Version and other information about the item.
914
+ */
915
+ public function getItemArray(array $itemInfo)
916
+ {
917
+ return $this->newFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
918
+ }
919
+
920
+
921
+ /**
922
+ * Get an array of the non-PHP-version array keys used in a sub-array.
923
+ *
924
+ * @return array
925
+ */
926
+ protected function getNonVersionArrayKeys()
927
+ {
928
+ return array('name');
929
+ }
930
+
931
+
932
+ /**
933
+ * Retrieve the relevant detail (version) information for use in an error message.
934
+ *
935
+ * @param array $itemArray Version and other information about the item.
936
+ * @param array $itemInfo Base information about the item.
937
+ *
938
+ * @return array
939
+ */
940
+ public function getErrorInfo(array $itemArray, array $itemInfo)
941
+ {
942
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
943
+ $errorInfo['paramName'] = $itemArray['name'];
944
+
945
+ return $errorInfo;
946
+ }
947
+
948
+
949
+ /**
950
+ * Get the item name to be used for the creation of the error code.
951
+ *
952
+ * @param array $itemInfo Base information about the item.
953
+ * @param array $errorInfo Detail information about an item.
954
+ *
955
+ * @return string
956
+ */
957
+ protected function getItemName(array $itemInfo, array $errorInfo)
958
+ {
959
+ return $itemInfo['name'] . '_' . $errorInfo['paramName'];
960
+ }
961
+
962
+
963
+ /**
964
+ * Get the error message template for this sniff.
965
+ *
966
+ * @return string
967
+ */
968
+ protected function getErrorMsgTemplate()
969
+ {
970
+ return 'The function %s() does not have a parameter "%s" in PHP version %s or earlier';
971
+ }
972
+
973
+
974
+ /**
975
+ * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
976
+ *
977
+ * @param array $data The error data array which was created.
978
+ * @param array $itemInfo Base information about the item this error message applies to.
979
+ * @param array $errorInfo Detail information about an item this error message applies to.
980
+ *
981
+ * @return array
982
+ */
983
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
984
+ {
985
+ array_shift($data);
986
+ array_unshift($data, $itemInfo['name'], $errorInfo['paramName']);
987
+ return $data;
988
+ }
989
+
990
+
991
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewFunctionsSniff.php ADDED
@@ -0,0 +1,1816 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewFunctionsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\newFunctionsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Wim Godden <wim.godden@cu.be>
20
+ */
21
+ class NewFunctionsSniff extends AbstractNewFeatureSniff
22
+ {
23
+ /**
24
+ * A list of new functions, not present in older versions.
25
+ *
26
+ * The array lists : version number with false (not present) or true (present).
27
+ * If's sufficient to list the first version where the function appears.
28
+ *
29
+ * @var array(string => array(string => int|string|null))
30
+ */
31
+ protected $newFunctions = array(
32
+ 'iterator_count' => array(
33
+ '5.0' => false,
34
+ '5.1' => true,
35
+ ),
36
+ 'iterator_to_array' => array(
37
+ '5.0' => false,
38
+ '5.1' => true,
39
+ ),
40
+ 'spl_autoload_call' => array(
41
+ '5.0' => false,
42
+ '5.1' => true,
43
+ ),
44
+ 'spl_autoload_extensions' => array(
45
+ '5.0' => false,
46
+ '5.1' => true,
47
+ ),
48
+ 'spl_autoload_functions' => array(
49
+ '5.0' => false,
50
+ '5.1' => true,
51
+ ),
52
+ 'spl_autoload_register' => array(
53
+ '5.0' => false,
54
+ '5.1' => true,
55
+ ),
56
+ 'spl_autoload_unregister' => array(
57
+ '5.0' => false,
58
+ '5.1' => true,
59
+ ),
60
+ 'spl_autoload' => array(
61
+ '5.0' => false,
62
+ '5.1' => true,
63
+ ),
64
+ 'hash_hmac' => array(
65
+ '5.1.1' => false,
66
+ '5.1.2' => true,
67
+ ),
68
+ 'array_fill_keys' => array(
69
+ '5.1' => false,
70
+ '5.2' => true,
71
+ ),
72
+ 'error_get_last' => array(
73
+ '5.1' => false,
74
+ '5.2' => true,
75
+ ),
76
+ 'image_type_to_extension' => array(
77
+ '5.1' => false,
78
+ '5.2' => true,
79
+ ),
80
+ 'memory_get_peak_usage' => array(
81
+ '5.1' => false,
82
+ '5.2' => true,
83
+ ),
84
+ 'sys_get_temp_dir' => array(
85
+ '5.1' => false,
86
+ '5.2' => true,
87
+ ),
88
+ 'timezone_abbreviations_list' => array(
89
+ '5.1' => false,
90
+ '5.2' => true,
91
+ ),
92
+ 'timezone_identifiers_list' => array(
93
+ '5.1' => false,
94
+ '5.2' => true,
95
+ ),
96
+ 'timezone_name_from_abbr' => array(
97
+ '5.1' => false,
98
+ '5.2' => true,
99
+ ),
100
+ 'stream_socket_shutdown' => array(
101
+ '5.1' => false,
102
+ '5.2' => true,
103
+ ),
104
+ 'imagegrabscreen' => array(
105
+ '5.1' => false,
106
+ '5.2' => true,
107
+ ),
108
+ 'imagegrabwindow' => array(
109
+ '5.1' => false,
110
+ '5.2' => true,
111
+ ),
112
+ 'libxml_disable_entity_loader' => array(
113
+ '5.1' => false,
114
+ '5.2' => true,
115
+ ),
116
+ 'mb_stripos' => array(
117
+ '5.1' => false,
118
+ '5.2' => true,
119
+ ),
120
+ 'mb_stristr' => array(
121
+ '5.1' => false,
122
+ '5.2' => true,
123
+ ),
124
+ 'mb_strrchr' => array(
125
+ '5.1' => false,
126
+ '5.2' => true,
127
+ ),
128
+ 'mb_strrichr' => array(
129
+ '5.1' => false,
130
+ '5.2' => true,
131
+ ),
132
+ 'mb_strripos' => array(
133
+ '5.1' => false,
134
+ '5.2' => true,
135
+ ),
136
+ 'ming_setSWFCompression' => array(
137
+ '5.1' => false,
138
+ '5.2' => true,
139
+ ),
140
+ 'openssl_csr_get_public_key' => array(
141
+ '5.1' => false,
142
+ '5.2' => true,
143
+ ),
144
+ 'openssl_csr_get_subject' => array(
145
+ '5.1' => false,
146
+ '5.2' => true,
147
+ ),
148
+ 'openssl_pkey_get_details' => array(
149
+ '5.1' => false,
150
+ '5.2' => true,
151
+ ),
152
+ 'spl_object_hash' => array(
153
+ '5.1' => false,
154
+ '5.2' => true,
155
+ ),
156
+ 'iterator_apply' => array(
157
+ '5.1' => false,
158
+ '5.2' => true,
159
+ ),
160
+ 'preg_last_error' => array(
161
+ '5.1' => false,
162
+ '5.2' => true,
163
+ ),
164
+ 'pg_field_table' => array(
165
+ '5.1' => false,
166
+ '5.2' => true,
167
+ ),
168
+ 'posix_initgroups' => array(
169
+ '5.1' => false,
170
+ '5.2' => true,
171
+ ),
172
+ 'gmp_nextprime' => array(
173
+ '5.1' => false,
174
+ '5.2' => true,
175
+ ),
176
+ 'xmlwriter_full_end_element' => array(
177
+ '5.1' => false,
178
+ '5.2' => true,
179
+ ),
180
+ 'xmlwriter_write_raw' => array(
181
+ '5.1' => false,
182
+ '5.2' => true,
183
+ ),
184
+ 'xmlwriter_start_dtd_entity' => array(
185
+ '5.1' => false,
186
+ '5.2' => true,
187
+ ),
188
+ 'xmlwriter_end_dtd_entity' => array(
189
+ '5.1' => false,
190
+ '5.2' => true,
191
+ ),
192
+ 'xmlwriter_write_dtd_entity' => array(
193
+ '5.1' => false,
194
+ '5.2' => true,
195
+ ),
196
+ 'filter_has_var' => array(
197
+ '5.1' => false,
198
+ '5.2' => true,
199
+ ),
200
+ 'filter_id' => array(
201
+ '5.1' => false,
202
+ '5.2' => true,
203
+ ),
204
+ 'filter_input_array' => array(
205
+ '5.1' => false,
206
+ '5.2' => true,
207
+ ),
208
+ 'filter_input' => array(
209
+ '5.1' => false,
210
+ '5.2' => true,
211
+ ),
212
+ 'filter_list' => array(
213
+ '5.1' => false,
214
+ '5.2' => true,
215
+ ),
216
+ 'filter_var_array' => array(
217
+ '5.1' => false,
218
+ '5.2' => true,
219
+ ),
220
+ 'filter_var' => array(
221
+ '5.1' => false,
222
+ '5.2' => true,
223
+ ),
224
+ 'json_decode' => array(
225
+ '5.1' => false,
226
+ '5.2' => true,
227
+ ),
228
+ 'json_encode' => array(
229
+ '5.1' => false,
230
+ '5.2' => true,
231
+ ),
232
+ 'zip_close' => array(
233
+ '5.1' => false,
234
+ '5.2' => true,
235
+ ),
236
+ 'zip_entry_close' => array(
237
+ '5.1' => false,
238
+ '5.2' => true,
239
+ ),
240
+ 'zip_entry_compressedsize' => array(
241
+ '5.1' => false,
242
+ '5.2' => true,
243
+ ),
244
+ 'zip_entry_compressionmethod' => array(
245
+ '5.1' => false,
246
+ '5.2' => true,
247
+ ),
248
+ 'zip_entry_filesize' => array(
249
+ '5.1' => false,
250
+ '5.2' => true,
251
+ ),
252
+ 'zip_entry_name' => array(
253
+ '5.1' => false,
254
+ '5.2' => true,
255
+ ),
256
+ 'zip_entry_open' => array(
257
+ '5.1' => false,
258
+ '5.2' => true,
259
+ ),
260
+ 'zip_entry_read' => array(
261
+ '5.1' => false,
262
+ '5.2' => true,
263
+ ),
264
+ 'zip_open' => array(
265
+ '5.1' => false,
266
+ '5.2' => true,
267
+ ),
268
+ 'zip_read' => array(
269
+ '5.1' => false,
270
+ '5.2' => true,
271
+ ),
272
+
273
+ 'array_replace' => array(
274
+ '5.2' => false,
275
+ '5.3' => true,
276
+ ),
277
+ 'array_replace_recursive' => array(
278
+ '5.2' => false,
279
+ '5.3' => true,
280
+ ),
281
+ 'class_alias' => array(
282
+ '5.2' => false,
283
+ '5.3' => true,
284
+ ),
285
+ 'forward_static_call' => array(
286
+ '5.2' => false,
287
+ '5.3' => true,
288
+ ),
289
+ 'forward_static_call_array' => array(
290
+ '5.2' => false,
291
+ '5.3' => true,
292
+ ),
293
+ 'gc_collect_cycles' => array(
294
+ '5.2' => false,
295
+ '5.3' => true,
296
+ ),
297
+ 'gc_disable' => array(
298
+ '5.2' => false,
299
+ '5.3' => true,
300
+ ),
301
+ 'gc_enable' => array(
302
+ '5.2' => false,
303
+ '5.3' => true,
304
+ ),
305
+ 'gc_enabled' => array(
306
+ '5.2' => false,
307
+ '5.3' => true,
308
+ ),
309
+ 'get_called_class' => array(
310
+ '5.2' => false,
311
+ '5.3' => true,
312
+ ),
313
+ 'gethostname' => array(
314
+ '5.2' => false,
315
+ '5.3' => true,
316
+ ),
317
+ 'header_remove' => array(
318
+ '5.2' => false,
319
+ '5.3' => true,
320
+ ),
321
+ 'lcfirst' => array(
322
+ '5.2' => false,
323
+ '5.3' => true,
324
+ ),
325
+ 'parse_ini_string' => array(
326
+ '5.2' => false,
327
+ '5.3' => true,
328
+ ),
329
+ 'quoted_printable_encode' => array(
330
+ '5.2' => false,
331
+ '5.3' => true,
332
+ ),
333
+ 'str_getcsv' => array(
334
+ '5.2' => false,
335
+ '5.3' => true,
336
+ ),
337
+ 'stream_context_set_default' => array(
338
+ '5.2' => false,
339
+ '5.3' => true,
340
+ ),
341
+ 'stream_supports_lock' => array(
342
+ '5.2' => false,
343
+ '5.3' => true,
344
+ ),
345
+ 'stream_context_get_params' => array(
346
+ '5.2' => false,
347
+ '5.3' => true,
348
+ ),
349
+ 'date_add' => array(
350
+ '5.2' => false,
351
+ '5.3' => true,
352
+ ),
353
+ 'date_create_from_format' => array(
354
+ '5.2' => false,
355
+ '5.3' => true,
356
+ ),
357
+ 'date_diff' => array(
358
+ '5.2' => false,
359
+ '5.3' => true,
360
+ ),
361
+ 'date_get_last_errors' => array(
362
+ '5.2' => false,
363
+ '5.3' => true,
364
+ ),
365
+ 'date_parse_from_format' => array(
366
+ '5.2' => false,
367
+ '5.3' => true,
368
+ ),
369
+ 'date_sub' => array(
370
+ '5.2' => false,
371
+ '5.3' => true,
372
+ ),
373
+ 'timezone_version_get' => array(
374
+ '5.2' => false,
375
+ '5.3' => true,
376
+ ),
377
+ 'gmp_testbit' => array(
378
+ '5.2' => false,
379
+ '5.3' => true,
380
+ ),
381
+ 'hash_copy' => array(
382
+ '5.2' => false,
383
+ '5.3' => true,
384
+ ),
385
+ 'imap_gc' => array(
386
+ '5.2' => false,
387
+ '5.3' => true,
388
+ ),
389
+ 'imap_utf8_to_mutf7' => array(
390
+ '5.2' => false,
391
+ '5.3' => true,
392
+ ),
393
+ 'imap_mutf7_to_utf8' => array(
394
+ '5.2' => false,
395
+ '5.3' => true,
396
+ ),
397
+ 'json_last_error' => array(
398
+ '5.2' => false,
399
+ '5.3' => true,
400
+ ),
401
+ 'mysqli_get_cache_stats' => array(
402
+ '5.2' => false,
403
+ '5.3' => true,
404
+ ),
405
+ 'mysqli_fetch_all' => array(
406
+ '5.2' => false,
407
+ '5.3' => true,
408
+ ),
409
+ 'mysqli_get_connection_status' => array(
410
+ '5.2' => false,
411
+ '5.3' => true,
412
+ ),
413
+ 'mysqli_poll' => array(
414
+ '5.2' => false,
415
+ '5.3' => true,
416
+ ),
417
+ 'mysqli_read_async_query' => array(
418
+ '5.2' => false,
419
+ '5.3' => true,
420
+ ),
421
+ 'openssl_random_pseudo_bytes' => array(
422
+ '5.2' => false,
423
+ '5.3' => true,
424
+ ),
425
+ 'pcntl_signal_dispatch' => array(
426
+ '5.2' => false,
427
+ '5.3' => true,
428
+ ),
429
+ 'pcntl_sigprocmask' => array(
430
+ '5.2' => false,
431
+ '5.3' => true,
432
+ ),
433
+ 'pcntl_sigtimedwait' => array(
434
+ '5.2' => false,
435
+ '5.3' => true,
436
+ ),
437
+ 'pcntl_sigwaitinfo' => array(
438
+ '5.2' => false,
439
+ '5.3' => true,
440
+ ),
441
+ 'preg_filter' => array(
442
+ '5.2' => false,
443
+ '5.3' => true,
444
+ ),
445
+ 'msg_queue_exists' => array(
446
+ '5.2' => false,
447
+ '5.3' => true,
448
+ ),
449
+ 'shm_has_vars' => array(
450
+ '5.2' => false,
451
+ '5.3' => true,
452
+ ),
453
+ 'acosh' => array(
454
+ '5.2' => false,
455
+ '5.3' => true,
456
+ ),
457
+ 'asinh' => array(
458
+ '5.2' => false,
459
+ '5.3' => true,
460
+ ),
461
+ 'atanh' => array(
462
+ '5.2' => false,
463
+ '5.3' => true,
464
+ ),
465
+ 'expm1' => array(
466
+ '5.2' => false,
467
+ '5.3' => true,
468
+ ),
469
+ 'log1p' => array(
470
+ '5.2' => false,
471
+ '5.3' => true,
472
+ ),
473
+ 'enchant_broker_describe' => array(
474
+ '5.2' => false,
475
+ '5.3' => true,
476
+ ),
477
+ 'enchant_broker_dict_exists' => array(
478
+ '5.2' => false,
479
+ '5.3' => true,
480
+ ),
481
+ 'enchant_broker_free_dict' => array(
482
+ '5.2' => false,
483
+ '5.3' => true,
484
+ ),
485
+ 'enchant_broker_free' => array(
486
+ '5.2' => false,
487
+ '5.3' => true,
488
+ ),
489
+ 'enchant_broker_get_error' => array(
490
+ '5.2' => false,
491
+ '5.3' => true,
492
+ ),
493
+ 'enchant_broker_init' => array(
494
+ '5.2' => false,
495
+ '5.3' => true,
496
+ ),
497
+ 'enchant_broker_list_dicts' => array(
498
+ '5.2' => false,
499
+ '5.3' => true,
500
+ ),
501
+ 'enchant_broker_request_dict' => array(
502
+ '5.2' => false,
503
+ '5.3' => true,
504
+ ),
505
+ 'enchant_broker_request_pwl_dict' => array(
506
+ '5.2' => false,
507
+ '5.3' => true,
508
+ ),
509
+ 'enchant_broker_set_ordering' => array(
510
+ '5.2' => false,
511
+ '5.3' => true,
512
+ ),
513
+ 'enchant_dict_add_to_personal' => array(
514
+ '5.2' => false,
515
+ '5.3' => true,
516
+ ),
517
+ 'enchant_dict_add_to_session' => array(
518
+ '5.2' => false,
519
+ '5.3' => true,
520
+ ),
521
+ 'enchant_dict_check' => array(
522
+ '5.2' => false,
523
+ '5.3' => true,
524
+ ),
525
+ 'enchant_dict_describe' => array(
526
+ '5.2' => false,
527
+ '5.3' => true,
528
+ ),
529
+ 'enchant_dict_get_error' => array(
530
+ '5.2' => false,
531
+ '5.3' => true,
532
+ ),
533
+ 'enchant_dict_is_in_session' => array(
534
+ '5.2' => false,
535
+ '5.3' => true,
536
+ ),
537
+ 'enchant_dict_quick_check' => array(
538
+ '5.2' => false,
539
+ '5.3' => true,
540
+ ),
541
+ 'enchant_dict_store_replacement' => array(
542
+ '5.2' => false,
543
+ '5.3' => true,
544
+ ),
545
+ 'enchant_dict_suggest' => array(
546
+ '5.2' => false,
547
+ '5.3' => true,
548
+ ),
549
+ 'finfo_buffer' => array(
550
+ '5.2' => false,
551
+ '5.3' => true,
552
+ ),
553
+ 'finfo_close' => array(
554
+ '5.2' => false,
555
+ '5.3' => true,
556
+ ),
557
+ 'finfo_file' => array(
558
+ '5.2' => false,
559
+ '5.3' => true,
560
+ ),
561
+ 'finfo_open' => array(
562
+ '5.2' => false,
563
+ '5.3' => true,
564
+ ),
565
+ 'finfo_set_flags' => array(
566
+ '5.2' => false,
567
+ '5.3' => true,
568
+ ),
569
+ 'intl_error_name' => array(
570
+ '5.2' => false,
571
+ '5.3' => true,
572
+ ),
573
+ 'intl_get_error_code' => array(
574
+ '5.2' => false,
575
+ '5.3' => true,
576
+ ),
577
+ 'intl_get_error_message' => array(
578
+ '5.2' => false,
579
+ '5.3' => true,
580
+ ),
581
+ 'intl_is_failure' => array(
582
+ '5.2' => false,
583
+ '5.3' => true,
584
+ ),
585
+
586
+ 'hex2bin' => array(
587
+ '5.3' => false,
588
+ '5.4' => true,
589
+ ),
590
+ 'http_response_code' => array(
591
+ '5.3' => false,
592
+ '5.4' => true,
593
+ ),
594
+ 'get_declared_traits' => array(
595
+ '5.3' => false,
596
+ '5.4' => true,
597
+ ),
598
+ 'getimagesizefromstring' => array(
599
+ '5.3' => false,
600
+ '5.4' => true,
601
+ ),
602
+ 'stream_set_chunk_size' => array(
603
+ '5.3' => false,
604
+ '5.4' => true,
605
+ ),
606
+ 'socket_import_stream' => array(
607
+ '5.3' => false,
608
+ '5.4' => true,
609
+ ),
610
+ 'trait_exists' => array(
611
+ '5.3' => false,
612
+ '5.4' => true,
613
+ ),
614
+ 'header_register_callback' => array(
615
+ '5.3' => false,
616
+ '5.4' => true,
617
+ ),
618
+ 'class_uses' => array(
619
+ '5.3' => false,
620
+ '5.4' => true,
621
+ ),
622
+ 'session_status' => array(
623
+ '5.3' => false,
624
+ '5.4' => true,
625
+ ),
626
+ 'session_register_shutdown' => array(
627
+ '5.3' => false,
628
+ '5.4' => true,
629
+ ),
630
+ 'mysqli_error_list' => array(
631
+ '5.3' => false,
632
+ '5.4' => true,
633
+ ),
634
+ 'mysqli_stmt_error_list' => array(
635
+ '5.3' => false,
636
+ '5.4' => true,
637
+ ),
638
+ 'libxml_set_external_entity_loader' => array(
639
+ '5.3' => false,
640
+ '5.4' => true,
641
+ ),
642
+ 'ldap_control_paged_result' => array(
643
+ '5.3' => false,
644
+ '5.4' => true,
645
+ ),
646
+ 'ldap_control_paged_result_response' => array(
647
+ '5.3' => false,
648
+ '5.4' => true,
649
+ ),
650
+ 'transliteral_create' => array(
651
+ '5.3' => false,
652
+ '5.4' => true,
653
+ ),
654
+ 'transliteral_create_from_rules' => array(
655
+ '5.3' => false,
656
+ '5.4' => true,
657
+ ),
658
+ 'transliteral_create_inverse' => array(
659
+ '5.3' => false,
660
+ '5.4' => true,
661
+ ),
662
+ 'transliteral_get_error_code' => array(
663
+ '5.3' => false,
664
+ '5.4' => true,
665
+ ),
666
+ 'transliteral_get_error_message' => array(
667
+ '5.3' => false,
668
+ '5.4' => true,
669
+ ),
670
+ 'transliteral_list_ids' => array(
671
+ '5.3' => false,
672
+ '5.4' => true,
673
+ ),
674
+ 'transliteral_transliterate' => array(
675
+ '5.3' => false,
676
+ '5.4' => true,
677
+ ),
678
+ 'zlib_decode' => array(
679
+ '5.3' => false,
680
+ '5.4' => true,
681
+ ),
682
+ 'zlib_encode' => array(
683
+ '5.3' => false,
684
+ '5.4' => true,
685
+ ),
686
+
687
+ 'array_column' => array(
688
+ '5.4' => false,
689
+ '5.5' => true,
690
+ ),
691
+ 'boolval' => array(
692
+ '5.4' => false,
693
+ '5.5' => true,
694
+ ),
695
+ 'json_last_error_msg' => array(
696
+ '5.4' => false,
697
+ '5.5' => true,
698
+ ),
699
+ 'password_get_info' => array(
700
+ '5.4' => false,
701
+ '5.5' => true,
702
+ ),
703
+ 'password_hash' => array(
704
+ '5.4' => false,
705
+ '5.5' => true,
706
+ ),
707
+ 'password_needs_rehash' => array(
708
+ '5.4' => false,
709
+ '5.5' => true,
710
+ ),
711
+ 'password_verify' => array(
712
+ '5.4' => false,
713
+ '5.5' => true,
714
+ ),
715
+ 'hash_pbkdf2' => array(
716
+ '5.4' => false,
717
+ '5.5' => true,
718
+ ),
719
+ 'openssl_pbkdf2' => array(
720
+ '5.4' => false,
721
+ '5.5' => true,
722
+ ),
723
+ 'curl_escape' => array(
724
+ '5.4' => false,
725
+ '5.5' => true,
726
+ ),
727
+ 'curl_file_create' => array(
728
+ '5.4' => false,
729
+ '5.5' => true,
730
+ ),
731
+ 'curl_multi_setopt' => array(
732
+ '5.4' => false,
733
+ '5.5' => true,
734
+ ),
735
+ 'curl_multi_strerror' => array(
736
+ '5.4' => false,
737
+ '5.5' => true,
738
+ ),
739
+ 'curl_pause' => array(
740
+ '5.4' => false,
741
+ '5.5' => true,
742
+ ),
743
+ 'curl_reset' => array(
744
+ '5.4' => false,
745
+ '5.5' => true,
746
+ ),
747
+ 'curl_share_close' => array(
748
+ '5.4' => false,
749
+ '5.5' => true,
750
+ ),
751
+ 'curl_share_init' => array(
752
+ '5.4' => false,
753
+ '5.5' => true,
754
+ ),
755
+ 'curl_share_setopt' => array(
756
+ '5.4' => false,
757
+ '5.5' => true,
758
+ ),
759
+ 'curl_strerror' => array(
760
+ '5.4' => false,
761
+ '5.5' => true,
762
+ ),
763
+ 'curl_unescape' => array(
764
+ '5.4' => false,
765
+ '5.5' => true,
766
+ ),
767
+ 'imageaffinematrixconcat' => array(
768
+ '5.4' => false,
769
+ '5.5' => true,
770
+ ),
771
+ 'imageaffinematrixget' => array(
772
+ '5.4' => false,
773
+ '5.5' => true,
774
+ ),
775
+ 'imagecrop' => array(
776
+ '5.4' => false,
777
+ '5.5' => true,
778
+ ),
779
+ 'imagecropauto' => array(
780
+ '5.4' => false,
781
+ '5.5' => true,
782
+ ),
783
+ 'imageflip' => array(
784
+ '5.4' => false,
785
+ '5.5' => true,
786
+ ),
787
+ 'imagepalettetotruecolor' => array(
788
+ '5.4' => false,
789
+ '5.5' => true,
790
+ ),
791
+ 'imagescale' => array(
792
+ '5.4' => false,
793
+ '5.5' => true,
794
+ ),
795
+ 'mysqli_begin_transaction' => array(
796
+ '5.4' => false,
797
+ '5.5' => true,
798
+ ),
799
+ 'mysqli_release_savepoint' => array(
800
+ '5.4' => false,
801
+ '5.5' => true,
802
+ ),
803
+ 'mysqli_savepoint' => array(
804
+ '5.4' => false,
805
+ '5.5' => true,
806
+ ),
807
+ 'pg_escape_literal' => array(
808
+ '5.4' => false,
809
+ '5.5' => true,
810
+ ),
811
+ 'pg_escape_identifier' => array(
812
+ '5.4' => false,
813
+ '5.5' => true,
814
+ ),
815
+ 'socket_sendmsg' => array(
816
+ '5.4' => false,
817
+ '5.5' => true,
818
+ ),
819
+ 'socket_recvmsg' => array(
820
+ '5.4' => false,
821
+ '5.5' => true,
822
+ ),
823
+ 'socket_cmsg_space' => array(
824
+ '5.4' => false,
825
+ '5.5' => true,
826
+ ),
827
+ 'cli_get_process_title' => array(
828
+ '5.4' => false,
829
+ '5.5' => true,
830
+ ),
831
+ 'cli_set_process_title' => array(
832
+ '5.4' => false,
833
+ '5.5' => true,
834
+ ),
835
+ 'datefmt_format_object' => array(
836
+ '5.4' => false,
837
+ '5.5' => true,
838
+ ),
839
+ 'datefmt_get_calendar_object' => array(
840
+ '5.4' => false,
841
+ '5.5' => true,
842
+ ),
843
+ 'datefmt_get_timezone' => array(
844
+ '5.4' => false,
845
+ '5.5' => true,
846
+ ),
847
+ 'datefmt_set_timezone' => array(
848
+ '5.4' => false,
849
+ '5.5' => true,
850
+ ),
851
+ 'datefmt_get_calendar_object' => array(
852
+ '5.4' => false,
853
+ '5.5' => true,
854
+ ),
855
+ 'intlcal_create_instance' => array(
856
+ '5.4' => false,
857
+ '5.5' => true,
858
+ ),
859
+ 'intlcal_get_keyword_values_for_locale' => array(
860
+ '5.4' => false,
861
+ '5.5' => true,
862
+ ),
863
+ 'intlcal_get_now' => array(
864
+ '5.4' => false,
865
+ '5.5' => true,
866
+ ),
867
+ 'intlcal_get_available_locales' => array(
868
+ '5.4' => false,
869
+ '5.5' => true,
870
+ ),
871
+ 'intlcal_get' => array(
872
+ '5.4' => false,
873
+ '5.5' => true,
874
+ ),
875
+ 'intlcal_get_time' => array(
876
+ '5.4' => false,
877
+ '5.5' => true,
878
+ ),
879
+ 'intlcal_set_time' => array(
880
+ '5.4' => false,
881
+ '5.5' => true,
882
+ ),
883
+ 'intlcal_add' => array(
884
+ '5.4' => false,
885
+ '5.5' => true,
886
+ ),
887
+ 'intlcal_set_time_zone' => array(
888
+ '5.4' => false,
889
+ '5.5' => true,
890
+ ),
891
+ 'intlcal_after' => array(
892
+ '5.4' => false,
893
+ '5.5' => true,
894
+ ),
895
+ 'intlcal_before' => array(
896
+ '5.4' => false,
897
+ '5.5' => true,
898
+ ),
899
+ 'intlcal_set' => array(
900
+ '5.4' => false,
901
+ '5.5' => true,
902
+ ),
903
+ 'intlcal_roll' => array(
904
+ '5.4' => false,
905
+ '5.5' => true,
906
+ ),
907
+ 'intlcal_clear' => array(
908
+ '5.4' => false,
909
+ '5.5' => true,
910
+ ),
911
+ 'intlcal_field_difference' => array(
912
+ '5.4' => false,
913
+ '5.5' => true,
914
+ ),
915
+ 'intlcal_get_actual_maximum' => array(
916
+ '5.4' => false,
917
+ '5.5' => true,
918
+ ),
919
+ 'intlcal_get_actual_minumum' => array(
920
+ '5.4' => false,
921
+ '5.5' => true,
922
+ ),
923
+ 'intlcal_get_day_of_week_type' => array(
924
+ '5.4' => false,
925
+ '5.5' => true,
926
+ ),
927
+ 'intlcal_get_first_day_of_week' => array(
928
+ '5.4' => false,
929
+ '5.5' => true,
930
+ ),
931
+ 'intlcal_get_greatest_minimum' => array(
932
+ '5.4' => false,
933
+ '5.5' => true,
934
+ ),
935
+ 'intlcal_get_least_maximum' => array(
936
+ '5.4' => false,
937
+ '5.5' => true,
938
+ ),
939
+ 'intlcal_get_locale' => array(
940
+ '5.4' => false,
941
+ '5.5' => true,
942
+ ),
943
+ 'intlcal_get_maximum' => array(
944
+ '5.4' => false,
945
+ '5.5' => true,
946
+ ),
947
+ 'intlcal_get_minimal_days_in_first_week' => array(
948
+ '5.4' => false,
949
+ '5.5' => true,
950
+ ),
951
+ 'intlcal_get_minimum' => array(
952
+ '5.4' => false,
953
+ '5.5' => true,
954
+ ),
955
+ 'intlcal_get_time_zone' => array(
956
+ '5.4' => false,
957
+ '5.5' => true,
958
+ ),
959
+ 'intlcal_get_type' => array(
960
+ '5.4' => false,
961
+ '5.5' => true,
962
+ ),
963
+ 'intlcal_get_weekend_transition' => array(
964
+ '5.4' => false,
965
+ '5.5' => true,
966
+ ),
967
+ 'intlcal_in_daylight_time' => array(
968
+ '5.4' => false,
969
+ '5.5' => true,
970
+ ),
971
+ 'intlcal_is_equivalent_to' => array(
972
+ '5.4' => false,
973
+ '5.5' => true,
974
+ ),
975
+ 'intlcal_is_lenient' => array(
976
+ '5.4' => false,
977
+ '5.5' => true,
978
+ ),
979
+ 'intlcal_equals' => array(
980
+ '5.4' => false,
981
+ '5.5' => true,
982
+ ),
983
+ 'intlcal_get_repeated_wall_time_option' => array(
984
+ '5.4' => false,
985
+ '5.5' => true,
986
+ ),
987
+ 'intlcal_get_skipped_wall_time_option' => array(
988
+ '5.4' => false,
989
+ '5.5' => true,
990
+ ),
991
+ 'intlcal_set_repeated_wall_time_option' => array(
992
+ '5.4' => false,
993
+ '5.5' => true,
994
+ ),
995
+ 'intlcal_set_skipped_wall_time_option' => array(
996
+ '5.4' => false,
997
+ '5.5' => true,
998
+ ),
999
+ 'intlcal_from_date_time' => array(
1000
+ '5.4' => false,
1001
+ '5.5' => true,
1002
+ ),
1003
+ 'intlcal_to_date_time' => array(
1004
+ '5.4' => false,
1005
+ '5.5' => true,
1006
+ ),
1007
+ 'intlcal_get_error_code' => array(
1008
+ '5.4' => false,
1009
+ '5.5' => true,
1010
+ ),
1011
+ 'intlcal_get_error_message' => array(
1012
+ '5.4' => false,
1013
+ '5.5' => true,
1014
+ ),
1015
+ 'intlgregcal_create_instance' => array(
1016
+ '5.4' => false,
1017
+ '5.5' => true,
1018
+ ),
1019
+ 'intlgregcal_set_gregorian_change' => array(
1020
+ '5.4' => false,
1021
+ '5.5' => true,
1022
+ ),
1023
+ 'intlgregcal_get_gregorian_change' => array(
1024
+ '5.4' => false,
1025
+ '5.5' => true,
1026
+ ),
1027
+ 'intlgregcal_is_leap_year' => array(
1028
+ '5.4' => false,
1029
+ '5.5' => true,
1030
+ ),
1031
+ 'intlz_create_time_zone' => array(
1032
+ '5.4' => false,
1033
+ '5.5' => true,
1034
+ ),
1035
+ 'intlz_create_default' => array(
1036
+ '5.4' => false,
1037
+ '5.5' => true,
1038
+ ),
1039
+ 'intlz_get_id' => array(
1040
+ '5.4' => false,
1041
+ '5.5' => true,
1042
+ ),
1043
+ 'intlz_get_gmt' => array(
1044
+ '5.4' => false,
1045
+ '5.5' => true,
1046
+ ),
1047
+ 'intlz_get_unknown' => array(
1048
+ '5.4' => false,
1049
+ '5.5' => true,
1050
+ ),
1051
+ 'intlz_create_enumeration' => array(
1052
+ '5.4' => false,
1053
+ '5.5' => true,
1054
+ ),
1055
+ 'intlz_count_equivalent_ids' => array(
1056
+ '5.4' => false,
1057
+ '5.5' => true,
1058
+ ),
1059
+ 'intlz_create_time_zone_id_enumeration' => array(
1060
+ '5.4' => false,
1061
+ '5.5' => true,
1062
+ ),
1063
+ 'intlz_get_canonical_id' => array(
1064
+ '5.4' => false,
1065
+ '5.5' => true,
1066
+ ),
1067
+ 'intlz_get_region' => array(
1068
+ '5.4' => false,
1069
+ '5.5' => true,
1070
+ ),
1071
+ 'intlz_get_tz_data_version' => array(
1072
+ '5.4' => false,
1073
+ '5.5' => true,
1074
+ ),
1075
+ 'intlz_get_equivalent_id' => array(
1076
+ '5.4' => false,
1077
+ '5.5' => true,
1078
+ ),
1079
+ 'intlz_use_daylight_time' => array(
1080
+ '5.4' => false,
1081
+ '5.5' => true,
1082
+ ),
1083
+ 'intlz_get_offset' => array(
1084
+ '5.4' => false,
1085
+ '5.5' => true,
1086
+ ),
1087
+ 'intlz_get_raw_offset' => array(
1088
+ '5.4' => false,
1089
+ '5.5' => true,
1090
+ ),
1091
+ 'intlz_has_same_rules' => array(
1092
+ '5.4' => false,
1093
+ '5.5' => true,
1094
+ ),
1095
+ 'intlz_get_display_name' => array(
1096
+ '5.4' => false,
1097
+ '5.5' => true,
1098
+ ),
1099
+ 'intlz_get_dst_savings' => array(
1100
+ '5.4' => false,
1101
+ '5.5' => true,
1102
+ ),
1103
+ 'intlz_from_date_time_zone' => array(
1104
+ '5.4' => false,
1105
+ '5.5' => true,
1106
+ ),
1107
+ 'intlz_to_date_time_zone' => array(
1108
+ '5.4' => false,
1109
+ '5.5' => true,
1110
+ ),
1111
+ 'intlz_get_error_code' => array(
1112
+ '5.4' => false,
1113
+ '5.5' => true,
1114
+ ),
1115
+ 'intlz_get_error_message' => array(
1116
+ '5.4' => false,
1117
+ '5.5' => true,
1118
+ ),
1119
+
1120
+ 'gmp_root' => array(
1121
+ '5.5' => false,
1122
+ '5.6' => true,
1123
+ ),
1124
+ 'gmp_rootrem' => array(
1125
+ '5.5' => false,
1126
+ '5.6' => true,
1127
+ ),
1128
+ 'hash_equals' => array(
1129
+ '5.5' => false,
1130
+ '5.6' => true,
1131
+ ),
1132
+ 'ldap_escape' => array(
1133
+ '5.5' => false,
1134
+ '5.6' => true,
1135
+ ),
1136
+ 'ldap_modify_batch' => array(
1137
+ '5.4.25' => false,
1138
+ '5.5.9' => false,
1139
+ '5.4.26' => true,
1140
+ '5.5.10' => true,
1141
+ '5.6.0' => true,
1142
+ ),
1143
+ 'mysqli_get_links_stats' => array(
1144
+ '5.5' => false,
1145
+ '5.6' => true,
1146
+ ),
1147
+ 'openssl_get_cert_locations' => array(
1148
+ '5.5' => false,
1149
+ '5.6' => true,
1150
+ ),
1151
+ 'openssl_x509_fingerprint' => array(
1152
+ '5.5' => false,
1153
+ '5.6' => true,
1154
+ ),
1155
+ 'openssl_spki_new' => array(
1156
+ '5.5' => false,
1157
+ '5.6' => true,
1158
+ ),
1159
+ 'openssl_spki_verify' => array(
1160
+ '5.5' => false,
1161
+ '5.6' => true,
1162
+ ),
1163
+ 'openssl_spki_export_challenge' => array(
1164
+ '5.5' => false,
1165
+ '5.6' => true,
1166
+ ),
1167
+ 'openssl_spki_export' => array(
1168
+ '5.5' => false,
1169
+ '5.6' => true,
1170
+ ),
1171
+ 'pg_connect_poll' => array(
1172
+ '5.5' => false,
1173
+ '5.6' => true,
1174
+ ),
1175
+ 'pg_consume_input' => array(
1176
+ '5.5' => false,
1177
+ '5.6' => true,
1178
+ ),
1179
+ 'pg_flush' => array(
1180
+ '5.5' => false,
1181
+ '5.6' => true,
1182
+ ),
1183
+ 'pg_lo_truncate' => array(
1184
+ '5.5' => false,
1185
+ '5.6' => true,
1186
+ ),
1187
+ 'pg_socket' => array(
1188
+ '5.5' => false,
1189
+ '5.6' => true,
1190
+ ),
1191
+ 'session_abort' => array(
1192
+ '5.5' => false,
1193
+ '5.6' => true,
1194
+ ),
1195
+ 'session_reset' => array(
1196
+ '5.5' => false,
1197
+ '5.6' => true,
1198
+ ),
1199
+
1200
+ 'random_bytes' => array(
1201
+ '5.6' => false,
1202
+ '7.0' => true,
1203
+ ),
1204
+ 'random_int' => array(
1205
+ '5.6' => false,
1206
+ '7.0' => true,
1207
+ ),
1208
+ 'error_clear_last' => array(
1209
+ '5.6' => false,
1210
+ '7.0' => true,
1211
+ ),
1212
+ 'gmp_random_seed' => array(
1213
+ '5.6' => false,
1214
+ '7.0' => true,
1215
+ ),
1216
+ 'intdiv' => array(
1217
+ '5.6' => false,
1218
+ '7.0' => true,
1219
+ ),
1220
+ 'preg_replace_callback_array' => array(
1221
+ '5.6' => false,
1222
+ '7.0' => true,
1223
+ ),
1224
+ 'gc_mem_caches' => array(
1225
+ '5.6' => false,
1226
+ '7.0' => true,
1227
+ ),
1228
+ 'get_resources' => array(
1229
+ '5.6' => false,
1230
+ '7.0' => true,
1231
+ ),
1232
+ 'posix_setrlimit' => array(
1233
+ '5.6' => false,
1234
+ '7.0' => true,
1235
+ ),
1236
+ 'inflate_add' => array(
1237
+ '5.6' => false,
1238
+ '7.0' => true,
1239
+ ),
1240
+ 'deflate_add' => array(
1241
+ '5.6' => false,
1242
+ '7.0' => true,
1243
+ ),
1244
+ 'inflate_init' => array(
1245
+ '5.6' => false,
1246
+ '7.0' => true,
1247
+ ),
1248
+ 'deflate_init' => array(
1249
+ '5.6' => false,
1250
+ '7.0' => true,
1251
+ ),
1252
+
1253
+ 'socket_export_stream' => array(
1254
+ '7.0.6' => false,
1255
+ '7.0.7' => true,
1256
+ ),
1257
+
1258
+ 'curl_multi_errno' => array(
1259
+ '7.0' => false,
1260
+ '7.1' => true,
1261
+ ),
1262
+ 'curl_share_errno' => array(
1263
+ '7.0' => false,
1264
+ '7.1' => true,
1265
+ ),
1266
+ 'curl_share_strerror' => array(
1267
+ '7.0' => false,
1268
+ '7.1' => true,
1269
+ ),
1270
+ 'is_iterable' => array(
1271
+ '7.0' => false,
1272
+ '7.1' => true,
1273
+ ),
1274
+ 'pcntl_async_signals' => array(
1275
+ '7.0' => false,
1276
+ '7.1' => true,
1277
+ ),
1278
+ 'session_create_id' => array(
1279
+ '7.0' => false,
1280
+ '7.1' => true,
1281
+ ),
1282
+ 'session_gc' => array(
1283
+ '7.0' => false,
1284
+ '7.1' => true,
1285
+ ),
1286
+
1287
+ 'oci_register_taf_callback' => array(
1288
+ '7.1.6' => false,
1289
+ '7.1.7' => true,
1290
+ ),
1291
+ 'oci_unregister_taf_callback' => array(
1292
+ '7.1.8' => false,
1293
+ '7.1.9' => true,
1294
+ ),
1295
+
1296
+ 'stream_isatty' => array(
1297
+ '7.1' => false,
1298
+ '7.2' => true,
1299
+ ),
1300
+ 'sapi_windows_vt100_support' => array(
1301
+ '7.1' => false,
1302
+ '7.2' => true,
1303
+ ),
1304
+ 'ftp_append' => array(
1305
+ '7.1' => false,
1306
+ '7.2' => true,
1307
+ ),
1308
+ 'hash_hmac_algos' => array(
1309
+ '7.1' => false,
1310
+ '7.2' => true,
1311
+ ),
1312
+ 'imagebmp' => array(
1313
+ '7.1' => false,
1314
+ '7.2' => true,
1315
+ ),
1316
+ 'imagecreatefrombmp' => array(
1317
+ '7.1' => false,
1318
+ '7.2' => true,
1319
+ ),
1320
+ 'imagegetclip' => array(
1321
+ '7.1' => false,
1322
+ '7.2' => true,
1323
+ ),
1324
+ 'imageopenpolygon' => array(
1325
+ '7.1' => false,
1326
+ '7.2' => true,
1327
+ ),
1328
+ 'imageresolution' => array(
1329
+ '7.1' => false,
1330
+ '7.2' => true,
1331
+ ),
1332
+ 'imagesetclip' => array(
1333
+ '7.1' => false,
1334
+ '7.2' => true,
1335
+ ),
1336
+ 'ldap_exop' => array(
1337
+ '7.1' => false,
1338
+ '7.2' => true,
1339
+ ),
1340
+ 'ldap_exop_passwd' => array(
1341
+ '7.1' => false,
1342
+ '7.2' => true,
1343
+ ),
1344
+ 'ldap_exop_whoami' => array(
1345
+ '7.1' => false,
1346
+ '7.2' => true,
1347
+ ),
1348
+ 'ldap_parse_exop' => array(
1349
+ '7.1' => false,
1350
+ '7.2' => true,
1351
+ ),
1352
+ 'mb_chr' => array(
1353
+ '7.1' => false,
1354
+ '7.2' => true,
1355
+ ),
1356
+ 'mb_ord' => array(
1357
+ '7.1' => false,
1358
+ '7.2' => true,
1359
+ ),
1360
+ 'mb_scrub' => array(
1361
+ '7.1' => false,
1362
+ '7.2' => true,
1363
+ ),
1364
+ 'socket_addrinfo_lookup' => array(
1365
+ '7.1' => false,
1366
+ '7.2' => true,
1367
+ ),
1368
+ 'socket_addrinfo_connect' => array(
1369
+ '7.1' => false,
1370
+ '7.2' => true,
1371
+ ),
1372
+ 'socket_addrinfo_bind' => array(
1373
+ '7.1' => false,
1374
+ '7.2' => true,
1375
+ ),
1376
+ 'socket_addrinfo_explain' => array(
1377
+ '7.1' => false,
1378
+ '7.2' => true,
1379
+ ),
1380
+ 'spl_object_id' => array(
1381
+ '7.1' => false,
1382
+ '7.2' => true,
1383
+ ),
1384
+ 'sodium_add' => array(
1385
+ '7.1' => false,
1386
+ '7.2' => true,
1387
+ ),
1388
+ 'sodium_base642bin' => array(
1389
+ '7.1' => false,
1390
+ '7.2' => true,
1391
+ ),
1392
+ 'sodium_bin2base64' => array(
1393
+ '7.1' => false,
1394
+ '7.2' => true,
1395
+ ),
1396
+ 'sodium_bin2hex' => array(
1397
+ '7.1' => false,
1398
+ '7.2' => true,
1399
+ ),
1400
+ 'sodium_compare' => array(
1401
+ '7.1' => false,
1402
+ '7.2' => true,
1403
+ ),
1404
+ 'sodium_crypto_aead_aes256gcm_decrypt' => array(
1405
+ '7.1' => false,
1406
+ '7.2' => true,
1407
+ ),
1408
+ 'sodium_crypto_aead_aes256gcm_encrypt' => array(
1409
+ '7.1' => false,
1410
+ '7.2' => true,
1411
+ ),
1412
+ 'sodium_crypto_aead_aes256gcm_is_available' => array(
1413
+ '7.1' => false,
1414
+ '7.2' => true,
1415
+ ),
1416
+ 'sodium_crypto_aead_aes256gcm_keygen' => array(
1417
+ '7.1' => false,
1418
+ '7.2' => true,
1419
+ ),
1420
+ 'sodium_crypto_aead_chacha20poly1305_decrypt' => array(
1421
+ '7.1' => false,
1422
+ '7.2' => true,
1423
+ ),
1424
+ 'sodium_crypto_aead_chacha20poly1305_encrypt' => array(
1425
+ '7.1' => false,
1426
+ '7.2' => true,
1427
+ ),
1428
+ 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => array(
1429
+ '7.1' => false,
1430
+ '7.2' => true,
1431
+ ),
1432
+ 'sodium_crypto_aead_chacha20poly1305_ietf_encrypt' => array(
1433
+ '7.1' => false,
1434
+ '7.2' => true,
1435
+ ),
1436
+ 'sodium_crypto_aead_chacha20poly1305_ietf_keygen' => array(
1437
+ '7.1' => false,
1438
+ '7.2' => true,
1439
+ ),
1440
+ 'sodium_crypto_aead_chacha20poly1305_keygen' => array(
1441
+ '7.1' => false,
1442
+ '7.2' => true,
1443
+ ),
1444
+ 'sodium_crypto_aead_xchacha20poly1305_ietf_decrypt' => array(
1445
+ '7.1' => false,
1446
+ '7.2' => true,
1447
+ ),
1448
+ 'sodium_crypto_aead_xchacha20poly1305_ietf_encrypt' => array(
1449
+ '7.1' => false,
1450
+ '7.2' => true,
1451
+ ),
1452
+ 'sodium_crypto_aead_xchacha20poly1305_ietf_keygen' => array(
1453
+ '7.1' => false,
1454
+ '7.2' => true,
1455
+ ),
1456
+ 'sodium_crypto_auth_keygen' => array(
1457
+ '7.1' => false,
1458
+ '7.2' => true,
1459
+ ),
1460
+ 'sodium_crypto_auth_verify' => array(
1461
+ '7.1' => false,
1462
+ '7.2' => true,
1463
+ ),
1464
+ 'sodium_crypto_auth' => array(
1465
+ '7.1' => false,
1466
+ '7.2' => true,
1467
+ ),
1468
+ 'sodium_crypto_box_keypair_from_secretkey_and_publickey' => array(
1469
+ '7.1' => false,
1470
+ '7.2' => true,
1471
+ ),
1472
+ 'sodium_crypto_box_keypair' => array(
1473
+ '7.1' => false,
1474
+ '7.2' => true,
1475
+ ),
1476
+ 'sodium_crypto_box_open' => array(
1477
+ '7.1' => false,
1478
+ '7.2' => true,
1479
+ ),
1480
+ 'sodium_crypto_box_publickey_from_secretkey' => array(
1481
+ '7.1' => false,
1482
+ '7.2' => true,
1483
+ ),
1484
+ 'sodium_crypto_box_publickey' => array(
1485
+ '7.1' => false,
1486
+ '7.2' => true,
1487
+ ),
1488
+ 'sodium_crypto_box_seal_open' => array(
1489
+ '7.1' => false,
1490
+ '7.2' => true,
1491
+ ),
1492
+ 'sodium_crypto_box_seal' => array(
1493
+ '7.1' => false,
1494
+ '7.2' => true,
1495
+ ),
1496
+ 'sodium_crypto_box_secretkey' => array(
1497
+ '7.1' => false,
1498
+ '7.2' => true,
1499
+ ),
1500
+ 'sodium_crypto_box_seed_keypair' => array(
1501
+ '7.1' => false,
1502
+ '7.2' => true,
1503
+ ),
1504
+ 'sodium_crypto_box' => array(
1505
+ '7.1' => false,
1506
+ '7.2' => true,
1507
+ ),
1508
+ 'sodium_crypto_generichash_final' => array(
1509
+ '7.1' => false,
1510
+ '7.2' => true,
1511
+ ),
1512
+ 'sodium_crypto_generichash_init' => array(
1513
+ '7.1' => false,
1514
+ '7.2' => true,
1515
+ ),
1516
+ 'sodium_crypto_generichash_keygen' => array(
1517
+ '7.1' => false,
1518
+ '7.2' => true,
1519
+ ),
1520
+ 'sodium_crypto_generichash_update' => array(
1521
+ '7.1' => false,
1522
+ '7.2' => true,
1523
+ ),
1524
+ 'sodium_crypto_generichash' => array(
1525
+ '7.1' => false,
1526
+ '7.2' => true,
1527
+ ),
1528
+ 'sodium_crypto_kdf_derive_from_key' => array(
1529
+ '7.1' => false,
1530
+ '7.2' => true,
1531
+ ),
1532
+ 'sodium_crypto_kdf_keygen' => array(
1533
+ '7.1' => false,
1534
+ '7.2' => true,
1535
+ ),
1536
+ 'sodium_crypto_kx_client_session_keys' => array(
1537
+ '7.1' => false,
1538
+ '7.2' => true,
1539
+ ),
1540
+ 'sodium_crypto_kx_keypair' => array(
1541
+ '7.1' => false,
1542
+ '7.2' => true,
1543
+ ),
1544
+ 'sodium_crypto_kx_publickey' => array(
1545
+ '7.1' => false,
1546
+ '7.2' => true,
1547
+ ),
1548
+ 'sodium_crypto_kx_secretkey' => array(
1549
+ '7.1' => false,
1550
+ '7.2' => true,
1551
+ ),
1552
+ 'sodium_crypto_kx_seed_keypair' => array(
1553
+ '7.1' => false,
1554
+ '7.2' => true,
1555
+ ),
1556
+ 'sodium_crypto_kx_server_session_keys' => array(
1557
+ '7.1' => false,
1558
+ '7.2' => true,
1559
+ ),
1560
+ 'sodium_crypto_pwhash_scryptsalsa208sha256_str_verify' => array(
1561
+ '7.1' => false,
1562
+ '7.2' => true,
1563
+ ),
1564
+ 'sodium_crypto_pwhash_scryptsalsa208sha256_str' => array(
1565
+ '7.1' => false,
1566
+ '7.2' => true,
1567
+ ),
1568
+ 'sodium_crypto_pwhash_scryptsalsa208sha256' => array(
1569
+ '7.1' => false,
1570
+ '7.2' => true,
1571
+ ),
1572
+ 'sodium_crypto_pwhash_str_needs_rehash' => array(
1573
+ '7.1' => false,
1574
+ '7.2' => true,
1575
+ ),
1576
+ 'sodium_crypto_pwhash_str_verify' => array(
1577
+ '7.1' => false,
1578
+ '7.2' => true,
1579
+ ),
1580
+ 'sodium_crypto_pwhash_str' => array(
1581
+ '7.1' => false,
1582
+ '7.2' => true,
1583
+ ),
1584
+ 'sodium_crypto_pwhash' => array(
1585
+ '7.1' => false,
1586
+ '7.2' => true,
1587
+ ),
1588
+ 'sodium_crypto_scalarmult_base' => array(
1589
+ '7.1' => false,
1590
+ '7.2' => true,
1591
+ ),
1592
+ 'sodium_crypto_scalarmult' => array(
1593
+ '7.1' => false,
1594
+ '7.2' => true,
1595
+ ),
1596
+ 'sodium_crypto_secretbox_keygen' => array(
1597
+ '7.1' => false,
1598
+ '7.2' => true,
1599
+ ),
1600
+ 'sodium_crypto_secretbox_open' => array(
1601
+ '7.1' => false,
1602
+ '7.2' => true,
1603
+ ),
1604
+ 'sodium_crypto_secretbox' => array(
1605
+ '7.1' => false,
1606
+ '7.2' => true,
1607
+ ),
1608
+ 'sodium_crypto_secretstream_xchacha20poly1305_init_pull' => array(
1609
+ '7.1' => false,
1610
+ '7.2' => true,
1611
+ ),
1612
+ 'sodium_crypto_secretstream_xchacha20poly1305_init_push' => array(
1613
+ '7.1' => false,
1614
+ '7.2' => true,
1615
+ ),
1616
+ 'sodium_crypto_secretstream_xchacha20poly1305_keygen' => array(
1617
+ '7.1' => false,
1618
+ '7.2' => true,
1619
+ ),
1620
+ 'sodium_crypto_secretstream_xchacha20poly1305_pull' => array(
1621
+ '7.1' => false,
1622
+ '7.2' => true,
1623
+ ),
1624
+ 'sodium_crypto_secretstream_xchacha20poly1305_push' => array(
1625
+ '7.1' => false,
1626
+ '7.2' => true,
1627
+ ),
1628
+ 'sodium_crypto_secretstream_xchacha20poly1305_rekey' => array(
1629
+ '7.1' => false,
1630
+ '7.2' => true,
1631
+ ),
1632
+ 'sodium_crypto_shorthash_keygen' => array(
1633
+ '7.1' => false,
1634
+ '7.2' => true,
1635
+ ),
1636
+ 'sodium_crypto_shorthash' => array(
1637
+ '7.1' => false,
1638
+ '7.2' => true,
1639
+ ),
1640
+ 'sodium_crypto_sign_detached' => array(
1641
+ '7.1' => false,
1642
+ '7.2' => true,
1643
+ ),
1644
+ 'sodium_crypto_sign_ed25519_pk_to_curve25519' => array(
1645
+ '7.1' => false,
1646
+ '7.2' => true,
1647
+ ),
1648
+ 'sodium_crypto_sign_ed25519_sk_to_curve25519' => array(
1649
+ '7.1' => false,
1650
+ '7.2' => true,
1651
+ ),
1652
+ 'sodium_crypto_sign_keypair_from_secretkey_and_publickey' => array(
1653
+ '7.1' => false,
1654
+ '7.2' => true,
1655
+ ),
1656
+ 'sodium_crypto_sign_keypair' => array(
1657
+ '7.1' => false,
1658
+ '7.2' => true,
1659
+ ),
1660
+ 'sodium_crypto_sign_open' => array(
1661
+ '7.1' => false,
1662
+ '7.2' => true,
1663
+ ),
1664
+ 'sodium_crypto_sign_publickey_from_secretkey' => array(
1665
+ '7.1' => false,
1666
+ '7.2' => true,
1667
+ ),
1668
+ 'sodium_crypto_sign_publickey' => array(
1669
+ '7.1' => false,
1670
+ '7.2' => true,
1671
+ ),
1672
+ 'sodium_crypto_sign_secretkey' => array(
1673
+ '7.1' => false,
1674
+ '7.2' => true,
1675
+ ),
1676
+ 'sodium_crypto_sign_seed_keypair' => array(
1677
+ '7.1' => false,
1678
+ '7.2' => true,
1679
+ ),
1680
+ 'sodium_crypto_sign_verify_detached' => array(
1681
+ '7.1' => false,
1682
+ '7.2' => true,
1683
+ ),
1684
+ 'sodium_crypto_sign' => array(
1685
+ '7.1' => false,
1686
+ '7.2' => true,
1687
+ ),
1688
+ 'sodium_crypto_stream_keygen' => array(
1689
+ '7.1' => false,
1690
+ '7.2' => true,
1691
+ ),
1692
+ 'sodium_crypto_stream_xor' => array(
1693
+ '7.1' => false,
1694
+ '7.2' => true,
1695
+ ),
1696
+ 'sodium_crypto_stream' => array(
1697
+ '7.1' => false,
1698
+ '7.2' => true,
1699
+ ),
1700
+ 'sodium_hex2bin' => array(
1701
+ '7.1' => false,
1702
+ '7.2' => true,
1703
+ ),
1704
+ 'sodium_increment' => array(
1705
+ '7.1' => false,
1706
+ '7.2' => true,
1707
+ ),
1708
+ 'sodium_memcmp' => array(
1709
+ '7.1' => false,
1710
+ '7.2' => true,
1711
+ ),
1712
+ 'sodium_memzero' => array(
1713
+ '7.1' => false,
1714
+ '7.2' => true,
1715
+ ),
1716
+ 'sodium_pad' => array(
1717
+ '7.1' => false,
1718
+ '7.2' => true,
1719
+ ),
1720
+ 'sodium_unpad' => array(
1721
+ '7.1' => false,
1722
+ '7.2' => true,
1723
+ ),
1724
+
1725
+ 'is_countable' => array(
1726
+ '7.2' => false,
1727
+ '7.3' => true,
1728
+ ),
1729
+ );
1730
+
1731
+
1732
+ /**
1733
+ * Returns an array of tokens this test wants to listen for.
1734
+ *
1735
+ * @return array
1736
+ */
1737
+ public function register()
1738
+ {
1739
+ // Handle case-insensitivity of function names.
1740
+ $this->newFunctions = $this->arrayKeysToLowercase($this->newFunctions);
1741
+
1742
+ return array(T_STRING);
1743
+
1744
+ }//end register()
1745
+
1746
+ /**
1747
+ * Processes this test, when one of its tokens is encountered.
1748
+ *
1749
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
1750
+ * @param int $stackPtr The position of the current token in
1751
+ * the stack passed in $tokens.
1752
+ *
1753
+ * @return void
1754
+ */
1755
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
1756
+ {
1757
+ $tokens = $phpcsFile->getTokens();
1758
+
1759
+ $ignore = array(
1760
+ T_DOUBLE_COLON,
1761
+ T_OBJECT_OPERATOR,
1762
+ T_FUNCTION,
1763
+ T_CONST,
1764
+ );
1765
+
1766
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
1767
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
1768
+ // Not a call to a PHP function.
1769
+ return;
1770
+
1771
+ } elseif ($tokens[$prevToken]['code'] === T_NS_SEPARATOR && $tokens[$prevToken - 1]['code'] === T_STRING) {
1772
+ // Namespaced function.
1773
+ return;
1774
+ }
1775
+
1776
+ $function = $tokens[$stackPtr]['content'];
1777
+ $functionLc = strtolower($function);
1778
+
1779
+ if (isset($this->newFunctions[$functionLc]) === false) {
1780
+ return;
1781
+ }
1782
+
1783
+ $itemInfo = array(
1784
+ 'name' => $function,
1785
+ 'nameLc' => $functionLc,
1786
+ );
1787
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
1788
+
1789
+ }//end process()
1790
+
1791
+
1792
+ /**
1793
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
1794
+ *
1795
+ * @param array $itemInfo Base information about the item.
1796
+ *
1797
+ * @return array Version and other information about the item.
1798
+ */
1799
+ public function getItemArray(array $itemInfo)
1800
+ {
1801
+ return $this->newFunctions[$itemInfo['nameLc']];
1802
+ }
1803
+
1804
+
1805
+ /**
1806
+ * Get the error message template for this sniff.
1807
+ *
1808
+ * @return string
1809
+ */
1810
+ protected function getErrorMsgTemplate()
1811
+ {
1812
+ return 'The function %s() is not present in PHP version %s or earlier';
1813
+ }
1814
+
1815
+
1816
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewGeneratorReturnSniff.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\NewGeneratorReturnSniff.
19
+ *
20
+ * As of PHP 7.0, a return statement can be used within a generator for a final expression to be returned.
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 NewGeneratorReturnSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * Returns an array of tokens this test wants to listen for.
33
+ *
34
+ * @return array
35
+ */
36
+ public function register()
37
+ {
38
+ $targets = array();
39
+
40
+ /*
41
+ * The `yield` keyword was introduced in PHP 5.5 with the token T_YIELD.
42
+ * The `yield from` keyword was introduced in PHP 7.0 and tokenizes as
43
+ * "T_YIELD T_WHITESPACE T_STRING".
44
+ *
45
+ * Pre-PHPCS 3.1.0, the T_YIELD token was not back-filled for PHP < 5.5.
46
+ * Also, as of PHPCS 3.1.0, the PHPCS tokenizer adds a new T_YIELD_FROM
47
+ * token.
48
+ *
49
+ * So for PHP 5.3-5.4 icw PHPCS < 3.1.0, we need to look for T_STRING with content "yield".
50
+ * For PHP 5.5+ we need to look for T_YIELD.
51
+ * For PHPCS 3.1.0+, we also need to look for T_YIELD_FROM.
52
+ */
53
+ if (version_compare(PHP_VERSION_ID, '50500', '<') === true
54
+ && version_compare(PHPCSHelper::getVersion(), '3.1.0', '<') === true
55
+ ) {
56
+ $targets[] = T_STRING;
57
+ }
58
+
59
+ if (defined('T_YIELD')) {
60
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_yieldFound
61
+ $targets[] = T_YIELD;
62
+ }
63
+
64
+ if (defined('T_YIELD_FROM')) {
65
+ $targets[] = T_YIELD_FROM;
66
+ }
67
+
68
+ return $targets;
69
+ }
70
+
71
+ /**
72
+ * Processes this test, when one of its tokens is encountered.
73
+ *
74
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
75
+ * @param int $stackPtr The position of the current token in the
76
+ * stack passed in $tokens.
77
+ *
78
+ * @return void|int Void or a stack pointer to skip forward.
79
+ */
80
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
81
+ {
82
+ if ($this->supportsBelow('5.6') !== true) {
83
+ return;
84
+ }
85
+
86
+ $tokens = $phpcsFile->getTokens();
87
+
88
+ if ($tokens[$stackPtr]['code'] === T_STRING
89
+ && $tokens[$stackPtr]['content'] !== 'yield'
90
+ ) {
91
+ return;
92
+ }
93
+
94
+ $function = $phpcsFile->getCondition($stackPtr, T_FUNCTION);
95
+ if ($function === false) {
96
+ // Try again, but now for a closure.
97
+ $function = $phpcsFile->getCondition($stackPtr, T_CLOSURE);
98
+ }
99
+
100
+ if ($function === false) {
101
+ // Yield outside function scope, fatal error, but not our concern.
102
+ return;
103
+ }
104
+
105
+ if (isset($tokens[$function]['scope_opener'], $tokens[$function]['scope_closer']) === false) {
106
+ // Can't reliably determine start/end of function scope.
107
+ return;
108
+ }
109
+
110
+ $hasReturn = $phpcsFile->findNext(T_RETURN, ($tokens[$function]['scope_opener'] + 1), $tokens[$function]['scope_closer']);
111
+ if ($hasReturn === false) {
112
+ return;
113
+ }
114
+
115
+ $phpcsFile->addError(
116
+ 'Returning a final expression from a generator was not supported in PHP 5.6 or earlier',
117
+ $hasReturn,
118
+ 'ReturnFound'
119
+ );
120
+
121
+ // Don't examine this function again.
122
+ return $tokens[$function]['scope_closer'];
123
+ }
124
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewGroupUseDeclarationsSniff.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewGroupUseDeclarationsSniff.
18
+ *
19
+ * PHP version 7.0
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Wim Godden <wim.godden@cu.be>
24
+ */
25
+ class NewGroupUseDeclarationsSniff extends Sniff
26
+ {
27
+ /**
28
+ * Returns an array of tokens this test wants to listen for.
29
+ *
30
+ * @return array
31
+ */
32
+ public function register()
33
+ {
34
+ if (defined('T_OPEN_USE_GROUP')) {
35
+ return array(T_OPEN_USE_GROUP);
36
+ } else {
37
+ return array(T_USE);
38
+ }
39
+ }//end register()
40
+
41
+
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
47
+ * the stack passed in $tokens.
48
+ *
49
+ * @return void
50
+ */
51
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
52
+ {
53
+ if ($this->supportsBelow('7.1') === false) {
54
+ return;
55
+ }
56
+
57
+ $tokens = $phpcsFile->getTokens();
58
+ $token = $tokens[$stackPtr];
59
+
60
+ // Deal with PHPCS pre-2.6.0.
61
+ if ($token['code'] === T_USE) {
62
+ $hasCurlyBrace = $phpcsFile->findNext(T_OPEN_CURLY_BRACKET, ($stackPtr + 1), null, false, null, true);
63
+ if ($hasCurlyBrace === false) {
64
+ return;
65
+ }
66
+
67
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($hasCurlyBrace - 1), null, true);
68
+ if ($prevToken === false || $tokens[$prevToken]['code'] !== T_NS_SEPARATOR) {
69
+ return;
70
+ }
71
+
72
+ $stackPtr = $hasCurlyBrace;
73
+ }
74
+
75
+ // Still here ? In that case, it is a group use statement.
76
+ if ($this->supportsBelow('5.6') === true) {
77
+ $phpcsFile->addError(
78
+ 'Group use declarations are not allowed in PHP 5.6 or earlier',
79
+ $stackPtr,
80
+ 'Found'
81
+ );
82
+ }
83
+
84
+ $closers = array(T_CLOSE_CURLY_BRACKET);
85
+ if (defined('T_CLOSE_USE_GROUP')) {
86
+ $closers[] = T_CLOSE_USE_GROUP;
87
+ }
88
+
89
+ $closeCurly = $phpcsFile->findNext($closers, ($stackPtr + 1), null, false, null, true);
90
+ if ($closeCurly === false) {
91
+ return;
92
+ }
93
+
94
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($closeCurly - 1), null, true);
95
+ if ($tokens[$prevToken]['code'] === T_COMMA) {
96
+ $phpcsFile->addError(
97
+ 'Trailing comma\'s are not allowed in group use statements in PHP 7.1 or earlier',
98
+ $prevToken,
99
+ 'TrailingCommaFound'
100
+ );
101
+ }
102
+ }//end process()
103
+
104
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewHashAlgorithmsSniff.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewHashAlgorithmsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\NewHashAlgorithmsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class NewHashAlgorithmsSniff extends AbstractNewFeatureSniff
22
+ {
23
+ /**
24
+ * A list of new hash algorithms, not present in older versions.
25
+ *
26
+ * The array lists : version number with false (not present) or true (present).
27
+ * If's sufficient to list the first version where the hash algorithm appears.
28
+ *
29
+ * @var array(string => array(string => bool))
30
+ */
31
+ protected $newAlgorithms = array(
32
+ 'md2' => array(
33
+ '5.2' => false,
34
+ '5.3' => true,
35
+ ),
36
+ 'ripemd256' => array(
37
+ '5.2' => false,
38
+ '5.3' => true,
39
+ ),
40
+ 'ripemd320' => array(
41
+ '5.2' => false,
42
+ '5.3' => true,
43
+ ),
44
+ 'salsa10' => array(
45
+ '5.2' => false,
46
+ '5.3' => true,
47
+ ),
48
+ 'salsa20' => array(
49
+ '5.2' => false,
50
+ '5.3' => true,
51
+ ),
52
+ 'snefru256' => array(
53
+ '5.2' => false,
54
+ '5.3' => true,
55
+ ),
56
+ 'sha224' => array(
57
+ '5.2' => false,
58
+ '5.3' => true,
59
+ ),
60
+ 'joaat' => array(
61
+ '5.3' => false,
62
+ '5.4' => true,
63
+ ),
64
+ 'fnv132' => array(
65
+ '5.3' => false,
66
+ '5.4' => true,
67
+ ),
68
+ 'fnv164' => array(
69
+ '5.3' => false,
70
+ '5.4' => true,
71
+ ),
72
+ 'gost-crypto' => array(
73
+ '5.5' => false,
74
+ '5.6' => true,
75
+ ),
76
+
77
+ 'sha512/224' => array(
78
+ '7.0' => false,
79
+ '7.1' => true,
80
+ ),
81
+ 'sha512/256' => array(
82
+ '7.0' => false,
83
+ '7.1' => true,
84
+ ),
85
+ 'sha3-224' => array(
86
+ '7.0' => false,
87
+ '7.1' => true,
88
+ ),
89
+ 'sha3-256' => array(
90
+ '7.0' => false,
91
+ '7.1' => true,
92
+ ),
93
+ 'sha3-384' => array(
94
+ '7.0' => false,
95
+ '7.1' => true,
96
+ ),
97
+ 'sha3-512' => array(
98
+ '7.0' => false,
99
+ '7.1' => true,
100
+ ),
101
+ );
102
+
103
+
104
+ /**
105
+ * Returns an array of tokens this test wants to listen for.
106
+ *
107
+ * @return array
108
+ */
109
+ public function register()
110
+ {
111
+ return array(T_STRING);
112
+
113
+ }//end register()
114
+
115
+
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.
122
+ *
123
+ * @return void
124
+ */
125
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
126
+ {
127
+ $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr);
128
+ if (empty($algo) || is_string($algo) === false) {
129
+ return;
130
+ }
131
+
132
+ // Bow out if not one of the algorithms we're targetting.
133
+ if (isset($this->newAlgorithms[$algo]) === false) {
134
+ return;
135
+ }
136
+
137
+ // Check if the algorithm used is new.
138
+ $itemInfo = array(
139
+ 'name' => $algo,
140
+ );
141
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
142
+
143
+ }//end process()
144
+
145
+
146
+ /**
147
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
148
+ *
149
+ * @param array $itemInfo Base information about the item.
150
+ *
151
+ * @return array Version and other information about the item.
152
+ */
153
+ public function getItemArray(array $itemInfo)
154
+ {
155
+ return $this->newAlgorithms[$itemInfo['name']];
156
+ }
157
+
158
+
159
+ /**
160
+ * Get the error message template for this sniff.
161
+ *
162
+ * @return string
163
+ */
164
+ protected function getErrorMsgTemplate()
165
+ {
166
+ return 'The %s hash algorithm is not present in PHP version %s or earlier';
167
+ }
168
+
169
+
170
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewHeredocInitializeSniff.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewHeredocInitializeSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniffs\PHP\NewConstantScalarExpressionsSniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewHeredocInitializeSniff.
18
+ *
19
+ * As of PHP 5.3.0, it's possible to initialize static variables, class properties
20
+ * and constants declared using the `const` keyword, using the Heredoc syntax.
21
+ * And while not documented, heredoc initialization can now also be used for function param defaults.
22
+ * See: https://3v4l.org/JVH8W
23
+ *
24
+ * These heredocs (still) cannot contain variables. That's, however, outside the scope of the
25
+ * PHPCompatibility library until such time as there is a PHP version in which this would be accepted.
26
+ *
27
+ * PHP version 5.3
28
+ *
29
+ * @category PHP
30
+ * @package PHPCompatibility
31
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
32
+ */
33
+ class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff
34
+ {
35
+
36
+ /**
37
+ * Error message.
38
+ *
39
+ * @var string
40
+ */
41
+ const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier';
42
+
43
+ /**
44
+ * Partial error phrases to be used in combination with the error message constant.
45
+ *
46
+ * @var array
47
+ */
48
+ protected $errorPhrases = array(
49
+ 'const' => 'constants',
50
+ 'property' => 'class properties',
51
+ 'staticvar' => 'static variables',
52
+ 'default' => 'default parameter values',
53
+ );
54
+
55
+
56
+ /**
57
+ * Do a version check to determine if this sniff needs to run at all.
58
+ *
59
+ * @return bool
60
+ */
61
+ protected function bowOutEarly()
62
+ {
63
+ return ($this->supportsBelow('5.2') !== true);
64
+ }
65
+
66
+
67
+ /**
68
+ * Is a value declared and does the declared value not contain an heredoc ?
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.
73
+ * @param int $end The end of the value definition.
74
+ *
75
+ * @return bool True if no heredoc (or assignment) is found, false otherwise.
76
+ */
77
+ protected function isValidAssignment(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $end)
78
+ {
79
+ $tokens = $phpcsFile->getTokens();
80
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), $end, true);
81
+ if ($next === false || $tokens[$next]['code'] !== T_EQUAL) {
82
+ // No value assigned.
83
+ return true;
84
+ }
85
+
86
+ return ($phpcsFile->findNext(T_START_HEREDOC, ($next + 1), $end, false, null, true) === false);
87
+ }
88
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewIniDirectivesSniff.php ADDED
@@ -0,0 +1,627 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\AbstractNewFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewIniDirectivesSniff.
17
+ *
18
+ * Discourages the use of new INI directives through ini_set() or ini_get().
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 NewIniDirectivesSniff extends AbstractNewFeatureSniff
26
+ {
27
+ /**
28
+ * A list of new INI directives
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 ini directive appears.
32
+ *
33
+ * @var array(string)
34
+ */
35
+ protected $newIniDirectives = array(
36
+ 'auto_globals_jit' => array(
37
+ '4.4' => false,
38
+ '5.0' => true,
39
+ ),
40
+ 'com.code_page' => array(
41
+ '4.4' => false,
42
+ '5.0' => true,
43
+ ),
44
+ 'date.default_latitude' => array(
45
+ '4.4' => false,
46
+ '5.0' => true,
47
+ ),
48
+ 'date.default_longitude' => array(
49
+ '4.4' => false,
50
+ '5.0' => true,
51
+ ),
52
+ 'date.sunrise_zenith' => array(
53
+ '4.4' => false,
54
+ '5.0' => true,
55
+ ),
56
+ 'date.sunset_zenith' => array(
57
+ '4.4' => false,
58
+ '5.0' => true,
59
+ ),
60
+ 'ibase.default_charset' => array(
61
+ '4.4' => false,
62
+ '5.0' => true,
63
+ ),
64
+ 'ibase.default_db' => array(
65
+ '4.4' => false,
66
+ '5.0' => true,
67
+ ),
68
+ 'mail.force_extra_parameters' => array(
69
+ '4.4' => false,
70
+ '5.0' => true,
71
+ ),
72
+ 'mime_magic.debug' => array(
73
+ '4.4' => false,
74
+ '5.0' => true,
75
+ ),
76
+ 'mysqli.max_links' => array(
77
+ '4.4' => false,
78
+ '5.0' => true,
79
+ ),
80
+ 'mysqli.default_port' => array(
81
+ '4.4' => false,
82
+ '5.0' => true,
83
+ ),
84
+ 'mysqli.default_socket' => array(
85
+ '4.4' => false,
86
+ '5.0' => true,
87
+ ),
88
+ 'mysqli.default_host' => array(
89
+ '4.4' => false,
90
+ '5.0' => true,
91
+ ),
92
+ 'mysqli.default_user' => array(
93
+ '4.4' => false,
94
+ '5.0' => true,
95
+ ),
96
+ 'mysqli.default_pw' => array(
97
+ '4.4' => false,
98
+ '5.0' => true,
99
+ ),
100
+ 'report_zend_debug' => array(
101
+ '4.4' => false,
102
+ '5.0' => true,
103
+ ),
104
+ 'session.hash_bits_per_character' => array(
105
+ '4.4' => false,
106
+ '5.0' => true,
107
+ ),
108
+ 'session.hash_function' => array(
109
+ '4.4' => false,
110
+ '5.0' => true,
111
+ ),
112
+ 'soap.wsdl_cache_dir' => array(
113
+ '4.4' => false,
114
+ '5.0' => true,
115
+ ),
116
+ 'soap.wsdl_cache_enabled' => array(
117
+ '4.4' => false,
118
+ '5.0' => true,
119
+ ),
120
+ 'soap.wsdl_cache_ttl' => array(
121
+ '4.4' => false,
122
+ '5.0' => true,
123
+ ),
124
+ 'sqlite.assoc_case' => array(
125
+ '4.4' => false,
126
+ '5.0' => true,
127
+ ),
128
+ 'tidy.clean_output' => array(
129
+ '4.4' => false,
130
+ '5.0' => true,
131
+ ),
132
+ 'tidy.default_config' => array(
133
+ '4.4' => false,
134
+ '5.0' => true,
135
+ ),
136
+ 'zend.ze1_compatibility_mode' => array(
137
+ '4.4' => false,
138
+ '5.0' => true,
139
+ ),
140
+
141
+ 'date.timezone' => array(
142
+ '5.0' => false,
143
+ '5.1' => true,
144
+ ),
145
+ 'detect_unicode' => array(
146
+ '5.0' => false,
147
+ '5.1' => true,
148
+ ),
149
+ 'fbsql.batchsize' => array(
150
+ '5.0' => false,
151
+ '5.1' => true,
152
+ 'alternative' => 'fbsql.batchSize',
153
+ ),
154
+ 'realpath_cache_size' => array(
155
+ '5.0' => false,
156
+ '5.1' => true,
157
+ ),
158
+ 'realpath_cache_ttl' => array(
159
+ '5.0' => false,
160
+ '5.1' => true,
161
+ ),
162
+
163
+ 'mbstring.strict_detection' => array(
164
+ '5.1.1' => false,
165
+ '5.1.2' => true,
166
+ ),
167
+ 'mssql.charset' => array(
168
+ '5.1.1' => false,
169
+ '5.1.2' => true,
170
+ ),
171
+
172
+ 'gd.jpeg_ignore_warning' => array(
173
+ '5.1.2' => false,
174
+ '5.1.3' => true,
175
+ ),
176
+
177
+ 'fbsql.show_timestamp_decimals' => array(
178
+ '5.1.4' => false,
179
+ '5.1.5' => true,
180
+ ),
181
+ 'soap.wsdl_cache' => array(
182
+ '5.1.4' => false,
183
+ '5.1.5' => true,
184
+ ),
185
+ 'soap.wsdl_cache_limit' => array(
186
+ '5.1.4' => false,
187
+ '5.1.5' => true,
188
+ ),
189
+
190
+ 'allow_url_include' => array(
191
+ '5.1' => false,
192
+ '5.2' => true,
193
+ ),
194
+ 'filter.default' => array(
195
+ '5.1' => false,
196
+ '5.2' => true,
197
+ ),
198
+ 'filter.default_flags' => array(
199
+ '5.1' => false,
200
+ '5.2' => true,
201
+ ),
202
+ 'pcre.backtrack_limit' => array(
203
+ '5.1' => false,
204
+ '5.2' => true,
205
+ ),
206
+ 'pcre.recursion_limit' => array(
207
+ '5.1' => false,
208
+ '5.2' => true,
209
+ ),
210
+ 'session.cookie_httponly' => array(
211
+ '5.1' => false,
212
+ '5.2' => true,
213
+ ),
214
+
215
+ 'cgi.check_shebang_line' => array(
216
+ '5.2.0' => false,
217
+ '5.2.1' => true,
218
+ ),
219
+
220
+ 'max_input_nesting_level' => array(
221
+ '5.2.2' => false,
222
+ '5.2.3' => true,
223
+ ),
224
+
225
+ 'mysqli.allow_local_infile' => array(
226
+ '5.2.3' => false,
227
+ '5.2.4' => true,
228
+ ),
229
+
230
+ 'max_file_uploads' => array(
231
+ '5.2.11' => false,
232
+ '5.2.12' => true,
233
+ ),
234
+
235
+ 'cgi.discard_path' => array(
236
+ '5.2' => false,
237
+ '5.3' => true,
238
+ ),
239
+ 'exit_on_timeout' => array(
240
+ '5.2' => false,
241
+ '5.3' => true,
242
+ ),
243
+ 'intl.default_locale' => array(
244
+ '5.2' => false,
245
+ '5.3' => true,
246
+ ),
247
+ 'intl.error_level' => array(
248
+ '5.2' => false,
249
+ '5.3' => true,
250
+ ),
251
+ 'mail.add_x_header' => array(
252
+ '5.2' => false,
253
+ '5.3' => true,
254
+ ),
255
+ 'mail.log' => array(
256
+ '5.2' => false,
257
+ '5.3' => true,
258
+ ),
259
+ 'mbstring.http_output_conv_mimetype' => array(
260
+ '5.2' => false,
261
+ '5.3' => true,
262
+ ),
263
+ 'mysqli.allow_persistent' => array(
264
+ '5.2' => false,
265
+ '5.3' => true,
266
+ ),
267
+ 'mysqli.cache_size' => array(
268
+ '5.2' => false,
269
+ '5.3' => true,
270
+ ),
271
+ 'mysqli.max_persistent' => array(
272
+ '5.2' => false,
273
+ '5.3' => true,
274
+ ),
275
+ 'mysqlnd.collect_memory_statistics' => array(
276
+ '5.2' => false,
277
+ '5.3' => true,
278
+ ),
279
+ 'mysqlnd.collect_statistics' => array(
280
+ '5.2' => false,
281
+ '5.3' => true,
282
+ ),
283
+ 'mysqlnd.debug' => array(
284
+ '5.2' => false,
285
+ '5.3' => true,
286
+ ),
287
+ 'mysqlnd.net_read_buffer_size' => array(
288
+ '5.2' => false,
289
+ '5.3' => true,
290
+ ),
291
+ 'odbc.default_cursortype' => array(
292
+ '5.2' => false,
293
+ '5.3' => true,
294
+ ),
295
+ 'request_order' => array(
296
+ '5.2' => false,
297
+ '5.3' => true,
298
+ ),
299
+ 'user_ini.cache_ttl' => array(
300
+ '5.2' => false,
301
+ '5.3' => true,
302
+ ),
303
+ 'user_ini.filename' => array(
304
+ '5.2' => false,
305
+ '5.3' => true,
306
+ ),
307
+ 'zend.enable_gc' => array(
308
+ '5.2' => false,
309
+ '5.3' => true,
310
+ ),
311
+
312
+ 'curl.cainfo' => array(
313
+ '5.3.6' => false,
314
+ '5.3.7' => true,
315
+ ),
316
+
317
+ 'max_input_vars' => array(
318
+ '5.3.8' => false,
319
+ '5.3.9' => true,
320
+ ),
321
+
322
+ 'sqlite3.extension_dir' => array(
323
+ '5.3.10' => false,
324
+ '5.3.11' => true,
325
+ ),
326
+
327
+ 'cli.pager' => array(
328
+ '5.3' => false,
329
+ '5.4' => true,
330
+ ),
331
+ 'cli.prompt' => array(
332
+ '5.3' => false,
333
+ '5.4' => true,
334
+ ),
335
+ 'cli_server.color' => array(
336
+ '5.3' => false,
337
+ '5.4' => true,
338
+ ),
339
+ 'enable_post_data_reading' => array(
340
+ '5.3' => false,
341
+ '5.4' => true,
342
+ ),
343
+ 'mysqlnd.mempool_default_size' => array(
344
+ '5.3' => false,
345
+ '5.4' => true,
346
+ ),
347
+ 'mysqlnd.net_cmd_buffer_size' => array(
348
+ '5.3' => false,
349
+ '5.4' => true,
350
+ ),
351
+ 'mysqlnd.net_read_timeout' => array(
352
+ '5.3' => false,
353
+ '5.4' => true,
354
+ ),
355
+ 'phar.cache_list' => array(
356
+ '5.3' => false,
357
+ '5.4' => true,
358
+ ),
359
+ 'session.upload_progress.enabled' => array(
360
+ '5.3' => false,
361
+ '5.4' => true,
362
+ ),
363
+ 'session.upload_progress.cleanup' => array(
364
+ '5.3' => false,
365
+ '5.4' => true,
366
+ ),
367
+ 'session.upload_progress.name' => array(
368
+ '5.3' => false,
369
+ '5.4' => true,
370
+ ),
371
+ 'session.upload_progress.freq' => array(
372
+ '5.3' => false,
373
+ '5.4' => true,
374
+ ),
375
+ 'session.upload_progress.min_freq' => array(
376
+ '5.3' => false,
377
+ '5.4' => true,
378
+ ),
379
+ 'session.upload_progress.prefix' => array(
380
+ '5.3' => false,
381
+ '5.4' => true,
382
+ ),
383
+ 'windows_show_crt_warning' => array(
384
+ '5.3' => false,
385
+ '5.4' => true,
386
+ ),
387
+ 'zend.detect_unicode' => array(
388
+ '5.3' => false,
389
+ '5.4' => true,
390
+ 'alternative' => 'detect_unicode',
391
+ ),
392
+ 'zend.multibyte' => array(
393
+ '5.3' => false,
394
+ '5.4' => true,
395
+ ),
396
+ 'zend.script_encoding' => array(
397
+ '5.3' => false,
398
+ '5.4' => true,
399
+ ),
400
+ 'zend.signal_check' => array(
401
+ '5.3' => false,
402
+ '5.4' => true,
403
+ ),
404
+ 'mysqlnd.log_mask' => array(
405
+ '5.3' => false,
406
+ '5.4' => true,
407
+ ),
408
+
409
+ 'intl.use_exceptions' => array(
410
+ '5.4' => false,
411
+ '5.5' => true,
412
+ ),
413
+ 'mysqlnd.sha256_server_public_key' => array(
414
+ '5.4' => false,
415
+ '5.5' => true,
416
+ ),
417
+ 'mysqlnd.trace_alloc' => array(
418
+ '5.4' => false,
419
+ '5.5' => true,
420
+ ),
421
+ 'sys_temp_dir' => array(
422
+ '5.4' => false,
423
+ '5.5' => true,
424
+ ),
425
+ 'xsl.security_prefs' => array(
426
+ '5.4' => false,
427
+ '5.5' => true,
428
+ ),
429
+
430
+ 'session.use_strict_mode' => array(
431
+ '5.5.1' => false,
432
+ '5.5.2' => true,
433
+ ),
434
+
435
+ 'mysqli.rollback_on_cached_plink' => array(
436
+ '5.5' => false,
437
+ '5.6' => true,
438
+ ),
439
+
440
+ 'assert.exception' => array(
441
+ '5.6' => false,
442
+ '7.0' => true,
443
+ ),
444
+ 'pcre.jit' => array(
445
+ '5.6' => false,
446
+ '7.0' => true,
447
+ ),
448
+ 'session.lazy_write' => array(
449
+ '5.6' => false,
450
+ '7.0' => true,
451
+ ),
452
+ 'zend.assertions' => array(
453
+ '5.6' => false,
454
+ '7.0' => true,
455
+ ),
456
+
457
+ 'session.sid_length' => array(
458
+ '7.0' => false,
459
+ '7.1' => true,
460
+ ),
461
+ 'session.sid_bits_per_character' => array(
462
+ '7.0' => false,
463
+ '7.1' => true,
464
+ ),
465
+ );
466
+
467
+ /**
468
+ * Returns an array of tokens this test wants to listen for.
469
+ *
470
+ * @return array
471
+ */
472
+ public function register()
473
+ {
474
+ return array(T_STRING);
475
+
476
+ }//end register()
477
+
478
+ /**
479
+ * Processes this test, when one of its tokens is encountered.
480
+ *
481
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
482
+ * @param int $stackPtr The position of the current token in the
483
+ * stack passed in $tokens.
484
+ *
485
+ * @return void
486
+ */
487
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
488
+ {
489
+ $tokens = $phpcsFile->getTokens();
490
+
491
+ $ignore = array(
492
+ T_DOUBLE_COLON,
493
+ T_OBJECT_OPERATOR,
494
+ T_FUNCTION,
495
+ T_CONST,
496
+ );
497
+
498
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
499
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
500
+ // Not a call to a PHP function.
501
+ return;
502
+ }
503
+
504
+ $functionLc = strtolower($tokens[$stackPtr]['content']);
505
+ if (isset($this->iniFunctions[$functionLc]) === false) {
506
+ return;
507
+ }
508
+
509
+ $iniToken = $this->getFunctionCallParameter($phpcsFile, $stackPtr, $this->iniFunctions[$functionLc]);
510
+ if ($iniToken === false) {
511
+ return;
512
+ }
513
+
514
+ $filteredToken = $this->stripQuotes($iniToken['raw']);
515
+ if (isset($this->newIniDirectives[$filteredToken]) === false) {
516
+ return;
517
+ }
518
+
519
+ $itemInfo = array(
520
+ 'name' => $filteredToken,
521
+ 'functionLc' => $functionLc,
522
+ );
523
+ $this->handleFeature($phpcsFile, $iniToken['end'], $itemInfo);
524
+
525
+ }//end process()
526
+
527
+
528
+ /**
529
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
530
+ *
531
+ * @param array $itemInfo Base information about the item.
532
+ *
533
+ * @return array Version and other information about the item.
534
+ */
535
+ public function getItemArray(array $itemInfo)
536
+ {
537
+ return $this->newIniDirectives[$itemInfo['name']];
538
+ }
539
+
540
+
541
+ /**
542
+ * Get an array of the non-PHP-version array keys used in a sub-array.
543
+ *
544
+ * @return array
545
+ */
546
+ protected function getNonVersionArrayKeys()
547
+ {
548
+ return array('alternative');
549
+ }
550
+
551
+
552
+ /**
553
+ * Retrieve the relevant detail (version) information for use in an error message.
554
+ *
555
+ * @param array $itemArray Version and other information about the item.
556
+ * @param array $itemInfo Base information about the item.
557
+ *
558
+ * @return array
559
+ */
560
+ public function getErrorInfo(array $itemArray, array $itemInfo)
561
+ {
562
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
563
+ $errorInfo['alternative'] = '';
564
+
565
+ if (isset($itemArray['alternative']) === true) {
566
+ $errorInfo['alternative'] = $itemArray['alternative'];
567
+ }
568
+
569
+ // Lower error level to warning if the function used was ini_get.
570
+ if ($errorInfo['error'] === true && $itemInfo['functionLc'] === 'ini_get') {
571
+ $errorInfo['error'] = false;
572
+ }
573
+
574
+ return $errorInfo;
575
+ }
576
+
577
+
578
+ /**
579
+ * Get the error message template for this sniff.
580
+ *
581
+ * @return string
582
+ */
583
+ protected function getErrorMsgTemplate()
584
+ {
585
+ return "INI directive '%s' is not present in PHP version %s or earlier";
586
+ }
587
+
588
+
589
+ /**
590
+ * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
591
+ *
592
+ * @param string $error The error message which was created.
593
+ * @param array $itemInfo Base information about the item this error message applies to.
594
+ * @param array $errorInfo Detail information about an item this error message applies to.
595
+ *
596
+ * @return string
597
+ */
598
+ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
599
+ {
600
+ if ($errorInfo['alternative'] !== '') {
601
+ $error .= ". This directive was previously called '%s'.";
602
+ }
603
+
604
+ return $error;
605
+ }
606
+
607
+
608
+ /**
609
+ * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
610
+ *
611
+ * @param array $data The error data array which was created.
612
+ * @param array $itemInfo Base information about the item this error message applies to.
613
+ * @param array $errorInfo Detail information about an item this error message applies to.
614
+ *
615
+ * @return array
616
+ */
617
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
618
+ {
619
+ if ($errorInfo['alternative'] !== '') {
620
+ $data[] = $errorInfo['alternative'];
621
+ }
622
+
623
+ return $data;
624
+ }
625
+
626
+
627
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewInterfacesSniff.php ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewInterfacesSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+ use PHPCompatibility\PHPCSHelper;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewInterfacesSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
21
+ */
22
+ class NewInterfacesSniff extends AbstractNewFeatureSniff
23
+ {
24
+
25
+ /**
26
+ * A list of new interfaces, not present in older versions.
27
+ *
28
+ * The array lists : version number with false (not present) or true (present).
29
+ * If's sufficient to list the first version where the interface appears.
30
+ *
31
+ * @var array(string => array(string => int|string|null))
32
+ */
33
+ protected $newInterfaces = array(
34
+ 'Traversable' => array(
35
+ '4.4' => false,
36
+ '5.0' => true,
37
+ ),
38
+ 'Reflector' => array(
39
+ '4.4' => false,
40
+ '5.0' => true,
41
+ ),
42
+
43
+ 'Countable' => array(
44
+ '5.0' => false,
45
+ '5.1' => true,
46
+ ),
47
+ 'OuterIterator' => array(
48
+ '5.0' => false,
49
+ '5.1' => true,
50
+ ),
51
+ 'RecursiveIterator' => array(
52
+ '5.0' => false,
53
+ '5.1' => true,
54
+ ),
55
+ 'SeekableIterator' => array(
56
+ '5.0' => false,
57
+ '5.1' => true,
58
+ ),
59
+ 'Serializable' => array(
60
+ '5.0' => false,
61
+ '5.1' => true,
62
+ ),
63
+ 'SplObserver' => array(
64
+ '5.0' => false,
65
+ '5.1' => true,
66
+ ),
67
+ 'SplSubject' => array(
68
+ '5.0' => false,
69
+ '5.1' => true,
70
+ ),
71
+
72
+ 'JsonSerializable' => array(
73
+ '5.3' => false,
74
+ '5.4' => true,
75
+ ),
76
+ 'SessionHandlerInterface' => array(
77
+ '5.3' => false,
78
+ '5.4' => true,
79
+ ),
80
+
81
+ 'DateTimeInterface' => array(
82
+ '5.4' => false,
83
+ '5.5' => true,
84
+ ),
85
+
86
+ 'Throwable' => array(
87
+ '5.6' => false,
88
+ '7.0' => true,
89
+ ),
90
+
91
+ );
92
+
93
+ /**
94
+ * A list of methods which cannot be used in combination with particular interfaces.
95
+ *
96
+ * @var array(string => array(string => string))
97
+ */
98
+ protected $unsupportedMethods = array(
99
+ 'Serializable' => array(
100
+ '__sleep' => 'http://php.net/serializable',
101
+ '__wakeup' => 'http://php.net/serializable',
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()
111
+ {
112
+ // Handle case-insensitivity of interface names.
113
+ $this->newInterfaces = $this->arrayKeysToLowercase($this->newInterfaces);
114
+ $this->unsupportedMethods = $this->arrayKeysToLowercase($this->unsupportedMethods);
115
+
116
+ $targets = array(
117
+ T_CLASS,
118
+ T_FUNCTION,
119
+ T_CLOSURE,
120
+ );
121
+
122
+ if (defined('T_ANON_CLASS')) {
123
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
124
+ $targets[] = T_ANON_CLASS;
125
+ }
126
+
127
+ if (defined('T_RETURN_TYPE')) {
128
+ $targets[] = T_RETURN_TYPE;
129
+ }
130
+
131
+ return $targets;
132
+
133
+ }//end register()
134
+
135
+
136
+ /**
137
+ * Processes this test, when one of its tokens is encountered.
138
+ *
139
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
140
+ * @param int $stackPtr The position of the current token in
141
+ * the stack passed in $tokens.
142
+ *
143
+ * @return void
144
+ */
145
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
146
+ {
147
+ $tokens = $phpcsFile->getTokens();
148
+
149
+ switch ($tokens[$stackPtr]['type']) {
150
+ case 'T_CLASS':
151
+ case 'T_ANON_CLASS':
152
+ $this->processClassToken($phpcsFile, $stackPtr);
153
+ break;
154
+
155
+ case 'T_FUNCTION':
156
+ case 'T_CLOSURE':
157
+ $this->processFunctionToken($phpcsFile, $stackPtr);
158
+
159
+ // Deal with older PHPCS versions which don't recognize return type hints
160
+ // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
161
+ $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
162
+ if ($returnTypeHint !== false) {
163
+ $this->processReturnTypeToken($phpcsFile, $returnTypeHint);
164
+ }
165
+ break;
166
+
167
+ case 'T_RETURN_TYPE':
168
+ $this->processReturnTypeToken($phpcsFile, $stackPtr);
169
+ break;
170
+
171
+ default:
172
+ // Deliberately left empty.
173
+ break;
174
+ }
175
+
176
+ }//end process()
177
+
178
+
179
+ /**
180
+ * Processes this test for when a class token is encountered.
181
+ *
182
+ * - Detect classes implementing the new interfaces.
183
+ * - Detect classes implementing the new interfaces with unsupported functions.
184
+ *
185
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
186
+ * @param int $stackPtr The position of the current token in
187
+ * the stack passed in $tokens.
188
+ *
189
+ * @return void
190
+ */
191
+ private function processClassToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
192
+ {
193
+ $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr);
194
+
195
+ if (is_array($interfaces) === false || $interfaces === array()) {
196
+ return;
197
+ }
198
+
199
+ $tokens = $phpcsFile->getTokens();
200
+ $checkMethods = false;
201
+
202
+ if (isset($tokens[$stackPtr]['scope_closer'])) {
203
+ $checkMethods = true;
204
+ $scopeCloser = $tokens[$stackPtr]['scope_closer'];
205
+ }
206
+
207
+ foreach ($interfaces as $interface) {
208
+ $interfaceLc = strtolower($interface);
209
+
210
+ if (isset($this->newInterfaces[$interfaceLc]) === true) {
211
+ $itemInfo = array(
212
+ 'name' => $interface,
213
+ 'nameLc' => $interfaceLc,
214
+ );
215
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
216
+ }
217
+
218
+ if ($checkMethods === true && isset($this->unsupportedMethods[$interfaceLc]) === true) {
219
+ $nextFunc = $stackPtr;
220
+ while (($nextFunc = $phpcsFile->findNext(T_FUNCTION, ($nextFunc + 1), $scopeCloser)) !== false) {
221
+ $funcName = $phpcsFile->getDeclarationName($nextFunc);
222
+ $funcNameLc = strtolower($funcName);
223
+ if ($funcNameLc === '') {
224
+ continue;
225
+ }
226
+
227
+ if (isset($this->unsupportedMethods[$interfaceLc][$funcNameLc]) === true) {
228
+ $error = 'Classes that implement interface %s do not support the method %s(). See %s';
229
+ $errorCode = $this->stringToErrorCode($interface) . 'UnsupportedMethod';
230
+ $data = array(
231
+ $interface,
232
+ $funcName,
233
+ $this->unsupportedMethods[$interfaceLc][$funcNameLc],
234
+ );
235
+
236
+ $phpcsFile->addError($error, $nextFunc, $errorCode, $data);
237
+ }
238
+ }
239
+ }
240
+ }
241
+ }//end processClassToken()
242
+
243
+
244
+ /**
245
+ * Processes this test for when a function token is encountered.
246
+ *
247
+ * - Detect new interfaces when used as a type hint.
248
+ *
249
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
250
+ * @param int $stackPtr The position of the current token in
251
+ * the stack passed in $tokens.
252
+ *
253
+ * @return void
254
+ */
255
+ private function processFunctionToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
256
+ {
257
+ $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr);
258
+ if (empty($typeHints) || is_array($typeHints) === false) {
259
+ return;
260
+ }
261
+
262
+ foreach ($typeHints as $hint) {
263
+
264
+ $typeHintLc = strtolower($hint);
265
+
266
+ if (isset($this->newInterfaces[$typeHintLc]) === true) {
267
+ $itemInfo = array(
268
+ 'name' => $hint,
269
+ 'nameLc' => $typeHintLc,
270
+ );
271
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
272
+ }
273
+ }
274
+ }
275
+
276
+
277
+ /**
278
+ * Processes this test for when a return type token is encountered.
279
+ *
280
+ * - Detect new interfaces when used as a return type declaration.
281
+ *
282
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
283
+ * @param int $stackPtr The position of the current token in
284
+ * the stack passed in $tokens.
285
+ *
286
+ * @return void
287
+ */
288
+ private function processReturnTypeToken(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
289
+ {
290
+ $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr);
291
+ $returnTypeHint = ltrim($returnTypeHint, '\\');
292
+ $returnTypeHintLc = strtolower($returnTypeHint);
293
+
294
+ if (isset($this->newInterfaces[$returnTypeHintLc]) === false) {
295
+ return;
296
+ }
297
+
298
+ // Still here ? Then this is a return type declaration using a new interface.
299
+ $itemInfo = array(
300
+ 'name' => $returnTypeHint,
301
+ 'nameLc' => $returnTypeHintLc,
302
+ );
303
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
304
+ }
305
+
306
+
307
+ /**
308
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
309
+ *
310
+ * @param array $itemInfo Base information about the item.
311
+ *
312
+ * @return array Version and other information about the item.
313
+ */
314
+ public function getItemArray(array $itemInfo)
315
+ {
316
+ return $this->newInterfaces[$itemInfo['nameLc']];
317
+ }
318
+
319
+
320
+ /**
321
+ * Get the error message template for this sniff.
322
+ *
323
+ * @return string
324
+ */
325
+ protected function getErrorMsgTemplate()
326
+ {
327
+ return 'The built-in interface ' . parent::getErrorMsgTemplate();
328
+ }
329
+
330
+
331
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewKeywordsSniff.php ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\AbstractNewFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewKeywordsSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Wim Godden <wim.godden@cu.be>
21
+ * @copyright 2013 Cu.be Solutions bvba
22
+ */
23
+ class NewKeywordsSniff extends AbstractNewFeatureSniff
24
+ {
25
+
26
+ /**
27
+ * A list of new keywords, not present in older versions.
28
+ *
29
+ * The array lists : version number with false (not present) or true (present).
30
+ * If's sufficient to list the last version which did not contain the keyword.
31
+ *
32
+ * Description will be used as part of the error message.
33
+ * Condition is the name of a callback method within this class or the parent class
34
+ * which checks whether the token complies with a certain condition.
35
+ * The callback function will be passed the $phpcsFile and the $stackPtr.
36
+ * The callback function should return `true` if the condition is met and the
37
+ * error should *not* be thrown.
38
+ *
39
+ * @var array(string => array(string => int|string|null))
40
+ */
41
+ protected $newKeywords = array(
42
+ 'T_HALT_COMPILER' => array(
43
+ '5.0' => false,
44
+ '5.1' => true,
45
+ 'description' => '"__halt_compiler" keyword',
46
+ ),
47
+ 'T_CONST' => array(
48
+ '5.2' => false,
49
+ '5.3' => true,
50
+ 'description' => '"const" keyword',
51
+ 'condition' => 'isClassConstant', // Keyword is only new when not in class context.
52
+ ),
53
+ 'T_CALLABLE' => array(
54
+ '5.3' => false,
55
+ '5.4' => true,
56
+ 'description' => '"callable" keyword',
57
+ 'content' => 'callable',
58
+ ),
59
+ 'T_DIR' => array(
60
+ '5.2' => false,
61
+ '5.3' => true,
62
+ 'description' => '__DIR__ magic constant',
63
+ 'content' => '__DIR__',
64
+ ),
65
+ 'T_GOTO' => array(
66
+ '5.2' => false,
67
+ '5.3' => true,
68
+ 'description' => '"goto" keyword',
69
+ 'content' => 'goto',
70
+ ),
71
+ 'T_INSTEADOF' => array(
72
+ '5.3' => false,
73
+ '5.4' => true,
74
+ 'description' => '"insteadof" keyword (for traits)',
75
+ 'content' => 'insteadof',
76
+ ),
77
+ 'T_NAMESPACE' => array(
78
+ '5.2' => false,
79
+ '5.3' => true,
80
+ 'description' => '"namespace" keyword',
81
+ 'content' => 'namespace',
82
+ ),
83
+ 'T_NS_C' => array(
84
+ '5.2' => false,
85
+ '5.3' => true,
86
+ 'description' => '__NAMESPACE__ magic constant',
87
+ 'content' => '__NAMESPACE__',
88
+ ),
89
+ 'T_USE' => array(
90
+ '5.2' => false,
91
+ '5.3' => true,
92
+ 'description' => '"use" keyword (for traits/namespaces/anonymous functions)',
93
+ ),
94
+ 'T_START_NOWDOC' => array(
95
+ '5.2' => false,
96
+ '5.3' => true,
97
+ 'description' => 'nowdoc functionality',
98
+ ),
99
+ 'T_END_NOWDOC' => array(
100
+ '5.2' => false,
101
+ '5.3' => true,
102
+ 'description' => 'nowdoc functionality',
103
+ ),
104
+ 'T_START_HEREDOC' => array(
105
+ '5.2' => false,
106
+ '5.3' => true,
107
+ 'description' => '(Double) quoted Heredoc identifier',
108
+ 'condition' => 'isNotQuoted', // Heredoc is only new with quoted identifier.
109
+ ),
110
+ 'T_TRAIT' => array(
111
+ '5.3' => false,
112
+ '5.4' => true,
113
+ 'description' => '"trait" keyword',
114
+ 'content' => 'trait',
115
+ ),
116
+ 'T_TRAIT_C' => array(
117
+ '5.3' => false,
118
+ '5.4' => true,
119
+ 'description' => '__TRAIT__ magic constant',
120
+ 'content' => '__TRAIT__',
121
+ ),
122
+ // The specifics for distinguishing between 'yield' and 'yield from' are dealt
123
+ // with in the translation logic.
124
+ // This token has to be placed above the `T_YIELD` token in this array to allow for this.
125
+ 'T_YIELD_FROM' => array(
126
+ '5.6' => false,
127
+ '7.0' => true,
128
+ 'description' => '"yield from" keyword (for generators)',
129
+ 'content' => 'yield',
130
+ ),
131
+ 'T_YIELD' => array(
132
+ '5.4' => false,
133
+ '5.5' => true,
134
+ 'description' => '"yield" keyword (for generators)',
135
+ 'content' => 'yield',
136
+ ),
137
+ 'T_FINALLY' => array(
138
+ '5.4' => false,
139
+ '5.5' => true,
140
+ 'description' => '"finally" keyword (in exception handling)',
141
+ 'content' => 'finally',
142
+ ),
143
+ );
144
+
145
+ /**
146
+ * Translation table for T_STRING tokens.
147
+ *
148
+ * Will be set up from the register() method.
149
+ *
150
+ * @var array(string => string)
151
+ */
152
+ protected $translateContentToToken = array();
153
+
154
+
155
+ /**
156
+ * Returns an array of tokens this test wants to listen for.
157
+ *
158
+ * @return array
159
+ */
160
+ public function register()
161
+ {
162
+ $tokens = array();
163
+ $translate = array();
164
+ foreach ($this->newKeywords as $token => $versions) {
165
+ if (defined($token)) {
166
+ $tokens[] = constant($token);
167
+ }
168
+ if (isset($versions['content'])) {
169
+ $translate[$versions['content']] = $token;
170
+ }
171
+ }
172
+
173
+ /*
174
+ * Deal with tokens not recognized by the PHP version the sniffer is run
175
+ * under and (not correctly) compensated for by PHPCS.
176
+ */
177
+ if (empty($translate) === false) {
178
+ $this->translateContentToToken = $translate;
179
+ $tokens[] = T_STRING;
180
+ }
181
+
182
+ return $tokens;
183
+
184
+ }//end register()
185
+
186
+
187
+ /**
188
+ * Processes this test, when one of its tokens is encountered.
189
+ *
190
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
191
+ * @param int $stackPtr The position of the current token in
192
+ * the stack passed in $tokens.
193
+ *
194
+ * @return void
195
+ */
196
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
197
+ {
198
+ $tokens = $phpcsFile->getTokens();
199
+ $tokenType = $tokens[$stackPtr]['type'];
200
+
201
+ // Allow for dealing with multi-token keywords, like "yield from".
202
+ $end = $stackPtr;
203
+
204
+ // Translate T_STRING token if necessary.
205
+ if ($tokens[$stackPtr]['type'] === 'T_STRING') {
206
+ $content = $tokens[$stackPtr]['content'];
207
+ if (strpos($content, '__') !== 0) {
208
+ $content = strtolower($tokens[$stackPtr]['content']);
209
+ }
210
+
211
+ if (isset($this->translateContentToToken[$content]) === false) {
212
+ // Not one of the tokens we're looking for.
213
+ return;
214
+ }
215
+
216
+ $tokenType = $this->translateContentToToken[$content];
217
+ }
218
+
219
+ /*
220
+ * Special case: distinguish between `yield` and `yield from`.
221
+ *
222
+ * PHPCS currently (at least up to v 3.0.1) does not backfill for the
223
+ * `yield` nor the `yield from` keywords.
224
+ * See: https://github.com/squizlabs/PHP_CodeSniffer/issues/1524
225
+ *
226
+ * In PHP < 5.5, both `yield` as well as `from` are tokenized as T_STRING.
227
+ * In PHP 5.5 - 5.6, `yield` is tokenized as T_YIELD and `from` as T_STRING,
228
+ * but the `T_YIELD_FROM` token *is* defined in PHP.
229
+ * In PHP 7.0+ both are tokenized as their respective token, however,
230
+ * a multi-line "yield from" is tokenized as two tokens.
231
+ */
232
+ if ($tokenType === 'T_YIELD') {
233
+ $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($end + 1), null, true);
234
+ if ($tokens[$nextToken]['code'] === T_STRING
235
+ && $tokens[$nextToken]['content'] === 'from'
236
+ ) {
237
+ $tokenType = 'T_YIELD_FROM';
238
+ $end = $nextToken;
239
+ }
240
+ unset($nextToken);
241
+ }
242
+
243
+ if ($tokenType === 'T_YIELD_FROM' && $tokens[($stackPtr - 1)]['type'] === 'T_YIELD_FROM') {
244
+ // Multi-line "yield from", no need to report it twice.
245
+ return;
246
+ }
247
+
248
+ if (isset($this->newKeywords[$tokenType]) === false) {
249
+ return;
250
+ }
251
+
252
+ $nextToken = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($end + 1), null, true);
253
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
254
+
255
+ if ($prevToken !== false
256
+ && ($tokens[$prevToken]['code'] === T_DOUBLE_COLON
257
+ || $tokens[$prevToken]['code'] === T_OBJECT_OPERATOR)
258
+ ) {
259
+ // Class property of the same name as one of the keywords. Ignore.
260
+ return;
261
+ }
262
+
263
+ // Skip attempts to use keywords as functions or class names - the former
264
+ // will be reported by ForbiddenNamesAsInvokedFunctionsSniff, whilst the
265
+ // latter will be (partially) reported by the ForbiddenNames sniff.
266
+ // Either type will result in false-positives when targetting lower versions
267
+ // of PHP where the name was not reserved, unless we explicitly check for
268
+ // them.
269
+ if (($nextToken === false
270
+ || $tokens[$nextToken]['type'] !== 'T_OPEN_PARENTHESIS')
271
+ && ($prevToken === false
272
+ || $tokens[$prevToken]['type'] !== 'T_CLASS'
273
+ || $tokens[$prevToken]['type'] !== 'T_INTERFACE')
274
+ ) {
275
+ // Skip based on token scope condition.
276
+ if (isset($this->newKeywords[$tokenType]['condition'])
277
+ && call_user_func(array($this, $this->newKeywords[$tokenType]['condition']), $phpcsFile, $stackPtr) === true
278
+ ) {
279
+ return;
280
+ }
281
+
282
+ $itemInfo = array(
283
+ 'name' => $tokenType,
284
+ );
285
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
286
+ }
287
+
288
+ }//end process()
289
+
290
+
291
+ /**
292
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
293
+ *
294
+ * @param array $itemInfo Base information about the item.
295
+ *
296
+ * @return array Version and other information about the item.
297
+ */
298
+ public function getItemArray(array $itemInfo)
299
+ {
300
+ return $this->newKeywords[$itemInfo['name']];
301
+ }
302
+
303
+
304
+ /**
305
+ * Get an array of the non-PHP-version array keys used in a sub-array.
306
+ *
307
+ * @return array
308
+ */
309
+ protected function getNonVersionArrayKeys()
310
+ {
311
+ return array(
312
+ 'description',
313
+ 'condition',
314
+ 'content',
315
+ );
316
+ }
317
+
318
+
319
+ /**
320
+ * Retrieve the relevant detail (version) information for use in an error message.
321
+ *
322
+ * @param array $itemArray Version and other information about the item.
323
+ * @param array $itemInfo Base information about the item.
324
+ *
325
+ * @return array
326
+ */
327
+ public function getErrorInfo(array $itemArray, array $itemInfo)
328
+ {
329
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
330
+ $errorInfo['description'] = $itemArray['description'];
331
+
332
+ return $errorInfo;
333
+
334
+ }
335
+
336
+
337
+ /**
338
+ * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
339
+ *
340
+ * @param array $data The error data array which was created.
341
+ * @param array $itemInfo Base information about the item this error message applies to.
342
+ * @param array $errorInfo Detail information about an item this error message applies to.
343
+ *
344
+ * @return array
345
+ */
346
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
347
+ {
348
+ $data[0] = $errorInfo['description'];
349
+ return $data;
350
+ }
351
+
352
+
353
+ /**
354
+ * Callback for the quoted heredoc identifier condition.
355
+ *
356
+ * A double quoted identifier will have the opening quote on position 3
357
+ * in the string: `<<<"ID"`.
358
+ *
359
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
360
+ * @param int $stackPtr The position of the current token in
361
+ * the stack passed in $tokens.
362
+ *
363
+ * @return bool
364
+ */
365
+ public function isNotQuoted(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
366
+ {
367
+ $tokens = $phpcsFile->getTokens();
368
+ return ($tokens[$stackPtr]['content'][3] !== '"');
369
+ }
370
+
371
+
372
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewLanguageConstructsSniff.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\AbstractNewFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewLanguageConstructsSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Wim Godden <wim.godden@cu.be>
21
+ * @copyright 2013 Cu.be Solutions bvba
22
+ */
23
+ class NewLanguageConstructsSniff extends AbstractNewFeatureSniff
24
+ {
25
+
26
+ /**
27
+ * A list of new language constructs, not present in older versions.
28
+ *
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 $newConstructs = array(
35
+ 'T_NS_SEPARATOR' => array(
36
+ '5.2' => false,
37
+ '5.3' => true,
38
+ 'description' => 'the \ operator (for namespaces)',
39
+ ),
40
+ 'T_POW' => array(
41
+ '5.5' => false,
42
+ '5.6' => true,
43
+ 'description' => 'power operator (**)',
44
+ ), // Identified in PHPCS 1.5 as T_MULTIPLY + T_MULTIPLY.
45
+ 'T_POW_EQUAL' => array(
46
+ '5.5' => false,
47
+ '5.6' => true,
48
+ 'description' => 'power assignment operator (**=)',
49
+ ), // Identified in PHPCS 1.5 as T_MULTIPLY + T_MUL_EQUAL.
50
+ 'T_ELLIPSIS' => array(
51
+ '5.5' => false,
52
+ '5.6' => true,
53
+ 'description' => 'variadic functions using ...',
54
+ ),
55
+ 'T_SPACESHIP' => array(
56
+ '5.6' => false,
57
+ '7.0' => true,
58
+ 'description' => 'spaceship operator (<=>)',
59
+ ), // Identified in PHPCS 1.5 as T_IS_SMALLER_OR_EQUAL + T_GREATER_THAN.
60
+ 'T_COALESCE' => array(
61
+ '5.6' => false,
62
+ '7.0' => true,
63
+ 'description' => 'null coalescing operator (??)',
64
+ ), // Identified in PHPCS 1.5 as T_INLINE_THEN + T_INLINE_THEN.
65
+ /*
66
+ * Was slated for 7.2, but still not implemented. PHPCS however does already tokenize it.
67
+ * @link https://wiki.php.net/rfc/null_coalesce_equal_operator
68
+ */
69
+ 'T_COALESCE_EQUAL' => array(
70
+ '7.2' => false,
71
+ '7.3' => true,
72
+ 'description' => 'null coalesce equal operator (??=)',
73
+ ), // Identified in PHPCS 1.5 as T_INLINE_THEN + T_INLINE_THEN + T_EQUAL and pre-PHPCS 2.8.1 as T_COALESCE + T_EQUAL.
74
+ );
75
+
76
+
77
+ /**
78
+ * A list of new language constructs which are not recognized in PHPCS 1.x.
79
+ *
80
+ * The array lists an alternative token to listen for.
81
+ *
82
+ * @var array(string => int)
83
+ */
84
+ protected $newConstructsPHPCSCompat = array(
85
+ 'T_POW' => T_MULTIPLY,
86
+ 'T_POW_EQUAL' => T_MUL_EQUAL,
87
+ 'T_SPACESHIP' => T_GREATER_THAN,
88
+ 'T_COALESCE' => T_INLINE_THEN,
89
+ 'T_COALESCE_EQUAL' => T_EQUAL,
90
+ );
91
+
92
+ /**
93
+ * Translation table for PHPCS 1.x and older 2.x tokens.
94
+ *
95
+ * The 'before' index lists the token which would have to be directly before the
96
+ * token found for it to be one of the new language constructs.
97
+ * The 'real_token' index indicates which language construct was found in that case.
98
+ *
99
+ * If the token combination has multi-layer complexity, such as is the case
100
+ * with T_COALESCE(_EQUAL), a 'callback' index is added instead pointing to a
101
+ * separate function which can determine whether this is the targetted token across
102
+ * PHP and PHPCS versions.
103
+ *
104
+ * {@internal 'before' was chosen rather than 'after' as that allowed for a 1-on-1
105
+ * translation list with the current tokens.}}
106
+ *
107
+ * @var array(string => array(string => string))
108
+ */
109
+ protected $PHPCSCompatTranslate = array(
110
+ 'T_MULTIPLY' => array(
111
+ 'before' => 'T_MULTIPLY',
112
+ 'real_token' => 'T_POW',
113
+ ),
114
+ 'T_MUL_EQUAL' => array(
115
+ 'before' => 'T_MULTIPLY',
116
+ 'real_token' => 'T_POW_EQUAL',
117
+ ),
118
+ 'T_GREATER_THAN' => array(
119
+ 'before' => 'T_IS_SMALLER_OR_EQUAL',
120
+ 'real_token' => 'T_SPACESHIP',
121
+ ),
122
+ 'T_INLINE_THEN' => array(
123
+ 'callback' => 'isTCoalesce',
124
+ 'real_token' => 'T_COALESCE',
125
+ ),
126
+ 'T_EQUAL' => array(
127
+ 'callback' => 'isTCoalesceEqual',
128
+ 'real_token' => 'T_COALESCE_EQUAL',
129
+ ),
130
+ );
131
+
132
+ /**
133
+ * Returns an array of tokens this test wants to listen for.
134
+ *
135
+ * @return array
136
+ */
137
+ public function register()
138
+ {
139
+ $tokens = array();
140
+ foreach ($this->newConstructs as $token => $versions) {
141
+ if (defined($token)) {
142
+ $tokens[] = constant($token);
143
+ } elseif (isset($this->newConstructsPHPCSCompat[$token])) {
144
+ $tokens[] = $this->newConstructsPHPCSCompat[$token];
145
+ }
146
+ }
147
+ return $tokens;
148
+ }//end register()
149
+
150
+
151
+ /**
152
+ * Processes this test, when one of its tokens is encountered.
153
+ *
154
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
155
+ * @param int $stackPtr The position of the current token in
156
+ * the stack passed in $tokens.
157
+ *
158
+ * @return void
159
+ */
160
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
161
+ {
162
+ $tokens = $phpcsFile->getTokens();
163
+ $tokenType = $tokens[$stackPtr]['type'];
164
+
165
+ // Translate older PHPCS token combis for new constructs to the actual construct.
166
+ if (isset($this->newConstructs[$tokenType]) === false) {
167
+ if (isset($this->PHPCSCompatTranslate[$tokenType])
168
+ && ((isset($this->PHPCSCompatTranslate[$tokenType]['before'], $tokens[$stackPtr - 1]) === true
169
+ && $tokens[$stackPtr - 1]['type'] === $this->PHPCSCompatTranslate[$tokenType]['before'])
170
+ || (isset($this->PHPCSCompatTranslate[$tokenType]['callback']) === true
171
+ && call_user_func(array($this, $this->PHPCSCompatTranslate[$tokenType]['callback']), $tokens, $stackPtr) === true))
172
+ ) {
173
+ $tokenType = $this->PHPCSCompatTranslate[$tokenType]['real_token'];
174
+ }
175
+ } elseif ($tokenType === 'T_COALESCE') {
176
+ // Make sure that T_COALESCE is not confused with T_COALESCE_EQUAL.
177
+ if (isset($tokens[($stackPtr + 1)]) !== false && $tokens[($stackPtr + 1)]['code'] === T_EQUAL) {
178
+ // Ignore as will be dealt with via the T_EQUAL token.
179
+ return;
180
+ }
181
+ }
182
+
183
+ // If the translation did not yield one of the tokens we are looking for, bow out.
184
+ if (isset($this->newConstructs[$tokenType]) === false) {
185
+ return;
186
+ }
187
+
188
+ $itemInfo = array(
189
+ 'name' => $tokenType,
190
+ );
191
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
192
+
193
+ }//end process()
194
+
195
+
196
+ /**
197
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
198
+ *
199
+ * @param array $itemInfo Base information about the item.
200
+ *
201
+ * @return array Version and other information about the item.
202
+ */
203
+ public function getItemArray(array $itemInfo)
204
+ {
205
+ return $this->newConstructs[$itemInfo['name']];
206
+ }
207
+
208
+
209
+ /**
210
+ * Get an array of the non-PHP-version array keys used in a sub-array.
211
+ *
212
+ * @return array
213
+ */
214
+ protected function getNonVersionArrayKeys()
215
+ {
216
+ return array('description');
217
+ }
218
+
219
+
220
+ /**
221
+ * Retrieve the relevant detail (version) information for use in an error message.
222
+ *
223
+ * @param array $itemArray Version and other information about the item.
224
+ * @param array $itemInfo Base information about the item.
225
+ *
226
+ * @return array
227
+ */
228
+ public function getErrorInfo(array $itemArray, array $itemInfo)
229
+ {
230
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
231
+ $errorInfo['description'] = $itemArray['description'];
232
+
233
+ return $errorInfo;
234
+
235
+ }
236
+
237
+
238
+ /**
239
+ * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
240
+ *
241
+ * @param array $data The error data array which was created.
242
+ * @param array $itemInfo Base information about the item this error message applies to.
243
+ * @param array $errorInfo Detail information about an item this error message applies to.
244
+ *
245
+ * @return array
246
+ */
247
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
248
+ {
249
+ $data[0] = $errorInfo['description'];
250
+ return $data;
251
+ }
252
+
253
+
254
+ /**
255
+ * Callback function to determine whether a T_EQUAL token is really a T_COALESCE_EQUAL token.
256
+ *
257
+ * @param array $tokens The token stack.
258
+ * @param int $stackPtr The current position in the token stack.
259
+ *
260
+ * @return bool
261
+ */
262
+ private function isTCoalesceEqual($tokens, $stackPtr)
263
+ {
264
+ if ($tokens[$stackPtr]['code'] !== T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) {
265
+ // Function called for wrong token or token has no predecesor.
266
+ return false;
267
+ }
268
+
269
+ if ($tokens[($stackPtr - 1)]['type'] === 'T_COALESCE') {
270
+ return true;
271
+ }
272
+ if ($tokens[($stackPtr - 1)]['type'] === 'T_INLINE_THEN'
273
+ && (isset($tokens[($stackPtr - 2)]) && $tokens[($stackPtr - 2)]['type'] === 'T_INLINE_THEN')
274
+ ) {
275
+ return true;
276
+ }
277
+
278
+ return false;
279
+ }
280
+
281
+ /**
282
+ * Callback function to determine whether a T_INLINE_THEN token is really a T_COALESCE token.
283
+ *
284
+ * @param array $tokens The token stack.
285
+ * @param int $stackPtr The current position in the token stack.
286
+ *
287
+ * @return bool
288
+ */
289
+ private function isTCoalesce($tokens, $stackPtr)
290
+ {
291
+ if ($tokens[$stackPtr]['code'] !== T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) {
292
+ // Function called for wrong token or token has no predecesor.
293
+ return false;
294
+ }
295
+
296
+ if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
297
+ // Make sure not to confuse it with the T_COALESCE_EQUAL token.
298
+ if (isset($tokens[($stackPtr + 1)]) === false || $tokens[($stackPtr + 1)]['code'] !== T_EQUAL) {
299
+ return true;
300
+ }
301
+ }
302
+
303
+ return false;
304
+ }
305
+
306
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMagicClassConstantSniff.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewMagicClassConstantSniff.
18
+ *
19
+ * The special ClassName::class constant is available as of PHP 5.5.0, and allows for
20
+ * fully qualified class name resolution at compile.
21
+ *
22
+ * PHP version 5.5
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
27
+ */
28
+ class NewMagicClassConstantSniff extends Sniff
29
+ {
30
+
31
+ /**
32
+ * Returns an array of tokens this test wants to listen for.
33
+ *
34
+ * @return array
35
+ */
36
+ public function register()
37
+ {
38
+ return array(T_STRING);
39
+ }
40
+
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.
47
+ *
48
+ * @return void
49
+ */
50
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
51
+ {
52
+ if ($this->supportsBelow('5.4') === false) {
53
+ return;
54
+ }
55
+
56
+ $tokens = $phpcsFile->getTokens();
57
+
58
+ if (strtolower($tokens[$stackPtr]['content']) !== 'class') {
59
+ return;
60
+ }
61
+
62
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
63
+ if ($prevToken === false || $tokens[$prevToken]['code'] !== T_DOUBLE_COLON) {
64
+ return;
65
+ }
66
+
67
+ $phpcsFile->addError(
68
+ 'The magic class constant ClassName::class was not available in PHP 5.4 or earlier',
69
+ $stackPtr,
70
+ 'Found'
71
+ );
72
+ }
73
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMagicMethodsSniff.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewMagicMethodsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\NewMagicMethodsSniff.
16
+ *
17
+ * Warns for non-magic behaviour of magic methods prior to becoming magic.
18
+ *
19
+ * @category PHP
20
+ * @package PHPCompatibility
21
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
22
+ */
23
+ class NewMagicMethodsSniff extends AbstractNewFeatureSniff
24
+ {
25
+
26
+ /**
27
+ * A list of new magic methods, not considered magic in older versions.
28
+ *
29
+ * Method names in the array should be all *lowercase*.
30
+ * The array lists : version number with false (not magic) or true (magic).
31
+ * If's sufficient to list the first version where the method became magic.
32
+ *
33
+ * @var array(string => array(string => int|string|null))
34
+ */
35
+ protected $newMagicMethods = array(
36
+ '__get' => array(
37
+ '4.4' => false,
38
+ '5.0' => true,
39
+ ),
40
+
41
+ '__isset' => array(
42
+ '5.0' => false,
43
+ '5.1' => true,
44
+ ),
45
+ '__unset' => array(
46
+ '5.0' => false,
47
+ '5.1' => true,
48
+ ),
49
+ '__set_state' => array(
50
+ '5.0' => false,
51
+ '5.1' => true,
52
+ ),
53
+
54
+ '__callstatic' => array(
55
+ '5.2' => false,
56
+ '5.3' => true,
57
+ ),
58
+ '__invoke' => array(
59
+ '5.2' => false,
60
+ '5.3' => true,
61
+ ),
62
+
63
+ '__debuginfo' => array(
64
+ '5.5' => false,
65
+ '5.6' => true,
66
+ ),
67
+
68
+ // Special case - only became properly magical in 5.2.0,
69
+ // before that it was only called for echo and print.
70
+ '__tostring' => array(
71
+ '5.1' => false,
72
+ '5.2' => true,
73
+ '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.',
74
+ ),
75
+ );
76
+
77
+
78
+ /**
79
+ * Returns an array of tokens this test wants to listen for.
80
+ *
81
+ * @return array
82
+ */
83
+ public function register()
84
+ {
85
+ return array(T_FUNCTION);
86
+
87
+ }//end register()
88
+
89
+
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.
96
+ *
97
+ * @return void
98
+ */
99
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
100
+ {
101
+ $functionName = $phpcsFile->getDeclarationName($stackPtr);
102
+ $functionNameLc = strtolower($functionName);
103
+
104
+ if (isset($this->newMagicMethods[$functionNameLc]) === false) {
105
+ return;
106
+ }
107
+
108
+ if ($this->inClassScope($phpcsFile, $stackPtr, false) === false) {
109
+ return;
110
+ }
111
+
112
+ $itemInfo = array(
113
+ 'name' => $functionName,
114
+ 'nameLc' => $functionNameLc,
115
+ );
116
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
117
+
118
+ }//end process()
119
+
120
+
121
+ /**
122
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
123
+ *
124
+ * @param array $itemInfo Base information about the item.
125
+ *
126
+ * @return array Version and other information about the item.
127
+ */
128
+ public function getItemArray(array $itemInfo)
129
+ {
130
+ return $this->newMagicMethods[$itemInfo['nameLc']];
131
+ }
132
+
133
+
134
+ /**
135
+ * Get an array of the non-PHP-version array keys used in a sub-array.
136
+ *
137
+ * @return array
138
+ */
139
+ protected function getNonVersionArrayKeys()
140
+ {
141
+ return array('message');
142
+ }
143
+
144
+
145
+ /**
146
+ * Retrieve the relevant detail (version) information for use in an error message.
147
+ *
148
+ * @param array $itemArray Version and other information about the item.
149
+ * @param array $itemInfo Base information about the item.
150
+ *
151
+ * @return array
152
+ */
153
+ public function getErrorInfo(array $itemArray, array $itemInfo)
154
+ {
155
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
156
+ $errorInfo['error'] = false; // Warning, not error.
157
+ $errorInfo['message'] = '';
158
+
159
+ if (empty($itemArray['message']) === false) {
160
+ $errorInfo['message'] = $itemArray['message'];
161
+ }
162
+
163
+ return $errorInfo;
164
+ }
165
+
166
+
167
+ /**
168
+ * Get the error message template for this sniff.
169
+ *
170
+ * @return string
171
+ */
172
+ protected function getErrorMsgTemplate()
173
+ {
174
+ return 'The method %s() was not magical in PHP version %s and earlier. The associated magic functionality will not be invoked.';
175
+ }
176
+
177
+
178
+ /**
179
+ * Allow for concrete child classes to filter the error message before it's passed to PHPCS.
180
+ *
181
+ * @param string $error The error message which was created.
182
+ * @param array $itemInfo Base information about the item this error message applies to.
183
+ * @param array $errorInfo Detail information about an item this error message applies to.
184
+ *
185
+ * @return string
186
+ */
187
+ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
188
+ {
189
+ if ($errorInfo['message'] !== '') {
190
+ $error = $errorInfo['message'];
191
+ }
192
+
193
+ return $error;
194
+ }
195
+
196
+
197
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewMultiCatchSniff.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewMultiCatch.
4
+ *
5
+ * PHP version 7.1
6
+ *
7
+ * @category PHP
8
+ * @package PHPCompatibility
9
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
+ */
11
+
12
+ namespace PHPCompatibility\Sniffs\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewMultiCatch.
18
+ *
19
+ * Catching multiple exception types in one statement is available since PHP 7.1.
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 NewMultiCatchSniff 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()
35
+ {
36
+ return array(T_CATCH);
37
+
38
+ }//end register()
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsBelow('7.0') === false) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+ $token = $tokens[$stackPtr];
57
+
58
+ // Bow out during live coding.
59
+ if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) {
60
+ return;
61
+ }
62
+
63
+ $hasBitwiseOr = $phpcsFile->findNext(T_BITWISE_OR, $token['parenthesis_opener'], $token['parenthesis_closer']);
64
+
65
+ if ($hasBitwiseOr === false) {
66
+ return;
67
+ }
68
+
69
+ $phpcsFile->addError(
70
+ 'Catching multiple exceptions within one statement is not supported in PHP 7.0 or earlier.',
71
+ $hasBitwiseOr,
72
+ 'Found'
73
+ );
74
+
75
+ }//end process()
76
+
77
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewNullableTypesSniff.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewNullableTypes.
4
+ *
5
+ * PHP version 7.1
6
+ *
7
+ * @category PHP
8
+ * @package PHPCompatibility
9
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
10
+ */
11
+
12
+ namespace PHPCompatibility\Sniffs\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+ use PHPCompatibility\PHPCSHelper;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\NewNullableTypes.
19
+ *
20
+ * Nullable type hints and return types are 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 NewNullableTypesSniff extends Sniff
29
+ {
30
+ /**
31
+ * Returns an array of tokens this test wants to listen for.
32
+ *
33
+ * {@internal Not sniffing for T_NULLABLE which was introduced in PHPCS 2.7.2
34
+ * as in that case we can't distinguish between parameter type hints and
35
+ * return type hints for the error message.}}
36
+ *
37
+ * @return array
38
+ */
39
+ public function register()
40
+ {
41
+ $tokens = array(
42
+ T_FUNCTION,
43
+ T_CLOSURE,
44
+ );
45
+
46
+ if (defined('T_RETURN_TYPE')) {
47
+ $tokens[] = T_RETURN_TYPE;
48
+ }
49
+
50
+ return $tokens;
51
+
52
+ }//end register()
53
+
54
+
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
60
+ * in the stack passed in $tokens.
61
+ *
62
+ * @return void
63
+ */
64
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
65
+ {
66
+ if ($this->supportsBelow('7.0') === false) {
67
+ return;
68
+ }
69
+
70
+ $tokens = $phpcsFile->getTokens();
71
+ $tokenCode = $tokens[$stackPtr]['code'];
72
+
73
+ if ($tokenCode === T_FUNCTION || $tokenCode === T_CLOSURE) {
74
+ $this->processFunctionDeclaration($phpcsFile, $stackPtr);
75
+
76
+ // Deal with older PHPCS version which don't recognize return type hints
77
+ // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
78
+ $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
79
+ if ($returnTypeHint !== false) {
80
+ $this->processReturnType($phpcsFile, $returnTypeHint);
81
+ }
82
+ } else {
83
+ $this->processReturnType($phpcsFile, $stackPtr);
84
+ }
85
+
86
+ }//end process()
87
+
88
+
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.
95
+ *
96
+ * @return void
97
+ */
98
+ protected function processFunctionDeclaration(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
99
+ {
100
+ $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
101
+
102
+ if (empty($params) === false && is_array($params)) {
103
+ foreach ($params as $param) {
104
+ if ($param['nullable_type'] === true) {
105
+ $phpcsFile->addError(
106
+ 'Nullable type declarations are not supported in PHP 7.0 or earlier. Found: %s',
107
+ $param['token'],
108
+ 'typeDeclarationFound',
109
+ array($param['type_hint'])
110
+ );
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+
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.
123
+ *
124
+ * @return void
125
+ */
126
+ protected function processReturnType(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
127
+ {
128
+ $tokens = $phpcsFile->getTokens();
129
+
130
+ if (isset($tokens[($stackPtr - 1)]['code']) === false) {
131
+ return;
132
+ }
133
+
134
+ $previous = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
135
+
136
+ // Deal with namespaced class names.
137
+ if ($tokens[$previous]['code'] === T_NS_SEPARATOR) {
138
+ $validTokens = \PHP_CodeSniffer_Tokens::$emptyTokens;
139
+ $validTokens[] = T_STRING;
140
+ $validTokens[] = T_NS_SEPARATOR;
141
+
142
+ $stackPtr--;
143
+
144
+ while (in_array($tokens[($stackPtr - 1)]['code'], $validTokens, true) === true) {
145
+ $stackPtr--;
146
+ }
147
+
148
+ $previous = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
149
+ }
150
+
151
+ // T_NULLABLE token was introduced in PHPCS 2.7.2. Before that it identified as T_INLINE_THEN.
152
+ if ((defined('T_NULLABLE') === true && $tokens[$previous]['type'] === 'T_NULLABLE')
153
+ || (defined('T_NULLABLE') === false && $tokens[$previous]['code'] === T_INLINE_THEN)
154
+ ) {
155
+ $phpcsFile->addError(
156
+ 'Nullable return types are not supported in PHP 7.0 or earlier.',
157
+ $stackPtr,
158
+ 'returnTypeFound'
159
+ );
160
+ }
161
+ }
162
+
163
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewReturnTypeDeclarationsSniff.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\AbstractNewFeatureSniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewReturnTypeDeclarationsSniff.
18
+ *
19
+ * PHP version 7.0
20
+ *
21
+ * @category PHP
22
+ * @package PHPCompatibility
23
+ * @author Wim Godden <wim.godden@cu.be>
24
+ */
25
+ class NewReturnTypeDeclarationsSniff extends AbstractNewFeatureSniff
26
+ {
27
+
28
+ /**
29
+ * A list of new types
30
+ *
31
+ * The array lists : version number with false (not present) or true (present).
32
+ * If's sufficient to list the first version where the keyword appears.
33
+ *
34
+ * @var array(string => array(string => int|string|null))
35
+ */
36
+ protected $newTypes = array(
37
+ 'int' => array(
38
+ '5.6' => false,
39
+ '7.0' => true,
40
+ ),
41
+ 'float' => array(
42
+ '5.6' => false,
43
+ '7.0' => true,
44
+ ),
45
+ 'bool' => array(
46
+ '5.6' => false,
47
+ '7.0' => true,
48
+ ),
49
+ 'string' => array(
50
+ '5.6' => false,
51
+ '7.0' => true,
52
+ ),
53
+ 'array' => array(
54
+ '5.6' => false,
55
+ '7.0' => true,
56
+ ),
57
+ 'callable' => array(
58
+ '5.6' => false,
59
+ '7.0' => true,
60
+ ),
61
+ 'parent' => array(
62
+ '5.6' => false,
63
+ '7.0' => true,
64
+ ),
65
+ 'self' => array(
66
+ '5.6' => false,
67
+ '7.0' => true,
68
+ ),
69
+ 'Class name' => array(
70
+ '5.6' => false,
71
+ '7.0' => true,
72
+ ),
73
+
74
+ 'iterable' => array(
75
+ '7.0' => false,
76
+ '7.1' => true,
77
+ ),
78
+ 'void' => array(
79
+ '7.0' => false,
80
+ '7.1' => true,
81
+ ),
82
+
83
+ 'object' => array(
84
+ '7.1' => false,
85
+ '7.2' => true,
86
+ ),
87
+ );
88
+
89
+
90
+ /**
91
+ * Returns an array of tokens this test wants to listen for.
92
+ *
93
+ * @return array
94
+ */
95
+ public function register()
96
+ {
97
+ $tokens = array(
98
+ T_FUNCTION,
99
+ T_CLOSURE,
100
+ );
101
+
102
+ if (defined('T_RETURN_TYPE')) {
103
+ $tokens[] = T_RETURN_TYPE;
104
+ }
105
+
106
+ return $tokens;
107
+ }//end register()
108
+
109
+
110
+ /**
111
+ * Processes this test, when one of its tokens is encountered.
112
+ *
113
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
114
+ * @param int $stackPtr The position of the current token in
115
+ * the stack passed in $tokens.
116
+ *
117
+ * @return void
118
+ */
119
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
120
+ {
121
+ $tokens = $phpcsFile->getTokens();
122
+
123
+ // Deal with older PHPCS version which don't recognize return type hints
124
+ // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed.
125
+ if ($tokens[$stackPtr]['code'] === T_FUNCTION || $tokens[$stackPtr]['code'] === T_CLOSURE) {
126
+ $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr);
127
+ if ($returnTypeHint !== false) {
128
+ $stackPtr = $returnTypeHint;
129
+ }
130
+ }
131
+
132
+ if (isset($this->newTypes[$tokens[$stackPtr]['content']]) === true) {
133
+ $itemInfo = array(
134
+ 'name' => $tokens[$stackPtr]['content'],
135
+ );
136
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
137
+ }
138
+ // Handle class name based return types.
139
+ elseif ($tokens[$stackPtr]['code'] === T_STRING
140
+ || (defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === T_RETURN_TYPE)
141
+ ) {
142
+ $itemInfo = array(
143
+ 'name' => 'Class name',
144
+ );
145
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
146
+ }
147
+ }//end process()
148
+
149
+
150
+ /**
151
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
152
+ *
153
+ * @param array $itemInfo Base information about the item.
154
+ *
155
+ * @return array Version and other information about the item.
156
+ */
157
+ public function getItemArray(array $itemInfo)
158
+ {
159
+ return $this->newTypes[$itemInfo['name']];
160
+ }
161
+
162
+
163
+ /**
164
+ * Get the error message template for this sniff.
165
+ *
166
+ * @return string
167
+ */
168
+ protected function getErrorMsgTemplate()
169
+ {
170
+ return '%s return type is not present in PHP version %s or earlier';
171
+ }
172
+
173
+
174
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewScalarTypeDeclarationsSniff.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewScalarTypeDeclarationsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+ use PHPCompatibility\PHPCSHelper;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\NewScalarTypeDeclarationsSniff.
17
+ *
18
+ * @category PHP
19
+ * @package PHPCompatibility
20
+ * @author Wim Godden <wim.godden@cu.be>
21
+ */
22
+ class NewScalarTypeDeclarationsSniff extends AbstractNewFeatureSniff
23
+ {
24
+
25
+ /**
26
+ * A list of new types.
27
+ *
28
+ * The array lists : version number with false (not present) or true (present).
29
+ * If's sufficient to list the first version where the keyword appears.
30
+ *
31
+ * @var array(string => array(string => int|string|null))
32
+ */
33
+ protected $newTypes = array(
34
+ 'array' => array(
35
+ '5.0' => false,
36
+ '5.1' => true,
37
+ ),
38
+ 'self' => array(
39
+ '5.1' => false,
40
+ '5.2' => true,
41
+ ),
42
+ 'parent' => array(
43
+ '5.1' => false,
44
+ '5.2' => true,
45
+ ),
46
+ 'callable' => array(
47
+ '5.3' => false,
48
+ '5.4' => true,
49
+ ),
50
+ 'int' => array(
51
+ '5.6' => false,
52
+ '7.0' => true,
53
+ ),
54
+ 'float' => array(
55
+ '5.6' => false,
56
+ '7.0' => true,
57
+ ),
58
+ 'bool' => array(
59
+ '5.6' => false,
60
+ '7.0' => true,
61
+ ),
62
+ 'string' => array(
63
+ '5.6' => false,
64
+ '7.0' => true,
65
+ ),
66
+ 'iterable' => array(
67
+ '7.0' => false,
68
+ '7.1' => true,
69
+ ),
70
+ 'object' => array(
71
+ '7.1' => false,
72
+ '7.2' => true,
73
+ ),
74
+ );
75
+
76
+
77
+ /**
78
+ * Invalid types
79
+ *
80
+ * The array lists : the invalid type hint => what was probably intended/alternative.
81
+ *
82
+ * @var array(string => string)
83
+ */
84
+ protected $invalidTypes = array(
85
+ 'static' => 'self',
86
+ 'boolean' => 'bool',
87
+ 'integer' => 'int',
88
+ );
89
+
90
+
91
+ /**
92
+ * Returns an array of tokens this test wants to listen for.
93
+ *
94
+ * @return array
95
+ */
96
+ public function register()
97
+ {
98
+ return array(
99
+ T_FUNCTION,
100
+ T_CLOSURE,
101
+ );
102
+ }//end register()
103
+
104
+
105
+ /**
106
+ * Processes this test, when one of its tokens is encountered.
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 void
113
+ */
114
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
115
+ {
116
+ // Get all parameters from method signature.
117
+ $paramNames = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
118
+ if (empty($paramNames)) {
119
+ return;
120
+ }
121
+
122
+ $supportsPHP4 = $this->supportsBelow('4.4');
123
+
124
+ foreach ($paramNames as $param) {
125
+ if ($param['type_hint'] === '') {
126
+ continue;
127
+ }
128
+
129
+ // Strip off potential nullable indication.
130
+ $typeHint = ltrim($param['type_hint'], '?');
131
+
132
+ if ($supportsPHP4 === true) {
133
+ $phpcsFile->addError(
134
+ 'Type declarations were not present in PHP 4.4 or earlier.',
135
+ $param['token'],
136
+ 'TypeHintFound'
137
+ );
138
+
139
+ } elseif (isset($this->newTypes[$typeHint])) {
140
+ $itemInfo = array(
141
+ 'name' => $typeHint,
142
+ );
143
+ $this->handleFeature($phpcsFile, $param['token'], $itemInfo);
144
+
145
+ // As of PHP 7.0, using `self` or `parent` outside class scope throws a fatal error.
146
+ // Only throw this error for PHP 5.2+ as before that the "type hint not supported" error
147
+ // will be thrown.
148
+ if (($typeHint === 'self' || $typeHint === 'parent')
149
+ && $this->inClassScope($phpcsFile, $stackPtr, false) === false
150
+ && $this->supportsAbove('5.2') !== false
151
+ ) {
152
+ $phpcsFile->addError(
153
+ "'%s' type cannot be used outside of class scope",
154
+ $param['token'],
155
+ ucfirst($typeHint) . 'OutsideClassScopeFound',
156
+ array($typeHint)
157
+ );
158
+ }
159
+ } elseif (isset($this->invalidTypes[$typeHint])) {
160
+ $error = "'%s' is not a valid type declaration. Did you mean %s ?";
161
+ $data = array(
162
+ $typeHint,
163
+ $this->invalidTypes[$typeHint],
164
+ );
165
+
166
+ $phpcsFile->addError($error, $param['token'], 'InvalidTypeHintFound', $data);
167
+ }
168
+ }
169
+ }//end process()
170
+
171
+
172
+ /**
173
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
174
+ *
175
+ * @param array $itemInfo Base information about the item.
176
+ *
177
+ * @return array Version and other information about the item.
178
+ */
179
+ public function getItemArray(array $itemInfo)
180
+ {
181
+ return $this->newTypes[$itemInfo['name']];
182
+ }
183
+
184
+
185
+ /**
186
+ * Get the error message template for this sniff.
187
+ *
188
+ * @return string
189
+ */
190
+ protected function getErrorMsgTemplate()
191
+ {
192
+ return "'%s' type declaration is not present in PHP version %s or earlier";
193
+ }
194
+
195
+
196
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewTrailingCommaSniff.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\TrailingCommaSniff.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewTrailingCommaSniff.
18
+ *
19
+ * PHP version 7.3
20
+ *
21
+ * Note: trailing comma's in group use statements as introduced in PHP 7.2 is covered
22
+ * by the `NewGroupUseDeclaration` sniff.
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
27
+ */
28
+ class NewTrailingCommaSniff 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()
36
+ {
37
+ return array(
38
+ T_STRING,
39
+ T_VARIABLE,
40
+ T_ISSET,
41
+ T_UNSET,
42
+ );
43
+ }
44
+
45
+
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
51
+ * the stack passed in $tokens.
52
+ *
53
+ * @return void
54
+ */
55
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
56
+ {
57
+ if ($this->supportsBelow('7.2') === false) {
58
+ return;
59
+ }
60
+
61
+ $tokens = $phpcsFile->getTokens();
62
+
63
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
64
+ if ($tokens[$nextNonEmpty]['code'] !== T_OPEN_PARENTHESIS
65
+ || isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false
66
+ ) {
67
+ return;
68
+ }
69
+
70
+ if ($tokens[$stackPtr]['code'] === T_STRING) {
71
+ $ignore = array(
72
+ T_FUNCTION => true,
73
+ T_CONST => true,
74
+ T_USE => true,
75
+ );
76
+
77
+ $prevNonEmpty = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true);
78
+ if (isset($ignore[$tokens[$prevNonEmpty]['code']]) === true) {
79
+ // Not a function call.
80
+ return;
81
+ }
82
+ }
83
+
84
+ $closer = $tokens[$nextNonEmpty]['parenthesis_closer'];
85
+ $lastInParenthesis = $phpcsFile->findPrevious(
86
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
87
+ ($closer - 1),
88
+ $nextNonEmpty,
89
+ true
90
+ );
91
+
92
+ if ($tokens[$lastInParenthesis]['code'] !== T_COMMA) {
93
+ return;
94
+ }
95
+
96
+ $data = array();
97
+ switch ($tokens[$stackPtr]['code']) {
98
+ case T_ISSET:
99
+ $data[] = 'calls to isset()';
100
+ $errorCode = 'FoundInIsset';
101
+ break;
102
+
103
+ case T_UNSET:
104
+ $data[] = 'calls to unset()';
105
+ $errorCode = 'FoundInUnset';
106
+ break;
107
+
108
+ default:
109
+ $data[] = 'function calls';
110
+ $errorCode = 'FoundInFunctionCall';
111
+ break;
112
+ }
113
+
114
+ $phpcsFile->addError(
115
+ 'Trailing comma\'s are not allowed in %s in PHP 7.2 or earlier',
116
+ $lastInParenthesis,
117
+ $errorCode,
118
+ $data
119
+ );
120
+
121
+ }//end process()
122
+
123
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewTypeCastsSniff.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\NewTypeCastsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractNewFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\NewTypeCastsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class NewTypeCastsSniff extends AbstractNewFeatureSniff
22
+ {
23
+
24
+ /**
25
+ * A list of new type casts, not present in older versions.
26
+ *
27
+ * The array lists : version number with false (not present) or true (present).
28
+ * If's sufficient to list the first version where the keyword appears.
29
+ *
30
+ * @var array(string => array(string => int|string|null))
31
+ */
32
+ protected $newTypeCasts = array(
33
+ 'T_UNSET_CAST' => array(
34
+ '4.4' => false,
35
+ '5.0' => true,
36
+ 'description' => 'The unset cast',
37
+ ),
38
+ 'T_BINARY_CAST' => array(
39
+ '5.2.0' => false,
40
+ '5.2.1' => true,
41
+ 'description' => 'The binary cast',
42
+ ),
43
+ );
44
+
45
+
46
+ /**
47
+ * Returns an array of tokens this test wants to listen for.
48
+ *
49
+ * @return array
50
+ */
51
+ public function register()
52
+ {
53
+ $tokens = array();
54
+ foreach ($this->newTypeCasts as $token => $versions) {
55
+ if (defined($token)) {
56
+ $tokens[] = constant($token);
57
+ }
58
+ }
59
+
60
+ /*
61
+ * Work around tokenizer issues.
62
+ *
63
+ * - (binary) cast is incorrectly tokenized as T_STRING_CAST by PHP and PHPCS.
64
+ * - b"something" binary cast is incorrectly tokenized as T_CONSTANT_ENCAPSED_STRING by PHP and PHPCS.
65
+ *
66
+ * @link https://github.com/squizlabs/PHP_CodeSniffer/issues/1574
67
+ */
68
+ $tokens[] = T_STRING_CAST;
69
+ $tokens[] = T_CONSTANT_ENCAPSED_STRING;
70
+
71
+ return $tokens;
72
+ }//end register()
73
+
74
+
75
+ /**
76
+ * Processes this test, when one of its tokens is encountered.
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.
81
+ *
82
+ * @return void
83
+ */
84
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
85
+ {
86
+ $tokens = $phpcsFile->getTokens();
87
+ $tokenType = $tokens[$stackPtr]['type'];
88
+
89
+ // Detect incorrectly tokenized binary casts.
90
+ if (isset($this->newTypeCasts[$tokenType]) === false) {
91
+ $tokenContent = $tokens[$stackPtr]['content'];
92
+ switch ($tokenType) {
93
+ case 'T_STRING_CAST':
94
+ if (preg_match('`^\(\s*binary\s*\)$`i', $tokenContent) !== 1) {
95
+ return;
96
+ }
97
+
98
+ $tokenType = 'T_BINARY_CAST';
99
+ break;
100
+
101
+ case 'T_CONSTANT_ENCAPSED_STRING':
102
+ if (strpos($tokenContent, 'b"') === 0 && substr($tokenContent, -1) === '"') {
103
+ $tokenType = 'T_BINARY_CAST';
104
+ } else {
105
+ return;
106
+ }
107
+ break;
108
+
109
+ }
110
+ }
111
+
112
+ // If the translation did not yield one of the tokens we are looking for, bow out.
113
+ if (isset($this->newTypeCasts[$tokenType]) === false) {
114
+ return;
115
+ }
116
+
117
+ $itemInfo = array(
118
+ 'name' => $tokenType,
119
+ 'content' => $tokens[$stackPtr]['content'],
120
+ );
121
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
122
+
123
+ }//end process()
124
+
125
+
126
+ /**
127
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
128
+ *
129
+ * @param array $itemInfo Base information about the item.
130
+ *
131
+ * @return array Version and other information about the item.
132
+ */
133
+ public function getItemArray(array $itemInfo)
134
+ {
135
+ return $this->newTypeCasts[$itemInfo['name']];
136
+ }
137
+
138
+
139
+ /**
140
+ * Get an array of the non-PHP-version array keys used in a sub-array.
141
+ *
142
+ * @return array
143
+ */
144
+ protected function getNonVersionArrayKeys()
145
+ {
146
+ return array('description');
147
+ }
148
+
149
+
150
+ /**
151
+ * Retrieve the relevant detail (version) information for use in an error message.
152
+ *
153
+ * @param array $itemArray Version and other information about the item.
154
+ * @param array $itemInfo Base information about the item.
155
+ *
156
+ * @return array
157
+ */
158
+ public function getErrorInfo(array $itemArray, array $itemInfo)
159
+ {
160
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
161
+ $errorInfo['description'] = $itemArray['description'];
162
+
163
+ return $errorInfo;
164
+ }
165
+
166
+
167
+ /**
168
+ * Filter the error message before it's passed to PHPCS.
169
+ *
170
+ * @param string $error The error message which was created.
171
+ * @param array $itemInfo Base information about the item this error message applies to.
172
+ * @param array $errorInfo Detail information about an item this error message applies to.
173
+ *
174
+ * @return string
175
+ */
176
+ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
177
+ {
178
+ return $error . '. Found: %s';
179
+ }
180
+
181
+
182
+ /**
183
+ * Filter the error data before it's passed to PHPCS.
184
+ *
185
+ * @param array $data The error data array which was created.
186
+ * @param array $itemInfo Base information about the item this error message applies to.
187
+ * @param array $errorInfo Detail information about an item this error message applies to.
188
+ *
189
+ * @return array
190
+ */
191
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
192
+ {
193
+ $data[0] = $errorInfo['description'];
194
+ $data[] = $itemInfo['content'];
195
+ return $data;
196
+ }
197
+
198
+
199
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NewUseConstFunctionSniff.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\NewUseConstFunctionSniff.
18
+ *
19
+ * The use operator has been extended to support importing functions and
20
+ * constants in addition to classes. This is achieved via the use function
21
+ * and use const constructs, respectively.
22
+ *
23
+ * PHP version 5.6
24
+ *
25
+ * @category PHP
26
+ * @package PHPCompatibility
27
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
28
+ */
29
+ class NewUseConstFunctionSniff extends Sniff
30
+ {
31
+
32
+ /**
33
+ * A list of keywords that can follow use statements.
34
+ *
35
+ * @var array(string => string)
36
+ */
37
+ protected $validUseNames = array(
38
+ 'const' => true,
39
+ 'function' => true,
40
+ );
41
+
42
+ /**
43
+ * Returns an array of tokens this test wants to listen for.
44
+ *
45
+ * @return array
46
+ */
47
+ public function register()
48
+ {
49
+ return array(T_USE);
50
+ }
51
+
52
+
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.
59
+ *
60
+ * @return void
61
+ */
62
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
63
+ {
64
+ if ($this->supportsBelow('5.5') !== true) {
65
+ return;
66
+ }
67
+
68
+ $tokens = $phpcsFile->getTokens();
69
+
70
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
71
+ if ($nextNonEmpty === false) {
72
+ // Live coding.
73
+ return;
74
+ }
75
+
76
+ if (isset($this->validUseNames[strtolower($tokens[$nextNonEmpty]['content'])]) === false) {
77
+ // Not a `use const` or `use function` statement.
78
+ return;
79
+ }
80
+
81
+ // `use const` and `use function` have to be followed by the function/constant name.
82
+ $functionOrConstName = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($nextNonEmpty + 1), null, true);
83
+ if ($functionOrConstName === false
84
+ // Identifies as T_AS or T_STRING, this covers both.
85
+ || ($tokens[$functionOrConstName]['content'] === 'as'
86
+ || $tokens[$functionOrConstName]['code'] === T_COMMA)
87
+ ) {
88
+ // Live coding or incorrect use of reserved keyword, but that is
89
+ // covered by the ForbiddenNames sniff.
90
+ return;
91
+ }
92
+
93
+ // Still here ? In that case we have encountered a `use const` or `use function` statement.
94
+ $phpcsFile->addError(
95
+ 'Importing functions and constants through a "use" statement is not supported in PHP 5.5 or lower.',
96
+ $nextNonEmpty,
97
+ 'Found'
98
+ );
99
+ }
100
+
101
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/NonStaticMagicMethodsSniff.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\NonStaticMagicMethodsSniff.
19
+ *
20
+ * Verifies the use of the correct visibility and static properties of magic methods.
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 NonStaticMagicMethodsSniff extends Sniff
28
+ {
29
+
30
+ /**
31
+ * A list of PHP magic methods and their visibility and static requirements.
32
+ *
33
+ * Method names in the array should be all *lowercase*.
34
+ * Visibility can be either 'public', 'protected' or 'private'.
35
+ * Static can be either 'true' - *must* be static, or 'false' - *must* be non-static.
36
+ * When a method does not have a specific requirement for either visibility or static,
37
+ * do *not* add the key.
38
+ *
39
+ * @var array(string)
40
+ */
41
+ protected $magicMethods = array(
42
+ '__get' => array(
43
+ 'visibility' => 'public',
44
+ 'static' => false,
45
+ ),
46
+ '__set' => array(
47
+ 'visibility' => 'public',
48
+ 'static' => false,
49
+ ),
50
+ '__isset' => array(
51
+ 'visibility' => 'public',
52
+ 'static' => false,
53
+ ),
54
+ '__unset' => array(
55
+ 'visibility' => 'public',
56
+ 'static' => false,
57
+ ),
58
+ '__call' => array(
59
+ 'visibility' => 'public',
60
+ 'static' => false,
61
+ ),
62
+ '__callstatic' => array(
63
+ 'visibility' => 'public',
64
+ 'static' => true,
65
+ ),
66
+ '__sleep' => array(
67
+ 'visibility' => 'public',
68
+ ),
69
+ '__tostring' => array(
70
+ 'visibility' => 'public',
71
+ ),
72
+ '__set_state' => array(
73
+ 'static' => true,
74
+ ),
75
+ );
76
+
77
+
78
+ /**
79
+ * Returns an array of tokens this test wants to listen for.
80
+ *
81
+ * @return array
82
+ */
83
+ public function register()
84
+ {
85
+ $targets = array(
86
+ T_CLASS,
87
+ T_INTERFACE,
88
+ );
89
+
90
+ if (defined('T_TRAIT')) {
91
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
92
+ $targets[] = T_TRAIT;
93
+ }
94
+
95
+ if (defined('T_ANON_CLASS')) {
96
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
97
+ $targets[] = T_ANON_CLASS;
98
+ }
99
+
100
+ return $targets;
101
+
102
+ }//end register()
103
+
104
+
105
+ /**
106
+ * Processes this test, when one of its tokens is encountered.
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.
111
+ *
112
+ * @return void
113
+ */
114
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
115
+ {
116
+ // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it.
117
+ if ($this->supportsAbove('5.3') === false) {
118
+ return;
119
+ }
120
+
121
+ $tokens = $phpcsFile->getTokens();
122
+
123
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
124
+ return;
125
+ }
126
+
127
+ $classScopeCloser = $tokens[$stackPtr]['scope_closer'];
128
+ $functionPtr = $stackPtr;
129
+
130
+ // Find all the functions in this class or interface.
131
+ while (($functionToken = $phpcsFile->findNext(T_FUNCTION, $functionPtr, $classScopeCloser)) !== false) {
132
+ /*
133
+ * Get the scope closer for this function in order to know how
134
+ * to advance to the next function.
135
+ * If no body of function (e.g. for interfaces), there is
136
+ * no closing curly brace; advance the pointer differently.
137
+ */
138
+ if (isset($tokens[$functionToken]['scope_closer'])) {
139
+ $scopeCloser = $tokens[$functionToken]['scope_closer'];
140
+ } else {
141
+ $scopeCloser = ($functionToken + 1);
142
+ }
143
+
144
+ $methodName = $phpcsFile->getDeclarationName($functionToken);
145
+ $methodNameLc = strtolower($methodName);
146
+ if (isset($this->magicMethods[$methodNameLc]) === false) {
147
+ $functionPtr = $scopeCloser;
148
+ continue;
149
+ }
150
+
151
+ $methodProperties = $phpcsFile->getMethodProperties($functionToken);
152
+ $errorCodeBase = $this->stringToErrorCode($methodNameLc);
153
+
154
+ if (isset($this->magicMethods[$methodNameLc]['visibility']) && $this->magicMethods[$methodNameLc]['visibility'] !== $methodProperties['scope']) {
155
+ $error = 'Visibility for magic method %s must be %s. Found: %s';
156
+ $errorCode = $errorCodeBase . 'MethodVisibility';
157
+ $data = array(
158
+ $methodName,
159
+ $this->magicMethods[$methodNameLc]['visibility'],
160
+ $methodProperties['scope'],
161
+ );
162
+
163
+ $phpcsFile->addError($error, $functionToken, $errorCode, $data);
164
+ }
165
+
166
+ if (isset($this->magicMethods[$methodNameLc]['static']) && $this->magicMethods[$methodNameLc]['static'] !== $methodProperties['is_static']) {
167
+ $error = 'Magic method %s cannot be defined as static.';
168
+ $errorCode = $errorCodeBase . 'MethodStatic';
169
+ $data = array($methodName);
170
+
171
+ if ($this->magicMethods[$methodNameLc]['static'] === true) {
172
+ $error = 'Magic method %s must be defined as static.';
173
+ $errorCode = $errorCodeBase . 'MethodNonStatic';
174
+ }
175
+
176
+ $phpcsFile->addError($error, $functionToken, $errorCode, $data);
177
+ }
178
+
179
+ // Advance to next function.
180
+ $functionPtr = $scopeCloser;
181
+ }
182
+
183
+ }//end process()
184
+
185
+
186
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/OptionalRequiredFunctionParametersSniff.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\OptionalRequiredFunctionParametersSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\Sniffs\PHP\RequiredOptionalFunctionParametersSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\OptionalRequiredFunctionParametersSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class OptionalRequiredFunctionParametersSniff extends RequiredOptionalFunctionParametersSniff
22
+ {
23
+
24
+ /**
25
+ * A list of function parameters, which were optional in older versions and became required later on.
26
+ *
27
+ * The array lists : version number with true (required) and false (optional use deprecated).
28
+ *
29
+ * The index is the location of the parameter in the parameter list, starting at 0 !
30
+ * If's sufficient to list the last version in which the parameter was not yet required.
31
+ *
32
+ * @var array
33
+ */
34
+ protected $functionParameters = array(
35
+ // Special case, the optional nature is not deprecated, but usage is recommended
36
+ // and leaving the parameter out will throw an E_NOTICE.
37
+ 'crypt' => array(
38
+ 1 => array(
39
+ 'name' => 'salt',
40
+ '5.6' => 'recommended',
41
+ ),
42
+ ),
43
+ 'parse_str' => array(
44
+ 1 => array(
45
+ 'name' => 'result',
46
+ '7.2' => false,
47
+ ),
48
+ ),
49
+ );
50
+
51
+
52
+ /**
53
+ * Determine whether an error/warning should be thrown for an item based on collected information.
54
+ *
55
+ * @param array $errorInfo Detail information about an item.
56
+ *
57
+ * @return bool
58
+ */
59
+ protected function shouldThrowError(array $errorInfo)
60
+ {
61
+ return ($errorInfo['optionalDeprecated'] !== ''
62
+ || $errorInfo['optionalRemoved'] !== ''
63
+ || $errorInfo['optionalRecommended'] !== '');
64
+ }
65
+
66
+
67
+ /**
68
+ * Retrieve the relevant detail (version) information for use in an error message.
69
+ *
70
+ * @param array $itemArray Version and other information about the item.
71
+ * @param array $itemInfo Base information about the item.
72
+ *
73
+ * @return array
74
+ */
75
+ public function getErrorInfo(array $itemArray, array $itemInfo)
76
+ {
77
+ $errorInfo = array(
78
+ 'paramName' => '',
79
+ 'optionalRecommended' => '',
80
+ 'optionalDeprecated' => '',
81
+ 'optionalRemoved' => '',
82
+ 'error' => false,
83
+ );
84
+
85
+ $versionArray = $this->getVersionArray($itemArray);
86
+
87
+ if (empty($versionArray) === false) {
88
+ foreach ($versionArray as $version => $required) {
89
+ if ($this->supportsAbove($version) === true) {
90
+ if ($required === true && $errorInfo['optionalRemoved'] === '') {
91
+ $errorInfo['optionalRemoved'] = $version;
92
+ $errorInfo['error'] = true;
93
+ } elseif ($required === 'recommended' && $errorInfo['optionalRecommended'] === '') {
94
+ $errorInfo['optionalRecommended'] = $version;
95
+ } elseif ($errorInfo['optionalDeprecated'] === '') {
96
+ $errorInfo['optionalDeprecated'] = $version;
97
+ }
98
+ }
99
+ }
100
+ }
101
+
102
+ $errorInfo['paramName'] = $itemArray['name'];
103
+
104
+ return $errorInfo;
105
+
106
+ }//end getErrorInfo()
107
+
108
+
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.
115
+ * @param array $itemInfo Base information about the item.
116
+ * @param array $errorInfo Array with detail (version) information
117
+ * relevant to the item.
118
+ *
119
+ * @return void
120
+ */
121
+ public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
122
+ {
123
+ $error = 'The "%s" parameter for function %s() is missing. Passing this parameter is ';
124
+ if ($errorInfo['optionalRecommended'] === '') {
125
+ $error .= 'no longer optional. The optional nature of the parameter is ';
126
+ } else {
127
+ $error .= 'strongly recommended ';
128
+ }
129
+
130
+ $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']);
131
+ $data = array(
132
+ $errorInfo['paramName'],
133
+ $itemInfo['name'],
134
+ );
135
+
136
+ if ($errorInfo['optionalRecommended'] !== '') {
137
+ $error .= 'since PHP %s ';
138
+ $errorCode .= 'SoftRecommended';
139
+ $data[] = $errorInfo['optionalRecommended'];
140
+ } else {
141
+ if ($errorInfo['optionalDeprecated'] !== '') {
142
+ $error .= 'deprecated since PHP %s and ';
143
+ $errorCode .= 'SoftRequired';
144
+ $data[] = $errorInfo['optionalDeprecated'];
145
+ }
146
+
147
+ if ($errorInfo['optionalRemoved'] !== '') {
148
+ $error .= 'removed since PHP %s and ';
149
+ $errorCode .= 'HardRequired';
150
+ $data[] = $errorInfo['optionalRemoved'];
151
+ }
152
+
153
+ // Remove the last 'and' from the message.
154
+ $error = substr($error, 0, (strlen($error) - 5));
155
+ }
156
+
157
+ $this->addMessage($phpcsFile, $error, $stackPtr, $errorInfo['error'], $errorCode, $data);
158
+
159
+ }//end addError()
160
+
161
+
162
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/PCRENewModifiersSniff.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\PCRENewModifiers.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\Sniffs\PHP\PregReplaceEModifierSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\PCRENewModifiers.
16
+ *
17
+ * Check for usage of newly added regex modifiers for PCRE functions.
18
+ *
19
+ * @category PHP
20
+ * @package PHPCompatibility
21
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
22
+ */
23
+ class PCRENewModifiersSniff extends PregReplaceEModifierSniff
24
+ {
25
+
26
+ /**
27
+ * Functions to check for.
28
+ *
29
+ * @var array
30
+ */
31
+ protected $targetFunctions = array(
32
+ 'preg_replace' => true,
33
+ 'preg_filter' => true,
34
+ 'preg_grep' => true,
35
+ 'preg_match_all' => true,
36
+ 'preg_match' => true,
37
+ 'preg_replace_callback_array' => true,
38
+ 'preg_replace_callback' => true,
39
+ 'preg_replace' => true,
40
+ 'preg_split' => true,
41
+ );
42
+
43
+ /**
44
+ * Array listing newly introduced regex modifiers.
45
+ *
46
+ * The key should be the modifier (case-sensitive!).
47
+ * The value should be the PHP version in which the modifier was introduced.
48
+ *
49
+ * @var array
50
+ */
51
+ protected $newModifiers = array(
52
+ 'J' => array(
53
+ '7.1' => false,
54
+ '7.2' => true,
55
+ ),
56
+ );
57
+
58
+
59
+ /**
60
+ * Do a version check to determine if this sniff needs to run at all.
61
+ *
62
+ * @return bool
63
+ */
64
+ protected function bowOutEarly()
65
+ {
66
+ // Version used here should be the highest version from the `$newModifiers` array,
67
+ // i.e. the last PHP version in which a new modifier was introduced.
68
+ return ($this->supportsBelow('7.2') === false);
69
+ }
70
+
71
+
72
+ /**
73
+ * Examine the regex modifier string.
74
+ *
75
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
76
+ * @param int $stackPtr The position of the current token in the
77
+ * stack passed in $tokens.
78
+ * @param string $functionName The function which contained the pattern.
79
+ * @param string $modifiers The regex modifiers found.
80
+ *
81
+ * @return void
82
+ */
83
+ protected function examineModifiers(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $modifiers)
84
+ {
85
+ $error = 'The PCRE regex modifier "%s" is not present in PHP version %s or earlier';
86
+
87
+ foreach ($this->newModifiers as $modifier => $versionArray) {
88
+ if (strpos($modifiers, $modifier) === false) {
89
+ continue;
90
+ }
91
+
92
+ $notInVersion = '';
93
+ foreach ($versionArray as $version => $present) {
94
+ if ($notInVersion === '' && $present === false
95
+ && $this->supportsBelow($version) === true
96
+ ) {
97
+ $notInVersion = $version;
98
+ }
99
+ }
100
+
101
+ if ($notInVersion === '') {
102
+ continue;
103
+ }
104
+
105
+ $errorCode = $modifier . 'ModifierFound';
106
+ $data = array(
107
+ $modifier,
108
+ $notInVersion,
109
+ );
110
+
111
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
112
+ }
113
+ }
114
+
115
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ParameterShadowSuperGlobalsSniff.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ParameterShadowSuperGlobalsSniff
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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+ use PHPCompatibility\PHPCSHelper;
17
+
18
+ /**
19
+ * \PHPCompatibility\Sniffs\PHP\ParameterShadowSuperGlobalsSniff
20
+ *
21
+ * Discourages use of superglobals as parameters for functions.
22
+ *
23
+ * {@internal List of superglobals is maintained in the parent class.}}
24
+ *
25
+ * PHP version 5.4
26
+ *
27
+ * @category PHP
28
+ * @package PHPCompatibility
29
+ * @author Declan Kelly <declankelly90@gmail.com>
30
+ * @copyright 2015 Declan Kelly
31
+ */
32
+ class ParameterShadowSuperGlobalsSniff extends Sniff
33
+ {
34
+
35
+ /**
36
+ * Register the tokens to listen for.
37
+ *
38
+ * @return array
39
+ */
40
+ public function register()
41
+ {
42
+ return array(
43
+ T_FUNCTION,
44
+ T_CLOSURE,
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Processes the test.
50
+ *
51
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
52
+ * @param int $stackPtr The position of the current token.
53
+ *
54
+ * @return void
55
+ */
56
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
57
+ {
58
+ if ($this->supportsAbove('5.4') === false) {
59
+ return;
60
+ }
61
+
62
+ // Get all parameters from function signature.
63
+ $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr);
64
+ if (empty($parameters) || is_array($parameters) === false) {
65
+ return;
66
+ }
67
+
68
+ foreach ($parameters as $param) {
69
+ if (in_array($param['name'], $this->superglobals, true)) {
70
+ $error = 'Parameter shadowing super global (%s) causes fatal error since PHP 5.4';
71
+ $errorCode = $this->stringToErrorCode(substr($param['name'], 1)) . 'Found';
72
+ $data = array($param['name']);
73
+
74
+ $phpcsFile->addError($error, $param['token'], $errorCode, $data);
75
+ }
76
+ }
77
+ }
78
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/PregReplaceEModifierSniff.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\PregReplaceEModifierSniff.
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\PHP;
14
+
15
+ use PHPCompatibility\AbstractFunctionCallParameterSniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\PregReplaceEModifierSniff.
19
+ *
20
+ * Check for usage of the `e` modifier with PCRE functions which is deprecated since PHP 5.5
21
+ * and removed as of PHP 7.0.
22
+ *
23
+ * PHP version 5.5
24
+ *
25
+ * @category PHP
26
+ * @package PHPCompatibility
27
+ * @author Wim Godden <wim.godden@cu.be>
28
+ * @copyright 2014 Cu.be Solutions bvba
29
+ */
30
+ class PregReplaceEModifierSniff extends AbstractFunctionCallParameterSniff
31
+ {
32
+
33
+ /**
34
+ * Functions to check for.
35
+ *
36
+ * @var array
37
+ */
38
+ protected $targetFunctions = array(
39
+ 'preg_replace' => true,
40
+ 'preg_filter' => true,
41
+ );
42
+
43
+ /**
44
+ * Regex bracket delimiters.
45
+ *
46
+ * @var array
47
+ */
48
+ protected $doublesSeparators = array(
49
+ '{' => '}',
50
+ '[' => ']',
51
+ '(' => ')',
52
+ '<' => '>',
53
+ );
54
+
55
+
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.
62
+ * @param array $parameters Array with information about the parameters.
63
+ *
64
+ * @return int|void Integer stack pointer to skip forward or void to continue
65
+ * normal file processing.
66
+ */
67
+ public function processParameters(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $parameters)
68
+ {
69
+ // Check the first parameter in the function call as that should contain the regex(es).
70
+ if (isset($parameters[1]) === false) {
71
+ return;
72
+ }
73
+
74
+ $tokens = $phpcsFile->getTokens();
75
+ $functionNameLc = strtolower($functionName);
76
+ $firstParam = $parameters[1];
77
+
78
+ // Differentiate between an array of patterns passed and a single pattern.
79
+ $nextNonEmpty = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $firstParam['start'], ($firstParam['end'] + 1), true);
80
+ if ($nextNonEmpty !== false && ($tokens[$nextNonEmpty]['code'] === T_ARRAY || $tokens[$nextNonEmpty]['code'] === T_OPEN_SHORT_ARRAY)) {
81
+ $arrayValues = $this->getFunctionCallParameters($phpcsFile, $nextNonEmpty);
82
+ if ($functionNameLc === 'preg_replace_callback_array') {
83
+ // For preg_replace_callback_array(), the patterns will be in the array keys.
84
+ foreach ($arrayValues as $value) {
85
+ $hasKey = $phpcsFile->findNext(T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1));
86
+ if ($hasKey === false) {
87
+ continue;
88
+ }
89
+
90
+ $value['end'] = ($hasKey - 1);
91
+ $value['raw'] = trim($phpcsFile->getTokensAsString($value['start'], ($hasKey - $value['start'])));
92
+ $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName);
93
+ }
94
+
95
+ } else {
96
+ // Otherwise, the patterns will be in the array values.
97
+ foreach ($arrayValues as $value) {
98
+ $hasKey = $phpcsFile->findNext(T_DOUBLE_ARROW, $value['start'], ($value['end'] + 1));
99
+ if ($hasKey !== false) {
100
+ $value['start'] = ($hasKey + 1);
101
+ $value['raw'] = trim($phpcsFile->getTokensAsString($value['start'], (($value['end'] + 1) - $value['start'])));
102
+ }
103
+
104
+ $this->processRegexPattern($value, $phpcsFile, $value['end'], $functionName);
105
+ }
106
+ }
107
+
108
+ } else {
109
+ $this->processRegexPattern($firstParam, $phpcsFile, $stackPtr, $functionName);
110
+ }
111
+ }
112
+
113
+
114
+ /**
115
+ * Do a version check to determine if this sniff needs to run at all.
116
+ *
117
+ * @return bool
118
+ */
119
+ protected function bowOutEarly()
120
+ {
121
+ return ($this->supportsAbove('5.5') === false);
122
+ }
123
+
124
+
125
+ /**
126
+ * Analyse a potential regex pattern for usage of the /e modifier.
127
+ *
128
+ * @param array $pattern Array containing the start and end token
129
+ * pointer of the potential regex pattern and
130
+ * the raw string value of the pattern.
131
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
132
+ * @param int $stackPtr The position of the current token in the
133
+ * stack passed in $tokens.
134
+ * @param string $functionName The function which contained the pattern.
135
+ *
136
+ * @return void
137
+ */
138
+ protected function processRegexPattern($pattern, \PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName)
139
+ {
140
+ $tokens = $phpcsFile->getTokens();
141
+
142
+ /*
143
+ * The pattern might be build up of a combination of strings, variables
144
+ * and function calls. We are only concerned with the strings.
145
+ */
146
+ $regex = '';
147
+ for ($i = $pattern['start']; $i <= $pattern['end']; $i++) {
148
+ if (in_array($tokens[$i]['code'], \PHP_CodeSniffer_Tokens::$stringTokens, true) === true) {
149
+ $content = $this->stripQuotes($tokens[$i]['content']);
150
+ if ($tokens[$i]['code'] === T_DOUBLE_QUOTED_STRING) {
151
+ $content = $this->stripVariables($content);
152
+ }
153
+
154
+ $regex .= trim($content);
155
+ }
156
+ }
157
+
158
+ // Deal with multi-line regexes which were broken up in several string tokens.
159
+ if ($tokens[$pattern['start']]['line'] !== $tokens[$pattern['end']]['line']) {
160
+ $regex = $this->stripQuotes($regex);
161
+ }
162
+
163
+ if ($regex === '') {
164
+ // No string token found in the first parameter, so skip it (e.g. if variable passed in).
165
+ return;
166
+ }
167
+
168
+ $regexFirstChar = substr($regex, 0, 1);
169
+
170
+ // Make sure that the character identified as the delimiter is valid.
171
+ // Otherwise, it is a false positive caused by the string concatenation.
172
+ if (preg_match('`[a-z0-9\\\\ ]`i', $regexFirstChar) === 1) {
173
+ return;
174
+ }
175
+
176
+ if (isset($this->doublesSeparators[$regexFirstChar])) {
177
+ $regexEndPos = strrpos($regex, $this->doublesSeparators[$regexFirstChar]);
178
+ } else {
179
+ $regexEndPos = strrpos($regex, $regexFirstChar);
180
+ }
181
+
182
+ if ($regexEndPos !== false) {
183
+ $modifiers = substr($regex, $regexEndPos + 1);
184
+ $this->examineModifiers($phpcsFile, $stackPtr, $functionName, $modifiers);
185
+ }
186
+ }//end processRegexPattern()
187
+
188
+
189
+ /**
190
+ * Examine the regex modifier string.
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.
195
+ * @param string $functionName The function which contained the pattern.
196
+ * @param string $modifiers The regex modifiers found.
197
+ *
198
+ * @return void
199
+ */
200
+ protected function examineModifiers(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $functionName, $modifiers)
201
+ {
202
+ if (strpos($modifiers, 'e') !== false) {
203
+ $error = '%s() - /e modifier is deprecated since PHP 5.5';
204
+ $isError = false;
205
+ $errorCode = 'Deprecated';
206
+ $data = array($functionName);
207
+
208
+ if ($this->supportsAbove('7.0')) {
209
+ $error .= ' and removed since PHP 7.0';
210
+ $isError = true;
211
+ $errorCode = 'Removed';
212
+ }
213
+
214
+ $this->addMessage($phpcsFile, $error, $stackPtr, $isError, $errorCode, $data);
215
+ }
216
+ }
217
+
218
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedAlternativePHPTagsSniff.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\RemovedAlternativePHPTags.
18
+ *
19
+ * Check for usage of alternative PHP tags - removed in PHP 7.0.
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ *
27
+ * Based on `Generic_Sniffs_PHP_DisallowAlternativePHPTags` by Juliette Reinders Folmer
28
+ * which was merged into PHPCS 2.7.0.
29
+ */
30
+ class RemovedAlternativePHPTagsSniff extends Sniff
31
+ {
32
+
33
+ /**
34
+ * Whether ASP tags are enabled or not.
35
+ *
36
+ * @var bool
37
+ */
38
+ private $aspTags = false;
39
+
40
+ /**
41
+ * Returns an array of tokens this test wants to listen for.
42
+ *
43
+ * @return array
44
+ */
45
+ public function register()
46
+ {
47
+ if (version_compare(PHP_VERSION_ID, '70000', '<') === true) {
48
+ // phpcs:ignore PHPCompatibility.PHP.DeprecatedIniDirectives.asp_tagsRemoved
49
+ $this->aspTags = (bool) ini_get('asp_tags');
50
+ }
51
+
52
+ return array(
53
+ T_OPEN_TAG,
54
+ T_OPEN_TAG_WITH_ECHO,
55
+ T_INLINE_HTML,
56
+ );
57
+
58
+ }//end register()
59
+
60
+
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.
67
+ *
68
+ * @return void
69
+ */
70
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
71
+ {
72
+ if ($this->supportsAbove('7.0') === false) {
73
+ return;
74
+ }
75
+
76
+ $tokens = $phpcsFile->getTokens();
77
+ $openTag = $tokens[$stackPtr];
78
+ $content = trim($openTag['content']);
79
+
80
+ if ($content === '' || $content === '<?php') {
81
+ return;
82
+ }
83
+
84
+ if ($openTag['code'] === T_OPEN_TAG || $openTag['code'] === T_OPEN_TAG_WITH_ECHO) {
85
+
86
+ if ($content === '<%' || $content === '<%=') {
87
+ $data = array(
88
+ 'ASP',
89
+ $content,
90
+ );
91
+ $errorCode = 'ASPOpenTagFound';
92
+
93
+ } elseif (strpos($content, '<script ') !== false) {
94
+ $data = array(
95
+ 'Script',
96
+ $content,
97
+ );
98
+ $errorCode = 'ScriptOpenTagFound';
99
+ } else {
100
+ return;
101
+ }
102
+ }
103
+ // Account for incorrect script open tags.
104
+ // The "(?:<s)?" in the regex is to work-around a bug in the tokenizer in PHP 5.2.
105
+ elseif ($openTag['code'] === T_INLINE_HTML
106
+ && preg_match('`((?:<s)?cript (?:[^>]+)?language=[\'"]?php[\'"]?(?:[^>]+)?>)`i', $content, $match) === 1
107
+ ) {
108
+ $found = $match[1];
109
+ $data = array(
110
+ 'Script',
111
+ $found,
112
+ );
113
+ $errorCode = 'ScriptOpenTagFound';
114
+ }
115
+
116
+ if (isset($errorCode, $data)) {
117
+ $phpcsFile->addError(
118
+ '%s style opening tags have been removed in PHP 7.0. Found "%s"',
119
+ $stackPtr,
120
+ $errorCode,
121
+ $data
122
+ );
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';
130
+ $snippet = $this->getSnippet($content, '<%');
131
+ $data = array('<%' . $snippet);
132
+
133
+ $phpcsFile->addWarning($error, $stackPtr, 'MaybeASPOpenTagFound', $data);
134
+ }
135
+ }
136
+
137
+ }//end process()
138
+
139
+
140
+ /**
141
+ * Get a snippet from a HTML token.
142
+ *
143
+ * @param string $content The content of the HTML token.
144
+ * @param string $startAt Partial string to use as a starting point for the snippet.
145
+ * @param int $length The target length of the snippet to get. Defaults to 25.
146
+ *
147
+ * @return string
148
+ */
149
+ protected function getSnippet($content, $startAt = '', $length = 25)
150
+ {
151
+ $startPos = 0;
152
+
153
+ if ($startAt !== '') {
154
+ $startPos = strpos($content, $startAt);
155
+ if ($startPos !== false) {
156
+ $startPos += strlen($startAt);
157
+ }
158
+ }
159
+
160
+ $snippet = substr($content, $startPos, $length);
161
+ if ((strlen($content) - $startPos) > $length) {
162
+ $snippet .= '...';
163
+ }
164
+
165
+ return $snippet;
166
+
167
+ }//end getSnippet()
168
+
169
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedConstantsSniff.php ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\RemovedConstantsSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\RemovedConstantsSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class RemovedConstantsSniff extends AbstractRemovedFeatureSniff
22
+ {
23
+
24
+ /**
25
+ * A list of removed PHP Constants.
26
+ *
27
+ * The array lists : version number with false (deprecated) or true (removed).
28
+ * If's sufficient to list the first version where the constant was deprecated/removed.
29
+ *
30
+ * Note: PHP Constants are case-sensitive!
31
+ *
32
+ * @var array(string => array(string => bool|string|null))
33
+ */
34
+ protected $removedConstants = array(
35
+ // Disabled since PHP 5.3.0 due to thread safety issues.
36
+ 'FILEINFO_COMPRESS' => array(
37
+ '5.3' => true,
38
+ ),
39
+
40
+ 'CURLOPT_CLOSEPOLICY' => array(
41
+ '5.6' => true,
42
+ ),
43
+ 'CURLCLOSEPOLICY_LEAST_RECENTLY_USED' => array(
44
+ '5.6' => true,
45
+ ),
46
+ 'CURLCLOSEPOLICY_LEAST_TRAFFIC' => array(
47
+ '5.6' => true,
48
+ ),
49
+ 'CURLCLOSEPOLICY_SLOWEST' => array(
50
+ '5.6' => true,
51
+ ),
52
+ 'CURLCLOSEPOLICY_CALLBACK' => array(
53
+ '5.6' => true,
54
+ ),
55
+ 'CURLCLOSEPOLICY_OLDEST' => array(
56
+ '5.6' => true,
57
+ ),
58
+
59
+ 'PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT' => array(
60
+ '7.0' => true,
61
+ ),
62
+
63
+ 'INTL_IDNA_VARIANT_2003' => array(
64
+ '7.2' => false,
65
+ ),
66
+
67
+ 'MCRYPT_MODE_ECB' => array(
68
+ '7.1' => false,
69
+ '7.2' => true,
70
+ ),
71
+ 'MCRYPT_MODE_CBC' => array(
72
+ '7.1' => false,
73
+ '7.2' => true,
74
+ ),
75
+ 'MCRYPT_MODE_CFB' => array(
76
+ '7.1' => false,
77
+ '7.2' => true,
78
+ ),
79
+ 'MCRYPT_MODE_OFB' => array(
80
+ '7.1' => false,
81
+ '7.2' => true,
82
+ ),
83
+ 'MCRYPT_MODE_NOFB' => array(
84
+ '7.1' => false,
85
+ '7.2' => true,
86
+ ),
87
+ 'MCRYPT_MODE_STREAM' => array(
88
+ '7.1' => false,
89
+ '7.2' => true,
90
+ ),
91
+ 'MCRYPT_ENCRYPT' => array(
92
+ '7.1' => false,
93
+ '7.2' => true,
94
+ ),
95
+ 'MCRYPT_DECRYPT' => array(
96
+ '7.1' => false,
97
+ '7.2' => true,
98
+ ),
99
+ 'MCRYPT_DEV_RANDOM' => array(
100
+ '7.1' => false,
101
+ '7.2' => true,
102
+ ),
103
+ 'MCRYPT_DEV_URANDOM' => array(
104
+ '7.1' => false,
105
+ '7.2' => true,
106
+ ),
107
+ 'MCRYPT_RAND' => array(
108
+ '7.1' => false,
109
+ '7.2' => true,
110
+ ),
111
+ 'MCRYPT_3DES' => array(
112
+ '7.1' => false,
113
+ '7.2' => true,
114
+ ),
115
+ 'MCRYPT_ARCFOUR_IV' => array(
116
+ '7.1' => false,
117
+ '7.2' => true,
118
+ ),
119
+ 'MCRYPT_ARCFOUR' => array(
120
+ '7.1' => false,
121
+ '7.2' => true,
122
+ ),
123
+ 'MCRYPT_BLOWFISH' => array(
124
+ '7.1' => false,
125
+ '7.2' => true,
126
+ ),
127
+ 'MCRYPT_CAST_128' => array(
128
+ '7.1' => false,
129
+ '7.2' => true,
130
+ ),
131
+ 'MCRYPT_CAST_256' => array(
132
+ '7.1' => false,
133
+ '7.2' => true,
134
+ ),
135
+ 'MCRYPT_CRYPT' => array(
136
+ '7.1' => false,
137
+ '7.2' => true,
138
+ ),
139
+ 'MCRYPT_DES' => array(
140
+ '7.1' => false,
141
+ '7.2' => true,
142
+ ),
143
+ 'MCRYPT_DES_COMPAT' => array(
144
+ '7.1' => false,
145
+ '7.2' => true,
146
+ ),
147
+ 'MCRYPT_ENIGMA' => array(
148
+ '7.1' => false,
149
+ '7.2' => true,
150
+ ),
151
+ 'MCRYPT_GOST' => array(
152
+ '7.1' => false,
153
+ '7.2' => true,
154
+ ),
155
+ 'MCRYPT_IDEA' => array(
156
+ '7.1' => false,
157
+ '7.2' => true,
158
+ ),
159
+ 'MCRYPT_LOKI97' => array(
160
+ '7.1' => false,
161
+ '7.2' => true,
162
+ ),
163
+ 'MCRYPT_MARS' => array(
164
+ '7.1' => false,
165
+ '7.2' => true,
166
+ ),
167
+ 'MCRYPT_PANAMA' => array(
168
+ '7.1' => false,
169
+ '7.2' => true,
170
+ ),
171
+ 'MCRYPT_RIJNDAEL_128' => array(
172
+ '7.1' => false,
173
+ '7.2' => true,
174
+ ),
175
+ 'MCRYPT_RIJNDAEL_192' => array(
176
+ '7.1' => false,
177
+ '7.2' => true,
178
+ ),
179
+ 'MCRYPT_RIJNDAEL_256' => array(
180
+ '7.1' => false,
181
+ '7.2' => true,
182
+ ),
183
+ 'MCRYPT_RC2' => array(
184
+ '7.1' => false,
185
+ '7.2' => true,
186
+ ),
187
+ 'MCRYPT_RC4' => array(
188
+ '7.1' => false,
189
+ '7.2' => true,
190
+ ),
191
+ 'MCRYPT_RC6' => array(
192
+ '7.1' => false,
193
+ '7.2' => true,
194
+ ),
195
+ 'MCRYPT_RC6_128' => array(
196
+ '7.1' => false,
197
+ '7.2' => true,
198
+ ),
199
+ 'MCRYPT_RC6_192' => array(
200
+ '7.1' => false,
201
+ '7.2' => true,
202
+ ),
203
+ 'MCRYPT_RC6_256' => array(
204
+ '7.1' => false,
205
+ '7.2' => true,
206
+ ),
207
+ 'MCRYPT_SAFER64' => array(
208
+ '7.1' => false,
209
+ '7.2' => true,
210
+ ),
211
+ 'MCRYPT_SAFER128' => array(
212
+ '7.1' => false,
213
+ '7.2' => true,
214
+ ),
215
+ 'MCRYPT_SAFERPLUS' => array(
216
+ '7.1' => false,
217
+ '7.2' => true,
218
+ ),
219
+ 'MCRYPT_SERPENT' => array(
220
+ '7.1' => false,
221
+ '7.2' => true,
222
+ ),
223
+ 'MCRYPT_SERPENT_128' => array(
224
+ '7.1' => false,
225
+ '7.2' => true,
226
+ ),
227
+ 'MCRYPT_SERPENT_192' => array(
228
+ '7.1' => false,
229
+ '7.2' => true,
230
+ ),
231
+ 'MCRYPT_SERPENT_256' => array(
232
+ '7.1' => false,
233
+ '7.2' => true,
234
+ ),
235
+ 'MCRYPT_SKIPJACK' => array(
236
+ '7.1' => false,
237
+ '7.2' => true,
238
+ ),
239
+ 'MCRYPT_TEAN' => array(
240
+ '7.1' => false,
241
+ '7.2' => true,
242
+ ),
243
+ 'MCRYPT_THREEWAY' => array(
244
+ '7.1' => false,
245
+ '7.2' => true,
246
+ ),
247
+ 'MCRYPT_TRIPLEDES' => array(
248
+ '7.1' => false,
249
+ '7.2' => true,
250
+ ),
251
+ 'MCRYPT_TWOFISH' => array(
252
+ '7.1' => false,
253
+ '7.2' => true,
254
+ ),
255
+ 'MCRYPT_TWOFISH128' => array(
256
+ '7.1' => false,
257
+ '7.2' => true,
258
+ ),
259
+ 'MCRYPT_TWOFISH192' => array(
260
+ '7.1' => false,
261
+ '7.2' => true,
262
+ ),
263
+ 'MCRYPT_TWOFISH256' => array(
264
+ '7.1' => false,
265
+ '7.2' => true,
266
+ ),
267
+ 'MCRYPT_WAKE' => array(
268
+ '7.1' => false,
269
+ '7.2' => true,
270
+ ),
271
+ 'MCRYPT_XTEA' => array(
272
+ '7.1' => false,
273
+ '7.2' => true,
274
+ ),
275
+ );
276
+
277
+
278
+ /**
279
+ * Returns an array of tokens this test wants to listen for.
280
+ *
281
+ * @return array
282
+ */
283
+ public function register()
284
+ {
285
+ return array(T_STRING);
286
+
287
+ }//end register()
288
+
289
+
290
+ /**
291
+ * Processes this test, when one of its tokens is encountered.
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 void
298
+ */
299
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
300
+ {
301
+ $tokens = $phpcsFile->getTokens();
302
+ $constantName = $tokens[$stackPtr]['content'];
303
+
304
+ if (isset($this->removedConstants[$constantName]) === false) {
305
+ return;
306
+ }
307
+
308
+ if ($this->isUseOfGlobalConstant($phpcsFile, $stackPtr) === false) {
309
+ return;
310
+ }
311
+
312
+ $itemInfo = array(
313
+ 'name' => $constantName,
314
+ );
315
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
316
+
317
+ }//end process()
318
+
319
+
320
+ /**
321
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
322
+ *
323
+ * @param array $itemInfo Base information about the item.
324
+ *
325
+ * @return array Version and other information about the item.
326
+ */
327
+ public function getItemArray(array $itemInfo)
328
+ {
329
+ return $this->removedConstants[$itemInfo['name']];
330
+ }
331
+
332
+
333
+ /**
334
+ * Get the error message template for this sniff.
335
+ *
336
+ * @return string
337
+ */
338
+ protected function getErrorMsgTemplate()
339
+ {
340
+ return 'The constant "%s" is ';
341
+ }
342
+
343
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedExtensionsSniff.php ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
12
+
13
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\RemovedExtensionsSniff.
17
+ *
18
+ * Discourages the use of removed extensions. Suggests alternative extensions if available
19
+ *
20
+ * @category PHP
21
+ * @package PHPCompatibility
22
+ * @author Wim Godden <wim.godden@cu.be>
23
+ * @copyright 2012 Cu.be Solutions bvba
24
+ */
25
+ class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff
26
+ {
27
+ /**
28
+ * A list of functions to whitelist, if any.
29
+ *
30
+ * This is intended for projects using functions which start with the same
31
+ * prefix as one of the removed extensions.
32
+ *
33
+ * This property can be set from the ruleset, like so:
34
+ * <rule ref="PHPCompatibility.PHP.RemovedExtensions">
35
+ * <properties>
36
+ * <property name="functionWhitelist" type="array" value="mysql_to_rfc3339,mysql_another_function" />
37
+ * </properties>
38
+ * </rule>
39
+ *
40
+ * @var array
41
+ */
42
+ public $functionWhitelist;
43
+
44
+ /**
45
+ * A list of removed extensions with their alternative, if any
46
+ *
47
+ * The array lists : version number with false (deprecated) and true (removed).
48
+ * If's sufficient to list the first version where the extension was deprecated/removed.
49
+ *
50
+ * @var array(string|null)
51
+ */
52
+ protected $removedExtensions = array(
53
+ 'activescript' => array(
54
+ '5.1' => true,
55
+ 'alternative' => 'pecl/activescript',
56
+ ),
57
+ 'cpdf' => array(
58
+ '5.1' => true,
59
+ 'alternative' => 'pecl/pdflib',
60
+ ),
61
+ 'dbase' => array(
62
+ '5.3' => true,
63
+ 'alternative' => null,
64
+ ),
65
+ 'dbx' => array(
66
+ '5.1' => true,
67
+ 'alternative' => 'pecl/dbx',
68
+ ),
69
+ 'dio' => array(
70
+ '5.1' => true,
71
+ 'alternative' => 'pecl/dio',
72
+ ),
73
+ 'ereg' => array(
74
+ '5.3' => false,
75
+ '7.0' => true,
76
+ 'alternative' => 'pcre',
77
+ ),
78
+ 'fam' => array(
79
+ '5.1' => true,
80
+ 'alternative' => null,
81
+ ),
82
+ 'fbsql' => array(
83
+ '5.3' => true,
84
+ 'alternative' => null,
85
+ ),
86
+ 'fdf' => array(
87
+ '5.3' => true,
88
+ 'alternative' => 'pecl/fdf',
89
+ ),
90
+ 'filepro' => array(
91
+ '5.2' => true,
92
+ 'alternative' => null,
93
+ ),
94
+ 'hw_api' => array(
95
+ '5.2' => true,
96
+ 'alternative' => null,
97
+ ),
98
+ 'ingres' => array(
99
+ '5.1' => true,
100
+ 'alternative' => 'pecl/ingres',
101
+ ),
102
+ 'ircg' => array(
103
+ '5.1' => true,
104
+ 'alternative' => null,
105
+ ),
106
+ 'mcrypt' => array(
107
+ '7.1' => false,
108
+ '7.2' => true,
109
+ 'alternative' => 'openssl (preferred) or pecl/mcrypt once available',
110
+ ),
111
+ 'mcve' => array(
112
+ '5.1' => true,
113
+ 'alternative' => 'pecl/mvce',
114
+ ),
115
+ 'ming' => array(
116
+ '5.3' => true,
117
+ 'alternative' => 'pecl/ming',
118
+ ),
119
+ 'mnogosearch' => array(
120
+ '5.1' => true,
121
+ 'alternative' => null,
122
+ ),
123
+ 'msql' => array(
124
+ '5.3' => true,
125
+ 'alternative' => null,
126
+ ),
127
+ 'mssql' => array(
128
+ '7.0' => true,
129
+ 'alternative' => null,
130
+ ),
131
+ 'mysql_' => array(
132
+ '5.5' => false,
133
+ '7.0' => true,
134
+ 'alternative' => 'mysqli',
135
+ ),
136
+ 'ncurses' => array(
137
+ '5.3' => true,
138
+ 'alternative' => 'pecl/ncurses',
139
+ ),
140
+ 'oracle' => array(
141
+ '5.1' => true,
142
+ 'alternative' => 'oci8 or pdo_oci',
143
+ ),
144
+ 'ovrimos' => array(
145
+ '5.1' => true,
146
+ 'alternative' => null,
147
+ ),
148
+ 'pfpro' => array(
149
+ '5.3' => true,
150
+ 'alternative' => null,
151
+ ),
152
+ 'sqlite' => array(
153
+ '5.4' => true,
154
+ 'alternative' => null,
155
+ ),
156
+ // Has to be before `sybase` as otherwise it will never match.
157
+ 'sybase_ct' => array(
158
+ '7.0' => true,
159
+ 'alternative' => null,
160
+ ),
161
+ 'sybase' => array(
162
+ '5.3' => true,
163
+ 'alternative' => 'sybase_ct',
164
+ ),
165
+ 'w32api' => array(
166
+ '5.1' => true,
167
+ 'alternative' => 'pecl/ffi',
168
+ ),
169
+ 'yp' => array(
170
+ '5.1' => true,
171
+ 'alternative' => null,
172
+ ),
173
+ );
174
+
175
+ /**
176
+ * Returns an array of tokens this test wants to listen for.
177
+ *
178
+ * @return array
179
+ */
180
+ public function register()
181
+ {
182
+ // Handle case-insensitivity of function names.
183
+ $this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions);
184
+
185
+ return array(T_STRING);
186
+
187
+ }//end register()
188
+
189
+ /**
190
+ * Processes this test, when one of its tokens is encountered.
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.
195
+ *
196
+ * @return void
197
+ */
198
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
199
+ {
200
+ $tokens = $phpcsFile->getTokens();
201
+
202
+ // Find the next non-empty token.
203
+ $openBracket = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
204
+
205
+ if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
206
+ // Not a function call.
207
+ return;
208
+ }
209
+
210
+ if (isset($tokens[$openBracket]['parenthesis_closer']) === false) {
211
+ // Not a function call.
212
+ return;
213
+ }
214
+
215
+ // Find the previous non-empty token.
216
+ $search = \PHP_CodeSniffer_Tokens::$emptyTokens;
217
+ $search[] = T_BITWISE_AND;
218
+ $previous = $phpcsFile->findPrevious($search, ($stackPtr - 1), null, true);
219
+ if ($tokens[$previous]['code'] === T_FUNCTION) {
220
+ // It's a function definition, not a function call.
221
+ return;
222
+ }
223
+
224
+ if ($tokens[$previous]['code'] === T_NEW) {
225
+ // We are creating an object, not calling a function.
226
+ return;
227
+ }
228
+
229
+ if ($tokens[$previous]['code'] === T_OBJECT_OPERATOR) {
230
+ // We are calling a method of an object.
231
+ return;
232
+ }
233
+
234
+ $function = $tokens[$stackPtr]['content'];
235
+ $functionLc = strtolower($function);
236
+
237
+ if ($this->isWhiteListed($functionLc) === true) {
238
+ // Function is whitelisted.
239
+ return;
240
+ }
241
+
242
+ foreach ($this->removedExtensions as $extension => $versionList) {
243
+ if (strpos($functionLc, $extension) === 0) {
244
+ $itemInfo = array(
245
+ 'name' => $extension,
246
+ );
247
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
248
+ break;
249
+ }
250
+ }
251
+
252
+ }//end process()
253
+
254
+
255
+ /**
256
+ * Is the current function being checked whitelisted ?
257
+ *
258
+ * Parsing the list late as it may be provided as a property, but also inline.
259
+ *
260
+ * @param string $content Content of the current token.
261
+ *
262
+ * @return bool
263
+ */
264
+ protected function isWhiteListed($content)
265
+ {
266
+ if (isset($this->functionWhitelist) === false) {
267
+ return false;
268
+ }
269
+
270
+ if (is_string($this->functionWhitelist) === true) {
271
+ if (strpos($this->functionWhitelist, ',') !== false) {
272
+ $this->functionWhitelist = explode(',', $this->functionWhitelist);
273
+ } else {
274
+ $this->functionWhitelist = (array) $this->functionWhitelist;
275
+ }
276
+ }
277
+
278
+ if (is_array($this->functionWhitelist) === true) {
279
+ $this->functionWhitelist = array_map('strtolower', $this->functionWhitelist);
280
+ return in_array($content, $this->functionWhitelist, true);
281
+ }
282
+
283
+ return false;
284
+
285
+ }//end isWhiteListed()
286
+
287
+
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.
294
+ */
295
+ public function getItemArray(array $itemInfo)
296
+ {
297
+ return $this->removedExtensions[$itemInfo['name']];
298
+ }
299
+
300
+
301
+ /**
302
+ * Get the error message template for this sniff.
303
+ *
304
+ * @return string
305
+ */
306
+ protected function getErrorMsgTemplate()
307
+ {
308
+ return "Extension '%s' is ";
309
+ }
310
+
311
+
312
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedFunctionParametersSniff.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\RemovedFunctionParametersSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\RemovedFunctionParametersSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Wim Godden <wim.godden@cu.be>
20
+ */
21
+ class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
22
+ {
23
+ /**
24
+ * A list of removed function parameters, which were present in older versions.
25
+ *
26
+ * The array lists : version number with false (deprecated) and true (removed).
27
+ * The index is the location of the parameter in the parameter list, starting at 0 !
28
+ * If's sufficient to list the first version where the function parameter was deprecated/removed.
29
+ *
30
+ * @var array
31
+ */
32
+ protected $removedFunctionParameters = array(
33
+ 'gmmktime' => array(
34
+ 6 => array(
35
+ 'name' => 'is_dst',
36
+ '5.1' => false,
37
+ '7.0' => true,
38
+ ),
39
+ ),
40
+ 'ldap_first_attribute' => array(
41
+ 2 => array(
42
+ 'name' => 'ber_identifier',
43
+ '5.2.4' => true,
44
+ ),
45
+ ),
46
+ 'ldap_next_attribute' => array(
47
+ 2 => array(
48
+ 'name' => 'ber_identifier',
49
+ '5.2.4' => true,
50
+ ),
51
+ ),
52
+ 'mktime' => array(
53
+ 6 => array(
54
+ 'name' => 'is_dst',
55
+ '5.1' => false,
56
+ '7.0' => true,
57
+ ),
58
+ ),
59
+ );
60
+
61
+
62
+ /**
63
+ * Returns an array of tokens this test wants to listen for.
64
+ *
65
+ * @return array
66
+ */
67
+ public function register()
68
+ {
69
+ // Handle case-insensitivity of function names.
70
+ $this->removedFunctionParameters = $this->arrayKeysToLowercase($this->removedFunctionParameters);
71
+
72
+ return array(T_STRING);
73
+ }//end register()
74
+
75
+ /**
76
+ * Processes this test, when one of its tokens is encountered.
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.
81
+ *
82
+ * @return void
83
+ */
84
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
85
+ {
86
+ $tokens = $phpcsFile->getTokens();
87
+
88
+ $ignore = array(
89
+ T_DOUBLE_COLON,
90
+ T_OBJECT_OPERATOR,
91
+ T_FUNCTION,
92
+ T_CONST,
93
+ );
94
+
95
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
96
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
97
+ // Not a call to a PHP function.
98
+ return;
99
+ }
100
+
101
+ $function = $tokens[$stackPtr]['content'];
102
+ $functionLc = strtolower($function);
103
+
104
+ if (isset($this->removedFunctionParameters[$functionLc]) === false) {
105
+ return;
106
+ }
107
+
108
+ $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
109
+ if ($parameterCount === 0) {
110
+ return;
111
+ }
112
+
113
+ // If the parameter count returned > 0, we know there will be valid open parenthesis.
114
+ $openParenthesis = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
115
+ $parameterOffsetFound = $parameterCount - 1;
116
+
117
+ foreach ($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) {
118
+ if ($offset <= $parameterOffsetFound) {
119
+ $itemInfo = array(
120
+ 'name' => $function,
121
+ 'nameLc' => $functionLc,
122
+ 'offset' => $offset,
123
+ );
124
+ $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
125
+ }
126
+ }
127
+
128
+ }//end process()
129
+
130
+
131
+ /**
132
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
133
+ *
134
+ * @param array $itemInfo Base information about the item.
135
+ *
136
+ * @return array Version and other information about the item.
137
+ */
138
+ public function getItemArray(array $itemInfo)
139
+ {
140
+ return $this->removedFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
141
+ }
142
+
143
+
144
+ /**
145
+ * Get an array of the non-PHP-version array keys used in a sub-array.
146
+ *
147
+ * @return array
148
+ */
149
+ protected function getNonVersionArrayKeys()
150
+ {
151
+ return array('name');
152
+ }
153
+
154
+
155
+ /**
156
+ * Retrieve the relevant detail (version) information for use in an error message.
157
+ *
158
+ * @param array $itemArray Version and other information about the item.
159
+ * @param array $itemInfo Base information about the item.
160
+ *
161
+ * @return array
162
+ */
163
+ public function getErrorInfo(array $itemArray, array $itemInfo)
164
+ {
165
+ $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
166
+ $errorInfo['paramName'] = $itemArray['name'];
167
+
168
+ return $errorInfo;
169
+ }
170
+
171
+
172
+ /**
173
+ * Get the item name to be used for the creation of the error code.
174
+ *
175
+ * @param array $itemInfo Base information about the item.
176
+ * @param array $errorInfo Detail information about an item.
177
+ *
178
+ * @return string
179
+ */
180
+ protected function getItemName(array $itemInfo, array $errorInfo)
181
+ {
182
+ return $itemInfo['name'] . '_' . $errorInfo['paramName'];
183
+ }
184
+
185
+
186
+ /**
187
+ * Get the error message template for this sniff.
188
+ *
189
+ * @return string
190
+ */
191
+ protected function getErrorMsgTemplate()
192
+ {
193
+ return 'The "%s" parameter for function %s() is ';
194
+ }
195
+
196
+
197
+ /**
198
+ * Filter the error data before it's passed to PHPCS.
199
+ *
200
+ * @param array $data The error data array which was created.
201
+ * @param array $itemInfo Base information about the item this error message applies to.
202
+ * @param array $errorInfo Detail information about an item this error message applies to.
203
+ *
204
+ * @return array
205
+ */
206
+ protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
207
+ {
208
+ array_shift($data);
209
+ array_unshift($data, $errorInfo['paramName'], $itemInfo['name']);
210
+ return $data;
211
+ }
212
+
213
+
214
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedGlobalVariablesSniff.php ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\RemovedGlobalVariablesSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Wim Godden <wim.godden@cu.be>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
13
+ use PHPCompatibility\PHPCSHelper;
14
+
15
+ /**
16
+ * \PHPCompatibility\Sniffs\PHP\RemovedGlobalVariablesSniff.
17
+ *
18
+ * Discourages the use of removed global variables. Suggests alternative extensions if available
19
+ *
20
+ * @category PHP
21
+ * @package PHPCompatibility
22
+ * @author Wim Godden <wim.godden@cu.be>
23
+ */
24
+ class RemovedGlobalVariablesSniff extends AbstractRemovedFeatureSniff
25
+ {
26
+
27
+ /**
28
+ * A list of removed global variables with their alternative, if any.
29
+ *
30
+ * The array lists : version number with false (deprecated) and true (removed).
31
+ * If's sufficient to list the first version where the variable was deprecated/removed.
32
+ *
33
+ * @var array(string|null)
34
+ */
35
+ protected $removedGlobalVariables = array(
36
+ 'HTTP_POST_VARS' => array(
37
+ '5.3' => false,
38
+ '5.4' => true,
39
+ 'alternative' => '$_POST',
40
+ ),
41
+ 'HTTP_GET_VARS' => array(
42
+ '5.3' => false,
43
+ '5.4' => true,
44
+ 'alternative' => '$_GET',
45
+ ),
46
+ 'HTTP_ENV_VARS' => array(
47
+ '5.3' => false,
48
+ '5.4' => true,
49
+ 'alternative' => '$_ENV',
50
+ ),
51
+ 'HTTP_SERVER_VARS' => array(
52
+ '5.3' => false,
53
+ '5.4' => true,
54
+ 'alternative' => '$_SERVER',
55
+ ),
56
+ 'HTTP_COOKIE_VARS' => array(
57
+ '5.3' => false,
58
+ '5.4' => true,
59
+ 'alternative' => '$_COOKIE',
60
+ ),
61
+ 'HTTP_SESSION_VARS' => array(
62
+ '5.3' => false,
63
+ '5.4' => true,
64
+ 'alternative' => '$_SESSION',
65
+ ),
66
+ 'HTTP_POST_FILES' => array(
67
+ '5.3' => false,
68
+ '5.4' => true,
69
+ 'alternative' => '$_FILES',
70
+ ),
71
+
72
+ 'HTTP_RAW_POST_DATA' => array(
73
+ '5.6' => false,
74
+ '7.0' => true,
75
+ 'alternative' => 'php://input',
76
+ ),
77
+
78
+ 'php_errormsg' => array(
79
+ '7.2' => false,
80
+ 'alternative' => 'error_get_last()',
81
+ ),
82
+ );
83
+
84
+
85
+ /**
86
+ * Returns an array of tokens this test wants to listen for.
87
+ *
88
+ * @return array
89
+ */
90
+ public function register()
91
+ {
92
+ return array(T_VARIABLE);
93
+
94
+ }//end register()
95
+
96
+
97
+ /**
98
+ * Processes this test, when one of its tokens is encountered.
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.
103
+ *
104
+ * @return void
105
+ */
106
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
107
+ {
108
+ if ($this->supportsAbove('5.3') === false) {
109
+ return;
110
+ }
111
+
112
+ $tokens = $phpcsFile->getTokens();
113
+ $varName = substr($tokens[$stackPtr]['content'], 1);
114
+
115
+ if (isset($this->removedGlobalVariables[$varName]) === false) {
116
+ return;
117
+ }
118
+
119
+ if ($this->isClassProperty($phpcsFile, $stackPtr) === true) {
120
+ // Ok, so this was a class property declaration, not our concern.
121
+ return;
122
+ }
123
+
124
+ // Check for static usage of class properties shadowing the removed global variables.
125
+ if ($this->inClassScope($phpcsFile, $stackPtr, false) === true) {
126
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
127
+ if ($prevToken !== false && $tokens[$prevToken]['code'] === T_DOUBLE_COLON) {
128
+ return;
129
+ }
130
+ }
131
+
132
+ // Do some additional checks for the $php_errormsg variable.
133
+ if ($varName === 'php_errormsg'
134
+ && $this->isTargetPHPErrormsgVar($phpcsFile, $stackPtr, $tokens) === false
135
+ ) {
136
+ return;
137
+ }
138
+
139
+ // Still here, so throw an error/warning.
140
+ $itemInfo = array(
141
+ 'name' => $varName,
142
+ );
143
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
144
+
145
+ }//end process()
146
+
147
+
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.
154
+ */
155
+ public function getItemArray(array $itemInfo)
156
+ {
157
+ return $this->removedGlobalVariables[$itemInfo['name']];
158
+ }
159
+
160
+
161
+ /**
162
+ * Get the error message template for this sniff.
163
+ *
164
+ * @return string
165
+ */
166
+ protected function getErrorMsgTemplate()
167
+ {
168
+ return "Global variable '\$%s' is ";
169
+ }
170
+
171
+
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.
178
+ *
179
+ * @return string
180
+ */
181
+ protected function filterErrorMsg($error, array $itemInfo, array $errorInfo)
182
+ {
183
+ if ($itemInfo['name'] === 'php_errormsg') {
184
+ $error = str_replace('Global', 'The', $error);
185
+ }
186
+ return $error;
187
+ }
188
+
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.
195
+ * @param array $tokens Token array of the current file.
196
+ *
197
+ * @return bool
198
+ */
199
+ private function isTargetPHPErrormsgVar(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $tokens)
200
+ {
201
+ $scopeStart = 0;
202
+
203
+ /*
204
+ * If the variable is detected within the scope of a function/closure, limit the checking.
205
+ */
206
+ $function = $phpcsFile->getCondition($stackPtr, T_CLOSURE);
207
+ if ($function === false) {
208
+ $function = $phpcsFile->getCondition($stackPtr, T_FUNCTION);
209
+ }
210
+
211
+ // It could also be a function param, which is not in the function scope.
212
+ if ($function === false && isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
213
+ $nestedParentheses = $tokens[$stackPtr]['nested_parenthesis'];
214
+ $parenthesisCloser = end($nestedParentheses);
215
+ if (isset($tokens[$parenthesisCloser]['parenthesis_owner'])
216
+ && ($tokens[$tokens[$parenthesisCloser]['parenthesis_owner']]['code'] === T_FUNCTION
217
+ || $tokens[$tokens[$parenthesisCloser]['parenthesis_owner']]['code'] === T_CLOSURE)
218
+ ) {
219
+ $function = $tokens[$parenthesisCloser]['parenthesis_owner'];
220
+ }
221
+ }
222
+
223
+ if ($function !== false) {
224
+ $scopeStart = $tokens[$function]['scope_opener'];
225
+ }
226
+
227
+ /*
228
+ * Now, let's do some additional checks.
229
+ */
230
+ $nextNonEmpty = $phpcsFile->findNext(
231
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
232
+ ($stackPtr + 1),
233
+ null,
234
+ true
235
+ );
236
+
237
+ // Is the variable being used as an array ?
238
+ if ($nextNonEmpty !== false && $tokens[$nextNonEmpty]['code'] === T_OPEN_SQUARE_BRACKET) {
239
+ // The PHP native variable is a string, so this is probably not it
240
+ // (except for array access to string, but why would you in this case ?).
241
+ return false;
242
+ }
243
+
244
+ // Is this a variable assignment ?
245
+ if ($nextNonEmpty !== false
246
+ && in_array($tokens[$nextNonEmpty]['code'], \PHP_CodeSniffer_Tokens::$assignmentTokens, true)
247
+ ) {
248
+ return false;
249
+ }
250
+
251
+ // Is this a function param shadowing the PHP native one ?
252
+ if ($function !== false) {
253
+ $parameters = PHPCSHelper::getMethodParameters($phpcsFile, $function);
254
+ if (is_array($parameters) === true && empty($parameters) === false) {
255
+ foreach ($parameters as $param) {
256
+ if ($param['name'] === '$php_errormsg') {
257
+ return false;
258
+ }
259
+ }
260
+ }
261
+ }
262
+
263
+ $skipPast = array(
264
+ 'T_CLASS' => true,
265
+ 'T_ANON_CLASS' => true,
266
+ 'T_INTERFACE' => true,
267
+ 'T_TRAIT' => true,
268
+ 'T_FUNCTION' => true,
269
+ 'T_CLOSURE' => true,
270
+ );
271
+
272
+ // Walk back and see if there is an assignment to the variable within the same scope.
273
+ for ($i = ($stackPtr - 1); $i >= $scopeStart; $i--) {
274
+ if ($tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
275
+ && isset($tokens[$i]['scope_condition'])
276
+ && isset($skipPast[$tokens[$tokens[$i]['scope_condition']]['type']])
277
+ ) {
278
+ // Skip past functions, classes etc.
279
+ $i = $tokens[$i]['scope_condition'];
280
+ continue;
281
+ }
282
+
283
+ if ($tokens[$i]['code'] !== T_VARIABLE || $tokens[$i]['content'] !== '$php_errormsg') {
284
+ continue;
285
+ }
286
+
287
+ $nextNonEmpty = $phpcsFile->findNext(
288
+ \PHP_CodeSniffer_Tokens::$emptyTokens,
289
+ ($i + 1),
290
+ null,
291
+ true
292
+ );
293
+
294
+ if ($nextNonEmpty !== false
295
+ && in_array($tokens[$nextNonEmpty]['code'], \PHP_CodeSniffer_Tokens::$assignmentTokens, true)
296
+ ) {
297
+ return false;
298
+ }
299
+ }
300
+
301
+ return true;
302
+ }
303
+
304
+
305
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RemovedHashAlgorithmsSniff.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\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\PHP;
14
+
15
+ use PHPCompatibility\AbstractRemovedFeatureSniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\RemovedHashAlgorithmsSniff.
19
+ *
20
+ * Discourages the use of deprecated and removed hash algorithms.
21
+ *
22
+ * PHP version 5.4
23
+ *
24
+ * @category PHP
25
+ * @package PHPCompatibility
26
+ * @author Wim Godden <wim.godden@cu.be>
27
+ * @copyright 2012 Cu.be Solutions bvba
28
+ */
29
+ class RemovedHashAlgorithmsSniff extends AbstractRemovedFeatureSniff
30
+ {
31
+
32
+ /**
33
+ * A list of removed hash algorithms, which were present in older versions.
34
+ *
35
+ * The array lists : version number with false (deprecated) and true (removed).
36
+ * If's sufficient to list the first version where the hash algorithm was deprecated/removed.
37
+ *
38
+ * @var array(string => array(string => bool))
39
+ */
40
+ protected $removedAlgorithms = array(
41
+ 'salsa10' => array(
42
+ '5.4' => true,
43
+ ),
44
+ 'salsa20' => array(
45
+ '5.4' => true,
46
+ ),
47
+ );
48
+
49
+ /**
50
+ * Returns an array of tokens this test wants to listen for.
51
+ *
52
+ * @return array
53
+ */
54
+ public function register()
55
+ {
56
+ return array(T_STRING);
57
+
58
+ }//end register()
59
+
60
+
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.
67
+ *
68
+ * @return void
69
+ */
70
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
71
+ {
72
+ $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr);
73
+ if (empty($algo) || is_string($algo) === false) {
74
+ return;
75
+ }
76
+
77
+ // Bow out if not one of the algorithms we're targetting.
78
+ if (isset($this->removedAlgorithms[$algo]) === false) {
79
+ return;
80
+ }
81
+
82
+ $itemInfo = array(
83
+ 'name' => $algo,
84
+ );
85
+ $this->handleFeature($phpcsFile, $stackPtr, $itemInfo);
86
+
87
+ }//end process()
88
+
89
+
90
+ /**
91
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
92
+ *
93
+ * @param array $itemInfo Base information about the item.
94
+ *
95
+ * @return array Version and other information about the item.
96
+ */
97
+ public function getItemArray(array $itemInfo)
98
+ {
99
+ return $this->removedAlgorithms[$itemInfo['name']];
100
+ }
101
+
102
+
103
+ /**
104
+ * Get the error message template for this sniff.
105
+ *
106
+ * @return string
107
+ */
108
+ protected function getErrorMsgTemplate()
109
+ {
110
+ return 'The %s hash algorithm is ';
111
+ }
112
+
113
+
114
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/RequiredOptionalFunctionParametersSniff.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\RequiredOptionalFunctionParametersSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\AbstractComplexVersionSniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\RequiredOptionalFunctionParametersSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class RequiredOptionalFunctionParametersSniff extends AbstractComplexVersionSniff
22
+ {
23
+
24
+ /**
25
+ * A list of function parameters, which were required in older versions and became optional later on.
26
+ *
27
+ * The array lists : version number with true (required) and false (optional).
28
+ *
29
+ * The index is the location of the parameter in the parameter list, starting at 0 !
30
+ * If's sufficient to list the last version in which the parameter was still required.
31
+ *
32
+ * @var array
33
+ */
34
+ protected $functionParameters = array(
35
+ 'bcscale' => array(
36
+ 0 => array(
37
+ 'name' => 'scale',
38
+ '7.2' => true,
39
+ '7.3' => false,
40
+ ),
41
+ ),
42
+ 'getenv' => array(
43
+ 0 => array(
44
+ 'name' => 'varname',
45
+ '7.0' => true,
46
+ '7.1' => false,
47
+ ),
48
+ ),
49
+ 'preg_match_all' => array(
50
+ 2 => array(
51
+ 'name' => 'matches',
52
+ '5.3' => true,
53
+ '5.4' => false,
54
+ ),
55
+ ),
56
+ 'stream_socket_enable_crypto' => array(
57
+ 2 => array(
58
+ 'name' => 'crypto_type',
59
+ '5.5' => true,
60
+ '5.6' => false,
61
+ ),
62
+ ),
63
+ );
64
+
65
+
66
+ /**
67
+ * Returns an array of tokens this test wants to listen for.
68
+ *
69
+ * @return array
70
+ */
71
+ public function register()
72
+ {
73
+ // Handle case-insensitivity of function names.
74
+ $this->functionParameters = $this->arrayKeysToLowercase($this->functionParameters);
75
+
76
+ return array(T_STRING);
77
+ }//end register()
78
+
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
84
+ * the stack passed in $tokens.
85
+ *
86
+ * @return void
87
+ */
88
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
89
+ {
90
+ $tokens = $phpcsFile->getTokens();
91
+
92
+ $ignore = array(
93
+ T_DOUBLE_COLON,
94
+ T_OBJECT_OPERATOR,
95
+ T_FUNCTION,
96
+ T_CONST,
97
+ );
98
+
99
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
100
+ if (in_array($tokens[$prevToken]['code'], $ignore, true) === true) {
101
+ // Not a call to a PHP function.
102
+ return;
103
+ }
104
+
105
+ $function = $tokens[$stackPtr]['content'];
106
+ $functionLc = strtolower($function);
107
+
108
+ if (isset($this->functionParameters[$functionLc]) === false) {
109
+ return;
110
+ }
111
+
112
+ $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
113
+ $openParenthesis = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
114
+
115
+ // If the parameter count returned > 0, we know there will be valid open parenthesis.
116
+ if ($parameterCount === 0 && $tokens[$openParenthesis]['code'] !== T_OPEN_PARENTHESIS) {
117
+ return;
118
+ }
119
+
120
+ $parameterOffsetFound = $parameterCount - 1;
121
+
122
+ foreach ($this->functionParameters[$functionLc] as $offset => $parameterDetails) {
123
+ if ($offset > $parameterOffsetFound) {
124
+ $itemInfo = array(
125
+ 'name' => $function,
126
+ 'nameLc' => $functionLc,
127
+ 'offset' => $offset,
128
+ );
129
+ $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
130
+ }
131
+ }
132
+
133
+ }//end process()
134
+
135
+
136
+ /**
137
+ * Determine whether an error/warning should be thrown for an item based on collected information.
138
+ *
139
+ * @param array $errorInfo Detail information about an item.
140
+ *
141
+ * @return bool
142
+ */
143
+ protected function shouldThrowError(array $errorInfo)
144
+ {
145
+ return ($errorInfo['requiredVersion'] !== '');
146
+ }
147
+
148
+
149
+ /**
150
+ * Get the relevant sub-array for a specific item from a multi-dimensional array.
151
+ *
152
+ * @param array $itemInfo Base information about the item.
153
+ *
154
+ * @return array Version and other information about the item.
155
+ */
156
+ public function getItemArray(array $itemInfo)
157
+ {
158
+ return $this->functionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
159
+ }
160
+
161
+
162
+ /**
163
+ * Get an array of the non-PHP-version array keys used in a sub-array.
164
+ *
165
+ * @return array
166
+ */
167
+ protected function getNonVersionArrayKeys()
168
+ {
169
+ return array('name');
170
+ }
171
+
172
+
173
+ /**
174
+ * Retrieve the relevant detail (version) information for use in an error message.
175
+ *
176
+ * @param array $itemArray Version and other information about the item.
177
+ * @param array $itemInfo Base information about the item.
178
+ *
179
+ * @return array
180
+ */
181
+ public function getErrorInfo(array $itemArray, array $itemInfo)
182
+ {
183
+ $errorInfo = array(
184
+ 'paramName' => '',
185
+ 'requiredVersion' => '',
186
+ );
187
+
188
+ $versionArray = $this->getVersionArray($itemArray);
189
+
190
+ if (empty($versionArray) === false) {
191
+ foreach ($versionArray as $version => $required) {
192
+ if ($required === true && $this->supportsBelow($version) === true) {
193
+ $errorInfo['requiredVersion'] = $version;
194
+ }
195
+ }
196
+ }
197
+
198
+ $errorInfo['paramName'] = $itemArray['name'];
199
+
200
+ return $errorInfo;
201
+
202
+ }//end getErrorInfo()
203
+
204
+
205
+ /**
206
+ * Get the error message template for this sniff.
207
+ *
208
+ * @return string
209
+ */
210
+ protected function getErrorMsgTemplate()
211
+ {
212
+ return 'The "%s" parameter for function %s() is missing, but was required for PHP version %s and lower';
213
+ }
214
+
215
+
216
+ /**
217
+ * Generates the error or warning for this item.
218
+ *
219
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
220
+ * @param int $stackPtr The position of the relevant token in
221
+ * the stack.
222
+ * @param array $itemInfo Base information about the item.
223
+ * @param array $errorInfo Array with detail (version) information
224
+ * relevant to the item.
225
+ *
226
+ * @return void
227
+ */
228
+ public function addError(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
229
+ {
230
+ $error = $this->getErrorMsgTemplate();
231
+ $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing';
232
+ $data = array(
233
+ $errorInfo['paramName'],
234
+ $itemInfo['name'],
235
+ $errorInfo['requiredVersion'],
236
+ );
237
+
238
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
239
+
240
+ }//end addError()
241
+
242
+
243
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ReservedFunctionNamesSniff.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ReservedFunctionNamesSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\PHPCSHelper;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\ReservedFunctionNamesSniff.
16
+ *
17
+ * All function and method names starting with double underscore are reserved by PHP.
18
+ *
19
+ * {@internal Extends an upstream sniff to benefit from the properties contained therein.
20
+ * The properties are lists of valid PHP magic function and method names, which
21
+ * should be ignored for the purposes of this sniff.
22
+ * As this sniff is not PHP version specific, we don't need access to the utility
23
+ * methods in the PHPCompatibility\Sniff, so extending the upstream sniff is fine.
24
+ * As the upstream sniff checks the same (and more, but we don't need the rest),
25
+ * the logic in this sniff is largely the same as used upstream.
26
+ * Extending the upstream sniff instead of including it via the ruleset, however,
27
+ * prevents hard to debug issues of errors not being reported from the upstream sniff
28
+ * if this library is used in combination with other rulesets.}}
29
+ *
30
+ * @category PHP
31
+ * @package PHPCompatibility
32
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
33
+ */
34
+ class ReservedFunctionNamesSniff extends \Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff
35
+ {
36
+
37
+ /**
38
+ * Overload the constructor to work round various PHPCS cross-version compatibility issues.
39
+ */
40
+ public function __construct()
41
+ {
42
+ $scopeTokens = array(T_CLASS, T_INTERFACE);
43
+ if (defined('T_TRAIT')) {
44
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_traitFound
45
+ $scopeTokens[] = T_TRAIT;
46
+ }
47
+ if (defined('T_ANON_CLASS')) {
48
+ // phpcs:ignore PHPCompatibility.PHP.NewConstants.t_anon_classFound
49
+ $scopeTokens[] = T_ANON_CLASS;
50
+ }
51
+
52
+ // Call the grand-parent constructor directly.
53
+ \PHP_CodeSniffer_Standards_AbstractScopeSniff::__construct($scopeTokens, array(T_FUNCTION), true);
54
+
55
+ $phpcsVersion = PHPCSHelper::getVersion();
56
+
57
+ if (version_compare($phpcsVersion, '2.0.0', '<') === true) {
58
+ $this->magicMethods = array_flip($this->magicMethods);
59
+ $this->methodsDoubleUnderscore = array_flip($this->methodsDoubleUnderscore);
60
+ $this->magicFunctions = array_flip($this->magicFunctions);
61
+ }
62
+
63
+ // Make sure debuginfo is included in the array. Upstream only includes it since 2.5.1.
64
+ $this->magicMethods['debuginfo'] = true;
65
+ }
66
+
67
+
68
+ /**
69
+ * Processes the tokens within the scope.
70
+ *
71
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
72
+ * @param int $stackPtr The position where this token was
73
+ * found.
74
+ * @param int $currScope The position of the current scope.
75
+ *
76
+ * @return void
77
+ */
78
+ protected function processTokenWithinScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $currScope)
79
+ {
80
+ $tokens = $phpcsFile->getTokens();
81
+
82
+ $methodName = $phpcsFile->getDeclarationName($stackPtr);
83
+ if ($methodName === null) {
84
+ // Ignore closures.
85
+ return;
86
+ }
87
+
88
+ // Is this a magic method. i.e., is prefixed with "__" ?
89
+ if (preg_match('|^__[^_]|', $methodName) > 0) {
90
+ $magicPart = strtolower(substr($methodName, 2));
91
+ if (isset($this->magicMethods[$magicPart]) === false
92
+ && isset($this->methodsDoubleUnderscore[$magicPart]) === false
93
+ ) {
94
+ $className = '[anonymous class]';
95
+ if (defined('T_ANON_CLASS') === false || $tokens[$currScope]['type'] !== 'T_ANON_CLASS') {
96
+ $className = $phpcsFile->getDeclarationName($currScope);
97
+ }
98
+
99
+ $phpcsFile->addWarning(
100
+ 'Method name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.',
101
+ $stackPtr,
102
+ 'MethodDoubleUnderscore',
103
+ array($className . '::' . $methodName)
104
+ );
105
+ }
106
+ }
107
+ }
108
+
109
+
110
+ /**
111
+ * Processes the tokens outside the scope.
112
+ *
113
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being processed.
114
+ * @param int $stackPtr The position where this token was
115
+ * found.
116
+ *
117
+ * @return void
118
+ */
119
+ protected function processTokenOutsideScope(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
120
+ {
121
+ $functionName = $phpcsFile->getDeclarationName($stackPtr);
122
+ if ($functionName === null) {
123
+ // Ignore closures.
124
+ return;
125
+ }
126
+
127
+ // Is this a magic function. i.e., it is prefixed with "__".
128
+ if (preg_match('|^__[^_]|', $functionName) > 0) {
129
+ $magicPart = strtolower(substr($functionName, 2));
130
+ if (isset($this->magicFunctions[$magicPart]) === false) {
131
+ $phpcsFile->addWarning(
132
+ 'Function name "%s" is discouraged; PHP has reserved all method names with a double underscore prefix for future use.',
133
+ $stackPtr,
134
+ 'FunctionDoubleUnderscore',
135
+ array($functionName)
136
+ );
137
+ }
138
+ }
139
+ }
140
+
141
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ShortArraySniff.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ShortArray.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\ShortArray.
18
+ *
19
+ * Short array syntax is available since PHP 5.4
20
+ *
21
+ * PHP version 5.4
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Alex Miroshnikov <unknown@example.com>
26
+ */
27
+ class ShortArraySniff extends Sniff
28
+ {
29
+
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_OPEN_SHORT_ARRAY,
39
+ T_CLOSE_SHORT_ARRAY,
40
+ );
41
+ }//end register()
42
+
43
+
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.
50
+ *
51
+ * @return void
52
+ */
53
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
54
+ {
55
+ if ($this->supportsBelow('5.3') === false) {
56
+ return;
57
+ }
58
+
59
+ $tokens = $phpcsFile->getTokens();
60
+ $token = $tokens[$stackPtr];
61
+
62
+ $error = '%s is available since 5.4';
63
+ $data = array();
64
+
65
+ if ($token['type'] === 'T_OPEN_SHORT_ARRAY') {
66
+ $data[] = 'Short array syntax (open)';
67
+ } elseif ($token['type'] === 'T_CLOSE_SHORT_ARRAY') {
68
+ $data[] = 'Short array syntax (close)';
69
+ }
70
+
71
+ $phpcsFile->addError($error, $stackPtr, 'Found', $data);
72
+
73
+ }//end process()
74
+
75
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/TernaryOperatorsSniff.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\TernaryOperatorsSniff.
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\PHP;
14
+
15
+ use PHPCompatibility\Sniff;
16
+
17
+ /**
18
+ * \PHPCompatibility\Sniffs\PHP\TernaryOperatorsSniff.
19
+ *
20
+ * Performs checks on ternary operators, specifically that the middle expression
21
+ * is not omitted for versions that don't support this.
22
+ *
23
+ * PHP version 5.3
24
+ *
25
+ * @category PHP
26
+ * @package PHPCompatibility
27
+ * @author Ben Selby <bselby@plus.net>
28
+ * @copyright 2012 Ben Selby
29
+ */
30
+ class TernaryOperatorsSniff extends Sniff
31
+ {
32
+
33
+ /**
34
+ * Returns an array of tokens this test wants to listen for.
35
+ *
36
+ * @return array
37
+ */
38
+ public function register()
39
+ {
40
+ return array(T_INLINE_THEN);
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.
49
+ *
50
+ * @return void
51
+ */
52
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
+ {
54
+ if ($this->supportsBelow('5.2') === false) {
55
+ return;
56
+ }
57
+
58
+ $tokens = $phpcsFile->getTokens();
59
+
60
+ // Get next non-whitespace token, and check it isn't the related inline else
61
+ // symbol, which is not allowed prior to PHP 5.3.
62
+ $next = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true);
63
+
64
+ if ($next !== false && $tokens[$next]['code'] === T_INLINE_ELSE) {
65
+ $phpcsFile->addError(
66
+ 'Middle may not be omitted from ternary operators in PHP < 5.3',
67
+ $stackPtr,
68
+ 'MiddleMissing'
69
+ );
70
+ }
71
+ }
72
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/ValidIntegersSniff.php ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\ValidIntegersSniff.
4
+ *
5
+ * @category PHP
6
+ * @package PHPCompatibility
7
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
8
+ */
9
+
10
+ namespace PHPCompatibility\Sniffs\PHP;
11
+
12
+ use PHPCompatibility\Sniff;
13
+
14
+ /**
15
+ * \PHPCompatibility\Sniffs\PHP\ValidIntegersSniff.
16
+ *
17
+ * @category PHP
18
+ * @package PHPCompatibility
19
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
20
+ */
21
+ class ValidIntegersSniff extends Sniff
22
+ {
23
+
24
+ /**
25
+ * Whether PHPCS is run on a PHP < 5.4.
26
+ *
27
+ * @var bool
28
+ */
29
+ protected $isLowPHPVersion = false;
30
+
31
+ /**
32
+ * Returns an array of tokens this test wants to listen for.
33
+ *
34
+ * @return array
35
+ */
36
+ public function register()
37
+ {
38
+ $this->isLowPHPVersion = version_compare(PHP_VERSION_ID, '50400', '<');
39
+
40
+ return array(
41
+ T_LNUMBER, // Binary, octal integers.
42
+ T_CONSTANT_ENCAPSED_STRING, // Hex numeric string.
43
+ );
44
+
45
+ }//end register()
46
+
47
+
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.
54
+ *
55
+ * @return void
56
+ */
57
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
58
+ {
59
+ $tokens = $phpcsFile->getTokens();
60
+ $token = $tokens[$stackPtr];
61
+
62
+ if ($this->couldBeBinaryInteger($tokens, $stackPtr) === true) {
63
+ if ($this->supportsBelow('5.3')) {
64
+ $error = 'Binary integer literals were not present in PHP version 5.3 or earlier. Found: %s';
65
+ if ($this->isLowPHPVersion === false) {
66
+ $data = array($token['content']);
67
+ } else {
68
+ $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
69
+ }
70
+ $phpcsFile->addError($error, $stackPtr, 'BinaryIntegerFound', $data);
71
+ }
72
+
73
+ if ($this->isInvalidBinaryInteger($tokens, $stackPtr) === true) {
74
+ $error = 'Invalid binary integer detected. Found: %s';
75
+ $data = array($this->getBinaryInteger($phpcsFile, $tokens, $stackPtr));
76
+ $phpcsFile->addWarning($error, $stackPtr, 'InvalidBinaryIntegerFound', $data);
77
+ }
78
+ return;
79
+ }
80
+
81
+ $isError = $this->supportsAbove('7.0');
82
+ $data = array( $token['content'] );
83
+
84
+ if ($this->isInvalidOctalInteger($tokens, $stackPtr) === true) {
85
+ $this->addMessage(
86
+ $phpcsFile,
87
+ 'Invalid octal integer detected. Prior to PHP 7 this would lead to a truncated number. From PHP 7 onwards this causes a parse error. Found: %s',
88
+ $stackPtr,
89
+ $isError,
90
+ 'InvalidOctalIntegerFound',
91
+ $data
92
+ );
93
+ return;
94
+ }
95
+
96
+ if ($this->isHexidecimalNumericString($tokens, $stackPtr) === true) {
97
+ $this->addMessage(
98
+ $phpcsFile,
99
+ 'The behaviour of hexadecimal numeric strings was inconsistent prior to PHP 7 and support has been removed in PHP 7. Found: %s',
100
+ $stackPtr,
101
+ $isError,
102
+ 'HexNumericStringFound',
103
+ $data
104
+ );
105
+ return;
106
+ }
107
+
108
+ }//end process()
109
+
110
+
111
+ /**
112
+ * Could the current token an potentially be a binary integer ?
113
+ *
114
+ * @param array $tokens Token stack.
115
+ * @param int $stackPtr The current position in the token stack.
116
+ *
117
+ * @return bool
118
+ */
119
+ private function couldBeBinaryInteger($tokens, $stackPtr)
120
+ {
121
+ $token = $tokens[$stackPtr];
122
+
123
+ if ($token['code'] !== T_LNUMBER) {
124
+ return false;
125
+ }
126
+
127
+ if ($this->isLowPHPVersion === false) {
128
+ return (preg_match('`^0b[0-1]+$`D', $token['content']) === 1);
129
+ }
130
+ // Pre-5.4, binary strings are tokenized as T_LNUMBER (0) + T_STRING ("b01010101").
131
+ // At this point, we don't yet care whether it's a valid binary int, that's a separate check.
132
+ else {
133
+ return($token['content'] === '0' && $tokens[$stackPtr + 1]['code'] === T_STRING && preg_match('`^b[0-9]+$`D', $tokens[$stackPtr + 1]['content']) === 1);
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Is the current token an invalid binary integer ?
139
+ *
140
+ * @param array $tokens Token stack.
141
+ * @param int $stackPtr The current position in the token stack.
142
+ *
143
+ * @return bool
144
+ */
145
+ private function isInvalidBinaryInteger($tokens, $stackPtr)
146
+ {
147
+ if ($this->couldBeBinaryInteger($tokens, $stackPtr) === false) {
148
+ return false;
149
+ }
150
+
151
+ if ($this->isLowPHPVersion === false) {
152
+ // If it's an invalid binary int, the token will be split into two T_LNUMBER tokens.
153
+ return ($tokens[$stackPtr + 1]['code'] === T_LNUMBER);
154
+ } else {
155
+ return (preg_match('`^b[0-1]+$`D', $tokens[$stackPtr + 1]['content']) === 0);
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Retrieve the content of the tokens which together look like a binary integer.
161
+ *
162
+ * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
163
+ * @param array $tokens Token stack.
164
+ * @param int $stackPtr The position of the current token in
165
+ * the stack.
166
+ *
167
+ * @return string
168
+ */
169
+ private function getBinaryInteger(\PHP_CodeSniffer_File $phpcsFile, $tokens, $stackPtr)
170
+ {
171
+ $length = 2; // PHP < 5.4 T_LNUMBER + T_STRING.
172
+
173
+ if ($this->isLowPHPVersion === false) {
174
+ $i = $stackPtr;
175
+ while ($tokens[$i]['code'] === T_LNUMBER) {
176
+ $i++;
177
+ }
178
+ $length = ($i - $stackPtr);
179
+ }
180
+
181
+ return $phpcsFile->getTokensAsString($stackPtr, $length);
182
+ }
183
+
184
+ /**
185
+ * Is the current token an invalid octal integer ?
186
+ *
187
+ * @param array $tokens Token stack.
188
+ * @param int $stackPtr The current position in the token stack.
189
+ *
190
+ * @return bool
191
+ */
192
+ private function isInvalidOctalInteger($tokens, $stackPtr)
193
+ {
194
+ $token = $tokens[$stackPtr];
195
+
196
+ if ($token['code'] === T_LNUMBER && preg_match('`^0[0-7]*[8-9]+[0-9]*$`D', $token['content']) === 1) {
197
+ return true;
198
+ }
199
+
200
+ return false;
201
+ }
202
+
203
+ /**
204
+ * Is the current token a hexidecimal numeric string ?
205
+ *
206
+ * @param array $tokens Token stack.
207
+ * @param int $stackPtr The current position in the token stack.
208
+ *
209
+ * @return bool
210
+ */
211
+ private function isHexidecimalNumericString($tokens, $stackPtr)
212
+ {
213
+ $token = $tokens[$stackPtr];
214
+
215
+ if ($token['code'] === T_CONSTANT_ENCAPSED_STRING && preg_match('`^0x[a-f0-9]+$`iD', $this->stripQuotes($token['content'])) === 1) {
216
+ return true;
217
+ }
218
+
219
+ return false;
220
+ }
221
+
222
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/PHP/VariableVariablesSniff.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * \PHPCompatibility\Sniffs\PHP\VariableVariables.
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\PHP;
13
+
14
+ use PHPCompatibility\Sniff;
15
+
16
+ /**
17
+ * \PHPCompatibility\Sniffs\PHP\VariableVariables.
18
+ *
19
+ * The interpretation of variable variables has changed in PHP 7.0.
20
+ *
21
+ * PHP version 7.0
22
+ *
23
+ * @category PHP
24
+ * @package PHPCompatibility
25
+ * @author Juliette Reinders Folmer <phpcompatibility_nospam@adviesenzo.nl>
26
+ */
27
+ class VariableVariablesSniff 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()
35
+ {
36
+ return array(T_VARIABLE);
37
+
38
+ }//end register()
39
+
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.
46
+ *
47
+ * @return void
48
+ */
49
+ public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
50
+ {
51
+ if ($this->supportsAbove('7.0') === false) {
52
+ return;
53
+ }
54
+
55
+ $tokens = $phpcsFile->getTokens();
56
+
57
+ // Verify that the next token is a square open bracket. If not, bow out.
58
+ $nextToken = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true);
59
+
60
+ if ($nextToken === false || $tokens[$nextToken]['code'] !== T_OPEN_SQUARE_BRACKET || isset($tokens[$nextToken]['bracket_closer']) === false) {
61
+ return;
62
+ }
63
+
64
+ // The previous non-empty token has to be a $, -> or ::.
65
+ $prevToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true);
66
+ if ($prevToken === false || in_array($tokens[$prevToken]['code'], array(T_DOLLAR, T_OBJECT_OPERATOR, T_DOUBLE_COLON), true) === false) {
67
+ return;
68
+ }
69
+
70
+ // For static object calls, it only applies when this is a function call.
71
+ if ($tokens[$prevToken]['code'] === T_DOUBLE_COLON) {
72
+ $hasBrackets = $tokens[$nextToken]['bracket_closer'];
73
+ while (($hasBrackets = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, ($hasBrackets + 1), null, true, null, true)) !== false) {
74
+ if ($tokens[$hasBrackets]['code'] === T_OPEN_SQUARE_BRACKET) {
75
+ if (isset($tokens[$hasBrackets]['bracket_closer'])) {
76
+ $hasBrackets = $tokens[$hasBrackets]['bracket_closer'];
77
+ continue;
78
+ } else {
79
+ // Live coding.
80
+ return;
81
+ }
82
+
83
+ } elseif ($tokens[$hasBrackets]['code'] === T_OPEN_PARENTHESIS) {
84
+ // Caught!
85
+ break;
86
+
87
+ } else {
88
+ // Not a function call, so bow out.
89
+ return;
90
+ }
91
+ }
92
+
93
+ // Now let's also prevent false positives when used with self and static which still work fine.
94
+ $classToken = $phpcsFile->findPrevious(\PHP_CodeSniffer_Tokens::$emptyTokens, ($prevToken - 1), null, true, null, true);
95
+ if ($classToken !== false) {
96
+ if ($tokens[$classToken]['code'] === T_STATIC || $tokens[$classToken]['code'] === T_SELF) {
97
+ return;
98
+ } elseif ($tokens[$classToken]['code'] === T_STRING && $tokens[$classToken]['content'] === 'self') {
99
+ return;
100
+ }
101
+ }
102
+ }
103
+
104
+ $phpcsFile->addError(
105
+ 'Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.',
106
+ $stackPtr,
107
+ 'Found'
108
+ );
109
+
110
+ }//end process()
111
+
112
+
113
+ }//end class
vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/Upgrade/LowPHPCSSniff.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
25
+ * notices and warnings (or even fatal out).
26
+ *
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
+ {
36
+ /**
37
+ * The minimum supported PHPCS version.
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.
56
+ *
57
+ * This will be set to `false` when either a high enough PHPCS
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;
64
+
65
+
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) {
91
+ return ($phpcsFile->numTokens + 1);
92
+ }
93
+
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
+ }
123
+
124
+ /*
125
+ * Figure out the report width to determine how long the delimiter lines should be.
126
+ *
127
+ * This is not an exact calculation as there are a number of unknowns at the time the
128
+ * notice is thrown (whether there are other notices for the file, whether those are
129
+ * warnings or errors, whether there are auto-fixable issues etc).
130
+ *
131
+ * In other words, this is just an approximation to get a reasonably stable and
132
+ * readable message layout format.
133
+ *
134
+ * {@internal
135
+ * PHPCS has had some changes as to how the messages display over the years.
136
+ * Most significantly in 2.4.0 it was attempted to solve an issue with messages
137
+ * containing new lines. Unfortunately, that solution is buggy.
138
+ * An improved version has been pulled upstream and will hopefully make it
139
+ * into PHPCS 3.3.1/3.4.0.
140
+ *
141
+ * Anyway, this means that instead of new lines, delimiter lines will be used to improved
142
+ * the readability of the (long) message.
143
+ *
144
+ * Also, as of PHPCS 2.2.0, the report width when using the `-s` option is 8 wider than
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
+
156
+ $messageWidth = ($reportWidth - 15); // 15 is length of " # | WARNING | ".
157
+ $delimiterLine = str_repeat('-', ($messageWidth));
158
+ $disableNotice = 'To disable this notice, add --exclude=PHPCompatibility.Upgrade.LowPHPCS to your command or add <exclude name="PHPCompatibility.Upgrade.LowPHPCS.%s"/> to your custom ruleset. ';
159
+ $thankYou = 'Thank you for using PHPCompatibility!';
160
+
161
+ $message .= ' ' . $delimiterLine;
162
+ $message .= ' ' . $disableNotice;
163
+ $message .= ' ' . $delimiterLine;
164
+ $message .= ' ' . $thankYou;
165
+
166
+ $this->addMessage($phpcsFile, $message, 0, $isError, $errorCode, $replacements);
167
+
168
+ $this->examine = false;
169
+ }
170
+ }
vendor/phpcompatibility/php-compatibility/PHPCompatibility/ruleset.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="PHPCompatibility">
3
+ <description>Coding Standard that checks for PHP version compatibility.</description>
4
+
5
+ <autoload>./../PHPCSAliases.php</autoload>
6
+
7
+ </ruleset>
vendor/phpcompatibility/php-compatibility/README.md ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PHP Compatibility Coding Standard for PHP CodeSniffer
2
+ =====================================================
3
+ [![Latest Stable Version](https://poser.pugx.org/phpcompatibility/php-compatibility/v/stable.png)](https://packagist.org/packages/phpcompatibility/php-compatibility)
4
+ [![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/php-compatibility/v/unstable.png)](https://packagist.org/packages/phpcompatibility/php-compatibility)
5
+ ![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg)
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)
61
+ -------------------------------------------
62
+
63
+ * Add the following lines to the `require-dev` section of your `composer.json` file.
64
+ ```json
65
+ "require-dev": {
66
+ "phpcompatibility/php-compatibility": "*"
67
+ },
68
+ "prefer-stable" : true
69
+ ```
70
+ * Next, PHP CodeSniffer has to be informed of the location of the standard.
71
+ - If PHPCompatibility is the **_only_** external PHP CodeSniffer standard you use, you can add the following to your `composer.json` file to automatically run the necessary command:
72
+ ```json
73
+ "scripts": {
74
+ "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
75
+ "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
76
+ }
77
+ ```
78
+ - Alternatively - and **_strongly recommended_** if you use more than one external PHP CodeSniffer standard - you can use any of the following Composer plugins to handle this for you.
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:
86
+ ```xml
87
+ <config name="installed_paths" value="vendor/phpcompatibility/php-compatibility" />
88
+ ```
89
+ * Run `composer update --lock` to install both PHP CodeSniffer, the PHPCompatibility coding standard and - optionally - the Composer plugin.
90
+ * Verify that the PHPCompatibility standard is registered correctly by running `./vendor/bin/phpcs -i` on the command line. PHPCompatibility should be listed as one of the available standards.
91
+ * Now you can use the following command to inspect your code:
92
+ ```bash
93
+ ./vendor/bin/phpcs -p . --standard=PHPCompatibility
94
+ ```
95
+
96
+ Installation via a git check-out to an arbitrary directory (method 2)
97
+ -----------------------
98
+
99
+ * Install [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) via [your preferred method](https://github.com/squizlabs/PHP_CodeSniffer#installation).
100
+
101
+ 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.
102
+
103
+ **Pro-tip:** Register the path to PHPCS in your system `$PATH` environment variable to make the `phpcs` command available from anywhere in your file system.
104
+ * Download the [latest PHPCompatibility release](https://github.com/PHPCompatibility/PHPCompatibility/releases) and unzip/untar it into an arbitrary directory.
105
+
106
+ You can also choose to clone the repository using git to easily update your install regularly.
107
+ * Add the path to the directory in which you placed your copy of the PHPCompatibility repo to the PHP CodeSniffer configuration using the below command from the command line:
108
+ ```bash
109
+ phpcs --config-set installed_paths /path/to/PHPCompatibility
110
+ ```
111
+ I.e. if you placed the `PHPCompatibility` repository in the `/my/custom/standards/PHPCompatibility` directory, you will need to add that directory to the PHP CodeSniffer [`installed_paths` configuration variable](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-installed-standard-paths).
112
+
113
+ **Warning**: :warning: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by comma's, i.e.:
114
+ ```bash
115
+ phpcs --config-set installed_paths /path/1,/path/2,/path/3
116
+ ```
117
+
118
+ **Pro-tip:** Alternatively, 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(s) by adding the following snippet to your custom ruleset:
119
+ ```xml
120
+ <config name="installed_paths" value="/path/to/PHPCompatibility" />
121
+ ```
122
+ * 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.
123
+ * Now you can use the following command to inspect your code:
124
+ ```bash
125
+ phpcs -p . --standard=PHPCompatibility
126
+ ```
127
+
128
+ Sniffing your code for compatibility with specific PHP version(s)
129
+ ------------------------------
130
+ * Run the coding standard from the command-line with `phpcs -p . --standard=PHPCompatibility`.
131
+ * By default, you will only receive notifications about deprecated and/or removed PHP features.
132
+ * To get the most out of the PHPCompatibility 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.
133
+ - You can run the checks for just one specific PHP version by adding `--runtime-set testVersion 5.5` to your command line command.
134
+ - You can also specify a range of PHP versions that your code needs to support. In this situation, compatibility issues that affect any of the PHP versions in that range will be reported: `--runtime-set testVersion 5.3-5.5`.
135
+ - As of PHPCompatibility 7.1.3, you can omit one part of the range if you want to support everything above or below a particular version, i.e. use `--runtime-set testVersion 7.0-` to run all the checks for PHP 7.0 and above.
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
156
+ ------------------------------
157
+ Like with any PHP CodeSniffer standard, you can add PHPCompatibility to a custom PHP CodeSniffer ruleset.
158
+
159
+ ```xml
160
+ <?xml version="1.0"?>
161
+ <ruleset name="Custom ruleset">
162
+ <description>My rules for PHP CodeSniffer</description>
163
+
164
+ <!-- Run against the PHPCompatibility ruleset -->
165
+ <rule ref="PHPCompatibility"/>
166
+
167
+ <!-- Run against a second ruleset -->
168
+ <rule ref="PSR2"/>
169
+
170
+ </ruleset>
171
+ ```
172
+
173
+ You can also set the `testVersion` from within the ruleset:
174
+ ```xml
175
+ <!-- Check for cross-version support for PHP 5.6 and higher. -->
176
+ <config name="testVersion" value="5.6-"/>
177
+ ```
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>
203
+ </rule>
204
+ ```
205
+
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
+ -------
212
+ This code is released under the GNU Lesser General Public License (LGPL). For more information, visit http://www.gnu.org/copyleft/lesser.html
vendor/phpcompatibility/php-compatibility/composer.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name" : "phpcompatibility/php-compatibility",
3
+ "description" : "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility.",
4
+ "type" : "phpcodesniffer-standard",
5
+ "keywords" : [ "compatibility", "phpcs", "standards" ],
6
+ "homepage" : "http://techblog.wimgodden.be/tag/codesniffer/",
7
+ "license" : "LGPL-3.0-or-later",
8
+ "authors" : [ {
9
+ "name" : "Wim Godden",
10
+ "role" : "lead"
11
+ } ],
12
+ "support" : {
13
+ "issues" : "https://github.com/PHPCompatibility/PHPCompatibility/issues",
14
+ "source" : "https://github.com/PHPCompatibility/PHPCompatibility"
15
+ },
16
+ "require" : {
17
+ "php" : ">=5.3",
18
+ "squizlabs/php_codesniffer" : "^2.3 || ^3.0.2"
19
+ },
20
+ "require-dev" : {
21
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
22
+ },
23
+ "conflict": {
24
+ "squizlabs/php_codesniffer": "2.6.2"
25
+ },
26
+ "suggest" : {
27
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
28
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
29
+ },
30
+ "autoload" : {
31
+ "psr-4" : {
32
+ "PHPCompatibility\\" : "PHPCompatibility/"
33
+ }
34
+ },
35
+ "scripts" : {
36
+ "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..",
37
+ "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.."
38
+ }
39
+ }
vendor/phpcompatibility/phpcompatibility-wp/LICENSE ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP/ruleset.xml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="PHPCompatibilityWP">
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"/>
51
+ </properties>
52
+ </rule>
53
+
54
+ </ruleset>
vendor/phpcompatibility/phpcompatibility-wp/README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
17
+
18
+ ## Requirements
19
+
20
+ * [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
21
+ * PHP 5.3+ for use with [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) 2.3.0+.
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
+
45
+ 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
71
+
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
92
+
93
+
94
+ ## Changelog
95
+
96
+ ### 1.0.0 - 2018-07-17
97
+
98
+ Initial release of the PHPCompatibilityWP ruleset.
vendor/phpcompatibility/phpcompatibility-wp/composer.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name" : "phpcompatibility/phpcompatibility-wp",
3
+ "description" : "A set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility for WordPress projects.",
4
+ "type" : "phpcodesniffer-standard",
5
+ "keywords" : [ "compatibility", "phpcs", "standards", "wordpress" ],
6
+ "homepage" : "http://phpcompatibility.com/",
7
+ "license" : "LGPL-3.0-or-later",
8
+ "authors" : [ {
9
+ "name" : "Wim Godden",
10
+ "role" : "lead"
11
+ },
12
+ {
13
+ "name" : "Juliette Reinders Folmer",
14
+ "role" : "lead"
15
+ } ],
16
+ "support" : {
17
+ "issues" : "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
18
+ "source" : "https://github.com/PHPCompatibility/PHPCompatibilityWP"
19
+ },
20
+ "require" : {
21
+ "phpcompatibility/php-compatibility" : "^8.1"
22
+ },
23
+ "suggest" : {
24
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
25
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
26
+ },
27
+ "prefer-stable" : true
28
+ }
vendor/squizlabs/php_codesniffer/.gitattributes ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /tests export-ignore
2
+ /CodeSniffer/Standards/Generic/Tests export-ignore
3
+ /CodeSniffer/Standards/MySource/Tests export-ignore
4
+ /CodeSniffer/Standards/PEAR/Tests export-ignore
5
+ /CodeSniffer/Standards/PSR1/Tests export-ignore
6
+ /CodeSniffer/Standards/PSR2/Tests export-ignore
7
+ /CodeSniffer/Standards/Squiz/Tests export-ignore
8
+ /CodeSniffer/Standards/Zend/Tests export-ignore
9
+ .travis.yml export-ignore
10
+ package.xml export-ignore
11
+ phpunit.xml.dist export-ignore
12
+ php5-testingConfig.ini export-ignore
13
+ php7-testingConfig.ini export-ignore
vendor/squizlabs/php_codesniffer/.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /CodeSniffer.conf
2
+ /phpcs.xml
3
+ /phpunit.xml
4
+ .idea/*
5
+ /vendor/
6
+ composer.lock
vendor/squizlabs/php_codesniffer/CodeSniffer.conf CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
  $phpCodeSnifferConfig = array (
3
- 'installed_paths' => '../../wimg/php-compatibility',
4
  )
5
  ?>
1
  <?php
2
  $phpCodeSnifferConfig = array (
3
+ 'installed_paths' => '../../phpcompatibility/php-compatibility/,../../phpcompatibility/phpcompatibility-wp/',
4
  )
5
  ?>
vendor/squizlabs/php_codesniffer/composer.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "squizlabs/php_codesniffer",
3
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
4
+ "type": "library",
5
+ "keywords": [
6
+ "phpcs",
7
+ "standards"
8
+ ],
9
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
10
+ "license": "BSD-3-Clause",
11
+ "authors": [
12
+ {
13
+ "name": "Greg Sherwood",
14
+ "role": "lead"
15
+ }
16
+ ],
17
+ "support": {
18
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
19
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
20
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer"
21
+ },
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "2.x-dev"
25
+ }
26
+ },
27
+ "autoload": {
28
+ "classmap": [
29
+ "CodeSniffer.php",
30
+ "CodeSniffer/CLI.php",
31
+ "CodeSniffer/Exception.php",
32
+ "CodeSniffer/File.php",
33
+ "CodeSniffer/Fixer.php",
34
+ "CodeSniffer/Report.php",
35
+ "CodeSniffer/Reporting.php",
36
+ "CodeSniffer/Sniff.php",
37
+ "CodeSniffer/Tokens.php",
38
+ "CodeSniffer/Reports/",
39
+ "CodeSniffer/Tokenizers/",
40
+ "CodeSniffer/DocGenerators/",
41
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
42
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
43
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
44
+ "CodeSniffer/Standards/IncorrectPatternException.php",
45
+ "CodeSniffer/Standards/Generic/Sniffs/",
46
+ "CodeSniffer/Standards/MySource/Sniffs/",
47
+ "CodeSniffer/Standards/PEAR/Sniffs/",
48
+ "CodeSniffer/Standards/PSR1/Sniffs/",
49
+ "CodeSniffer/Standards/PSR2/Sniffs/",
50
+ "CodeSniffer/Standards/Squiz/Sniffs/",
51
+ "CodeSniffer/Standards/Zend/Sniffs/"
52
+ ]
53
+ },
54
+ "require": {
55
+ "php": ">=5.1.2",
56
+ "ext-tokenizer": "*",
57
+ "ext-xmlwriter": "*",
58
+ "ext-simplexml": "*"
59
+ },
60
+ "require-dev": {
61
+ "phpunit/phpunit": "~4.0"
62
+ },
63
+ "bin": [
64
+ "scripts/phpcs",
65
+ "scripts/phpcbf"
66
+ ]
67
+ }
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.4.5
14
  * Author URI: https://wpengine.com
15
  * Text Domain: php-compatibility-checker
16
  */
@@ -261,6 +261,19 @@ class WPEngine_PHPCompat {
261
 
262
  // Build our URL.
263
  $url = add_query_arg( $query, admin_url( 'admin-ajax.php' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  // POST.
265
  wp_remote_post( esc_url_raw( $url ), $args );
266
  }
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.4.6
14
  * Author URI: https://wpengine.com
15
  * Text Domain: php-compatibility-checker
16
  */
261
 
262
  // Build our URL.
263
  $url = add_query_arg( $query, admin_url( 'admin-ajax.php' ) );
264
+
265
+ /**
266
+ * Modify the URL used to fork a request.
267
+ *
268
+ * When running in a Docker container the url used to access the site internally
269
+ * can be different from the external url. For example internally the port
270
+ * is 80, and externally it's 8081.
271
+ *
272
+ * @since 1.4.6
273
+ *
274
+ * @param string $url The url used to make the fork request.
275
+ */
276
+ $url = apply_filters( 'phpcompat_fork_url', $url );
277
  // POST.
278
  wp_remote_post( esc_url_raw( $url ), $args );
279
  }