Completed
Pull Request — develop (#1492)
by Zack
28:58 queued 09:00
created
Sniffs/FunctionUse/ArgumentFunctionsReportCurrentValueSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @since 9.1.0
29 29
  */
30
-class ArgumentFunctionsReportCurrentValueSniff extends Sniff
31
-{
30
+class ArgumentFunctionsReportCurrentValueSniff extends Sniff {
32 31
 
33 32
     /**
34 33
      * A list of functions that, when called, can behave differently in PHP 7
@@ -100,8 +99,7 @@  discard block
 block discarded – undo
100 99
      *
101 100
      * @return array
102 101
      */
103
-    public function register()
104
-    {
102
+    public function register() {
105 103
         return array(
106 104
             \T_FUNCTION,
107 105
             \T_CLOSURE,
@@ -117,8 +115,7 @@  discard block
 block discarded – undo
117 115
      *
118 116
      * @return void
119 117
      */
120
-    public function process(File $phpcsFile, $stackPtr)
121
-    {
118
+    public function process(File $phpcsFile, $stackPtr) {
122 119
         if ($this->supportsAbove('7.0') === false) {
123 120
             return;
124 121
         }
Please login to merge, or discard this patch.
Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package  PHPCompatibility
21 21
  * @author   Juliette Reinders Folmer <[email protected]>
22 22
  */
23
-class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff
24
-{
23
+class RequiredToOptionalFunctionParametersSniff extends AbstractComplexVersionSniff {
25 24
 
26 25
     /**
27 26
      * A list of function parameters, which were required in older versions and became optional later on.
@@ -154,8 +153,7 @@  discard block
 block discarded – undo
154 153
      *
155 154
      * @return array
156 155
      */
157
-    public function register()
158
-    {
156
+    public function register() {
159 157
         // Handle case-insensitivity of function names.
160 158
         $this->functionParameters = $this->arrayKeysToLowercase($this->functionParameters);
161 159
 
@@ -171,8 +169,7 @@  discard block
 block discarded – undo
171 169
      *
172 170
      * @return void
173 171
      */
174
-    public function process(File $phpcsFile, $stackPtr)
175
-    {
172
+    public function process(File $phpcsFile, $stackPtr) {
176 173
         $tokens = $phpcsFile->getTokens();
177 174
 
178 175
         $ignore = array(
@@ -225,8 +222,7 @@  discard block
 block discarded – undo
225 222
      *
226 223
      * @return bool
227 224
      */
228
-    protected function shouldThrowError(array $errorInfo)
229
-    {
225
+    protected function shouldThrowError(array $errorInfo) {
230 226
         return ($errorInfo['requiredVersion'] !== '');
231 227
     }
232 228
 
@@ -238,8 +234,7 @@  discard block
 block discarded – undo
238 234
      *
239 235
      * @return array Version and other information about the item.
240 236
      */
241
-    public function getItemArray(array $itemInfo)
242
-    {
237
+    public function getItemArray(array $itemInfo) {
243 238
         return $this->functionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
244 239
     }
245 240
 
@@ -249,8 +244,7 @@  discard block
 block discarded – undo
249 244
      *
250 245
      * @return array
251 246
      */
252
-    protected function getNonVersionArrayKeys()
253
-    {
247
+    protected function getNonVersionArrayKeys() {
254 248
         return array('name');
255 249
     }
256 250
 
@@ -263,8 +257,7 @@  discard block
 block discarded – undo
263 257
      *
264 258
      * @return array
265 259
      */
266
-    public function getErrorInfo(array $itemArray, array $itemInfo)
267
-    {
260
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
268 261
         $errorInfo = array(
269 262
             'paramName'       => '',
270 263
             'requiredVersion' => '',
@@ -291,8 +284,7 @@  discard block
 block discarded – undo
291 284
      *
292 285
      * @return string
293 286
      */
294
-    protected function getErrorMsgTemplate()
295
-    {
287
+    protected function getErrorMsgTemplate() {
296 288
         return 'The "%s" parameter for function %s() is missing, but was required for PHP version %s and lower';
297 289
     }
298 290
 
@@ -309,8 +301,7 @@  discard block
 block discarded – undo
309 301
      *
310 302
      * @return void
311 303
      */
312
-    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
313
-    {
304
+    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) {
314 305
         $error     = $this->getErrorMsgTemplate();
315 306
         $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing';
316 307
         $data      = array(
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/FunctionUse/ArgumentFunctionsUsageSniff.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  * @package  PHPCompatibility
33 33
  * @author   Juliette Reinders Folmer <[email protected]>
34 34
  */
35
-class ArgumentFunctionsUsageSniff extends Sniff
36
-{
35
+class ArgumentFunctionsUsageSniff extends Sniff {
37 36
 
38 37
     /**
39 38
      * The target functions for this sniff.
@@ -52,8 +51,7 @@  discard block
 block discarded – undo
52 51
      *
53 52
      * @return array
54 53
      */
55
-    public function register()
56
-    {
54
+    public function register() {
57 55
         return array(\T_STRING);
58 56
     }
59 57
 
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
      *
68 66
      * @return void
69 67
      */
70
-    public function process(File $phpcsFile, $stackPtr)
71
-    {
68
+    public function process(File $phpcsFile, $stackPtr) {
72 69
         $tokens     = $phpcsFile->getTokens();
73 70
         $functionLc = strtolower($tokens[$stackPtr]['content']);
74 71
         if (isset($this->targetFunctions[$functionLc]) === false) {
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
  * @package  PHPCompatibility
20 20
  * @author   Wim Godden <[email protected]>
21 21
  */
22
-class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff
23
-{
22
+class RemovedFunctionsSniff extends AbstractRemovedFeatureSniff {
24 23
     /**
25 24
      * A list of deprecated and removed functions with their alternatives.
26 25
      *
@@ -960,8 +959,7 @@  discard block
 block discarded – undo
960 959
      *
961 960
      * @return array
962 961
      */
963
-    public function register()
964
-    {
962
+    public function register() {
965 963
         // Handle case-insensitivity of function names.
966 964
         $this->removedFunctions = $this->arrayKeysToLowercase($this->removedFunctions);
967 965
 
@@ -978,8 +976,7 @@  discard block
 block discarded – undo
978 976
      *
979 977
      * @return void
980 978
      */
981
-    public function process(File $phpcsFile, $stackPtr)
982
-    {
979
+    public function process(File $phpcsFile, $stackPtr) {
983 980
         $tokens = $phpcsFile->getTokens();
984 981
 
985 982
         $ignore = array(
@@ -1020,8 +1017,7 @@  discard block
 block discarded – undo
1020 1017
      *
1021 1018
      * @return array Version and other information about the item.
1022 1019
      */
1023
-    public function getItemArray(array $itemInfo)
1024
-    {
1020
+    public function getItemArray(array $itemInfo) {
1025 1021
         return $this->removedFunctions[$itemInfo['nameLc']];
1026 1022
     }
1027 1023
 
@@ -1031,8 +1027,7 @@  discard block
 block discarded – undo
1031 1027
      *
1032 1028
      * @return string
1033 1029
      */
1034
-    protected function getErrorMsgTemplate()
1035
-    {
1030
+    protected function getErrorMsgTemplate() {
1036 1031
         return 'Function %s() is ';
1037 1032
     }
1038 1033
 }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionParametersSniff.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package  PHPCompatibility
21 21
  * @author   Wim Godden <[email protected]>
22 22
  */
23
-class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff
24
-{
23
+class RemovedFunctionParametersSniff extends AbstractRemovedFeatureSniff {
25 24
     /**
26 25
      * A list of removed function parameters, which were present in older versions.
27 26
      *
@@ -72,8 +71,7 @@  discard block
 block discarded – undo
72 71
      *
73 72
      * @return array
74 73
      */
75
-    public function register()
76
-    {
74
+    public function register() {
77 75
         // Handle case-insensitivity of function names.
78 76
         $this->removedFunctionParameters = $this->arrayKeysToLowercase($this->removedFunctionParameters);
79 77
 
@@ -89,8 +87,7 @@  discard block
 block discarded – undo
89 87
      *
90 88
      * @return void
91 89
      */
92
-    public function process(File $phpcsFile, $stackPtr)
93
-    {
90
+    public function process(File $phpcsFile, $stackPtr) {
94 91
         $tokens = $phpcsFile->getTokens();
95 92
 
96 93
         $ignore = array(
@@ -142,8 +139,7 @@  discard block
 block discarded – undo
142 139
      *
143 140
      * @return array Version and other information about the item.
144 141
      */
145
-    public function getItemArray(array $itemInfo)
146
-    {
142
+    public function getItemArray(array $itemInfo) {
147 143
         return $this->removedFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
148 144
     }
149 145
 
@@ -153,8 +149,7 @@  discard block
 block discarded – undo
153 149
      *
154 150
      * @return array
155 151
      */
156
-    protected function getNonVersionArrayKeys()
157
-    {
152
+    protected function getNonVersionArrayKeys() {
158 153
         return array('name');
159 154
     }
160 155
 
@@ -167,8 +162,7 @@  discard block
 block discarded – undo
167 162
      *
168 163
      * @return array
169 164
      */
170
-    public function getErrorInfo(array $itemArray, array $itemInfo)
171
-    {
165
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
172 166
         $errorInfo              = parent::getErrorInfo($itemArray, $itemInfo);
173 167
         $errorInfo['paramName'] = $itemArray['name'];
174 168
 
@@ -184,8 +178,7 @@  discard block
 block discarded – undo
184 178
      *
185 179
      * @return string
186 180
      */
187
-    protected function getItemName(array $itemInfo, array $errorInfo)
188
-    {
181
+    protected function getItemName(array $itemInfo, array $errorInfo) {
189 182
         return $itemInfo['name'] . '_' . $errorInfo['paramName'];
190 183
     }
191 184
 
@@ -195,8 +188,7 @@  discard block
 block discarded – undo
195 188
      *
196 189
      * @return string
197 190
      */
198
-    protected function getErrorMsgTemplate()
199
-    {
191
+    protected function getErrorMsgTemplate() {
200 192
         return 'The "%s" parameter for function %s() is ';
201 193
     }
202 194
 
@@ -210,8 +202,7 @@  discard block
 block discarded – undo
210 202
      *
211 203
      * @return array
212 204
      */
213
-    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
214
-    {
205
+    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) {
215 206
         array_shift($data);
216 207
         array_unshift($data, $errorInfo['paramName'], $itemInfo['name']);
217 208
         return $data;
Please login to merge, or discard this patch.
Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
  * @package  PHPCompatibility
20 20
  * @author   Juliette Reinders Folmer <[email protected]>
21 21
  */
22
-class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff
23
-{
22
+class OptionalToRequiredFunctionParametersSniff extends RequiredToOptionalFunctionParametersSniff {
24 23
 
25 24
     /**
26 25
      * A list of function parameters, which were optional in older versions and became required later on.
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return bool
59 58
      */
60
-    protected function shouldThrowError(array $errorInfo)
61
-    {
59
+    protected function shouldThrowError(array $errorInfo) {
62 60
         return ($errorInfo['optionalDeprecated'] !== ''
63 61
             || $errorInfo['optionalRemoved'] !== ''
64 62
             || $errorInfo['optionalRecommended'] !== '');
@@ -73,8 +71,7 @@  discard block
 block discarded – undo
73 71
      *
74 72
      * @return array
75 73
      */
76
-    public function getErrorInfo(array $itemArray, array $itemInfo)
77
-    {
74
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
78 75
         $errorInfo = array(
79 76
             'paramName'           => '',
80 77
             'optionalRecommended' => '',
@@ -118,8 +115,7 @@  discard block
 block discarded – undo
118 115
      *
119 116
      * @return void
120 117
      */
121
-    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo)
122
-    {
118
+    public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) {
123 119
         $error = 'The "%s" parameter for function %s() is missing. Passing this parameter is ';
124 120
         if ($errorInfo['optionalRecommended'] === '') {
125 121
             $error .= 'no longer optional. The optional nature of the parameter is ';
Please login to merge, or discard this patch.
php-compatibility/PHPCompatibility/Sniffs/FunctionUse/NewFunctionsSniff.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
  * @package  PHPCompatibility
20 20
  * @author   Wim Godden <[email protected]>
21 21
  */
22
-class NewFunctionsSniff extends AbstractNewFeatureSniff
23
-{
22
+class NewFunctionsSniff extends AbstractNewFeatureSniff {
24 23
     /**
25 24
      * A list of new functions, not present in older versions.
26 25
      *
@@ -1886,8 +1885,7 @@  discard block
 block discarded – undo
1886 1885
      *
1887 1886
      * @return array
1888 1887
      */
1889
-    public function register()
1890
-    {
1888
+    public function register() {
1891 1889
         // Handle case-insensitivity of function names.
1892 1890
         $this->newFunctions = $this->arrayKeysToLowercase($this->newFunctions);
1893 1891
 
@@ -1903,8 +1901,7 @@  discard block
 block discarded – undo
1903 1901
      *
1904 1902
      * @return void
1905 1903
      */
1906
-    public function process(File $phpcsFile, $stackPtr)
1907
-    {
1904
+    public function process(File $phpcsFile, $stackPtr) {
1908 1905
         $tokens = $phpcsFile->getTokens();
1909 1906
 
1910 1907
         $ignore = array(
@@ -1946,8 +1943,7 @@  discard block
 block discarded – undo
1946 1943
      *
1947 1944
      * @return array Version and other information about the item.
1948 1945
      */
1949
-    public function getItemArray(array $itemInfo)
1950
-    {
1946
+    public function getItemArray(array $itemInfo) {
1951 1947
         return $this->newFunctions[$itemInfo['nameLc']];
1952 1948
     }
1953 1949
 
@@ -1957,8 +1953,7 @@  discard block
 block discarded – undo
1957 1953
      *
1958 1954
      * @return string
1959 1955
      */
1960
-    protected function getErrorMsgTemplate()
1961
-    {
1956
+    protected function getErrorMsgTemplate() {
1962 1957
         return 'The function %s() is not present in PHP version %s or earlier';
1963 1958
     }
1964 1959
 }
Please login to merge, or discard this patch.
PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package  PHPCompatibility
21 21
  * @author   Wim Godden <[email protected]>
22 22
  */
23
-class NewFunctionParametersSniff extends AbstractNewFeatureSniff
24
-{
23
+class NewFunctionParametersSniff extends AbstractNewFeatureSniff {
25 24
     /**
26 25
      * A list of new functions, not present in older versions.
27 26
      *
@@ -939,8 +938,7 @@  discard block
 block discarded – undo
939 938
      *
940 939
      * @return array
941 940
      */
942
-    public function register()
943
-    {
941
+    public function register() {
944 942
         // Handle case-insensitivity of function names.
945 943
         $this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters);
946 944
 
@@ -956,8 +954,7 @@  discard block
 block discarded – undo
956 954
      *
957 955
      * @return void
958 956
      */
959
-    public function process(File $phpcsFile, $stackPtr)
960
-    {
957
+    public function process(File $phpcsFile, $stackPtr) {
961 958
         $tokens = $phpcsFile->getTokens();
962 959
 
963 960
         $ignore = array(
@@ -1009,8 +1006,7 @@  discard block
 block discarded – undo
1009 1006
      *
1010 1007
      * @return array Version and other information about the item.
1011 1008
      */
1012
-    public function getItemArray(array $itemInfo)
1013
-    {
1009
+    public function getItemArray(array $itemInfo) {
1014 1010
         return $this->newFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
1015 1011
     }
1016 1012
 
@@ -1020,8 +1016,7 @@  discard block
 block discarded – undo
1020 1016
      *
1021 1017
      * @return array
1022 1018
      */
1023
-    protected function getNonVersionArrayKeys()
1024
-    {
1019
+    protected function getNonVersionArrayKeys() {
1025 1020
         return array('name');
1026 1021
     }
1027 1022
 
@@ -1034,8 +1029,7 @@  discard block
 block discarded – undo
1034 1029
      *
1035 1030
      * @return array
1036 1031
      */
1037
-    public function getErrorInfo(array $itemArray, array $itemInfo)
1038
-    {
1032
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
1039 1033
         $errorInfo              = parent::getErrorInfo($itemArray, $itemInfo);
1040 1034
         $errorInfo['paramName'] = $itemArray['name'];
1041 1035
 
@@ -1051,8 +1045,7 @@  discard block
 block discarded – undo
1051 1045
      *
1052 1046
      * @return string
1053 1047
      */
1054
-    protected function getItemName(array $itemInfo, array $errorInfo)
1055
-    {
1048
+    protected function getItemName(array $itemInfo, array $errorInfo) {
1056 1049
         return $itemInfo['name'] . '_' . $errorInfo['paramName'];
1057 1050
     }
1058 1051
 
@@ -1062,8 +1055,7 @@  discard block
 block discarded – undo
1062 1055
      *
1063 1056
      * @return string
1064 1057
      */
1065
-    protected function getErrorMsgTemplate()
1066
-    {
1058
+    protected function getErrorMsgTemplate() {
1067 1059
         return 'The function %s() does not have a parameter "%s" in PHP version %s or earlier';
1068 1060
     }
1069 1061
 
@@ -1077,8 +1069,7 @@  discard block
 block discarded – undo
1077 1069
      *
1078 1070
      * @return array
1079 1071
      */
1080
-    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
1081
-    {
1072
+    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) {
1082 1073
         array_shift($data);
1083 1074
         array_unshift($data, $itemInfo['name'], $errorInfo['paramName']);
1084 1075
         return $data;
Please login to merge, or discard this patch.
php-compatibility/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  * @author    Wim Godden <[email protected]>
23 23
  * @copyright 2013 Cu.be Solutions bvba
24 24
  */
25
-class NewKeywordsSniff extends AbstractNewFeatureSniff
26
-{
25
+class NewKeywordsSniff extends AbstractNewFeatureSniff {
27 26
 
28 27
     /**
29 28
      * A list of new keywords, not present in older versions.
@@ -159,8 +158,7 @@  discard block
 block discarded – undo
159 158
      *
160 159
      * @return array
161 160
      */
162
-    public function register()
163
-    {
161
+    public function register() {
164 162
         $tokens    = array();
165 163
         $translate = array();
166 164
         foreach ($this->newKeywords as $token => $versions) {
@@ -194,8 +192,7 @@  discard block
 block discarded – undo
194 192
      *
195 193
      * @return void
196 194
      */
197
-    public function process(File $phpcsFile, $stackPtr)
198
-    {
195
+    public function process(File $phpcsFile, $stackPtr) {
199 196
         $tokens    = $phpcsFile->getTokens();
200 197
         $tokenType = $tokens[$stackPtr]['type'];
201 198
 
@@ -292,8 +289,7 @@  discard block
 block discarded – undo
292 289
      *
293 290
      * @return array Version and other information about the item.
294 291
      */
295
-    public function getItemArray(array $itemInfo)
296
-    {
292
+    public function getItemArray(array $itemInfo) {
297 293
         return $this->newKeywords[$itemInfo['name']];
298 294
     }
299 295
 
@@ -303,8 +299,7 @@  discard block
 block discarded – undo
303 299
      *
304 300
      * @return array
305 301
      */
306
-    protected function getNonVersionArrayKeys()
307
-    {
302
+    protected function getNonVersionArrayKeys() {
308 303
         return array(
309 304
             'description',
310 305
             'condition',
@@ -321,8 +316,7 @@  discard block
 block discarded – undo
321 316
      *
322 317
      * @return array
323 318
      */
324
-    public function getErrorInfo(array $itemArray, array $itemInfo)
325
-    {
319
+    public function getErrorInfo(array $itemArray, array $itemInfo) {
326 320
         $errorInfo                = parent::getErrorInfo($itemArray, $itemInfo);
327 321
         $errorInfo['description'] = $itemArray['description'];
328 322
 
@@ -339,8 +333,7 @@  discard block
 block discarded – undo
339 333
      *
340 334
      * @return array
341 335
      */
342
-    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
343
-    {
336
+    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) {
344 337
         $data[0] = $errorInfo['description'];
345 338
         return $data;
346 339
     }
@@ -358,8 +351,7 @@  discard block
 block discarded – undo
358 351
      *
359 352
      * @return bool
360 353
      */
361
-    public function isNotQuoted(File $phpcsFile, $stackPtr)
362
-    {
354
+    public function isNotQuoted(File $phpcsFile, $stackPtr) {
363 355
         $tokens = $phpcsFile->getTokens();
364 356
         return ($tokens[$stackPtr]['content'][3] !== '"');
365 357
     }
Please login to merge, or discard this patch.