@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @author Wim Godden <[email protected]> |
26 | 26 | * @copyright 2012 Cu.be Solutions bvba |
27 | 27 | */ |
28 | -class NonStaticMagicMethodsSniff extends Sniff |
|
29 | -{ |
|
28 | +class NonStaticMagicMethodsSniff extends Sniff { |
|
30 | 29 | |
31 | 30 | /** |
32 | 31 | * A list of PHP magic methods and their visibility and static requirements. |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * |
82 | 81 | * @return array |
83 | 82 | */ |
84 | - public function register() |
|
85 | - { |
|
83 | + public function register() { |
|
86 | 84 | $targets = array( |
87 | 85 | \T_CLASS, |
88 | 86 | \T_INTERFACE, |
@@ -106,8 +104,7 @@ discard block |
||
106 | 104 | * |
107 | 105 | * @return void |
108 | 106 | */ |
109 | - public function process(File $phpcsFile, $stackPtr) |
|
110 | - { |
|
107 | + public function process(File $phpcsFile, $stackPtr) { |
|
111 | 108 | // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it. |
112 | 109 | if ($this->supportsAbove('5.3') === false) { |
113 | 110 | return; |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @author Wim Godden <[email protected]> |
25 | 25 | * @copyright 2012 Cu.be Solutions bvba |
26 | 26 | */ |
27 | -class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff |
|
28 | -{ |
|
27 | +class RemovedExtensionsSniff extends AbstractRemovedFeatureSniff { |
|
29 | 28 | /** |
30 | 29 | * A list of functions to whitelist, if any. |
31 | 30 | * |
@@ -187,8 +186,7 @@ discard block |
||
187 | 186 | * |
188 | 187 | * @return array |
189 | 188 | */ |
190 | - public function register() |
|
191 | - { |
|
189 | + public function register() { |
|
192 | 190 | // Handle case-insensitivity of function names. |
193 | 191 | $this->removedExtensions = $this->arrayKeysToLowercase($this->removedExtensions); |
194 | 192 | |
@@ -204,8 +202,7 @@ discard block |
||
204 | 202 | * |
205 | 203 | * @return void |
206 | 204 | */ |
207 | - public function process(File $phpcsFile, $stackPtr) |
|
208 | - { |
|
205 | + public function process(File $phpcsFile, $stackPtr) { |
|
209 | 206 | $tokens = $phpcsFile->getTokens(); |
210 | 207 | |
211 | 208 | // Find the next non-empty token. |
@@ -269,8 +266,7 @@ discard block |
||
269 | 266 | * |
270 | 267 | * @return bool |
271 | 268 | */ |
272 | - protected function isWhiteListed($content) |
|
273 | - { |
|
269 | + protected function isWhiteListed($content) { |
|
274 | 270 | if (isset($this->functionWhitelist) === false) { |
275 | 271 | return false; |
276 | 272 | } |
@@ -299,8 +295,7 @@ discard block |
||
299 | 295 | * |
300 | 296 | * @return array Version and other information about the item. |
301 | 297 | */ |
302 | - public function getItemArray(array $itemInfo) |
|
303 | - { |
|
298 | + public function getItemArray(array $itemInfo) { |
|
304 | 299 | return $this->removedExtensions[$itemInfo['name']]; |
305 | 300 | } |
306 | 301 | |
@@ -310,8 +305,7 @@ discard block |
||
310 | 305 | * |
311 | 306 | * @return string |
312 | 307 | */ |
313 | - protected function getErrorMsgTemplate() |
|
314 | - { |
|
308 | + protected function getErrorMsgTemplate() { |
|
315 | 309 | return "Extension '%s' is "; |
316 | 310 | } |
317 | 311 | } |
@@ -24,15 +24,13 @@ discard block |
||
24 | 24 | * @package PHPCompatibility |
25 | 25 | * @author Wim Godden <[email protected]> |
26 | 26 | */ |
27 | -class NewGroupUseDeclarationsSniff extends Sniff |
|
28 | -{ |
|
27 | +class NewGroupUseDeclarationsSniff extends Sniff { |
|
29 | 28 | /** |
30 | 29 | * Returns an array of tokens this test wants to listen for. |
31 | 30 | * |
32 | 31 | * @return array |
33 | 32 | */ |
34 | - public function register() |
|
35 | - { |
|
33 | + public function register() { |
|
36 | 34 | if (\defined('T_OPEN_USE_GROUP')) { |
37 | 35 | return array(\T_OPEN_USE_GROUP); |
38 | 36 | } else { |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | * |
51 | 49 | * @return void |
52 | 50 | */ |
53 | - public function process(File $phpcsFile, $stackPtr) |
|
54 | - { |
|
51 | + public function process(File $phpcsFile, $stackPtr) { |
|
55 | 52 | if ($this->supportsBelow('7.1') === false) { |
56 | 53 | return; |
57 | 54 | } |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * @package PHPCompatibility |
29 | 29 | * @author Juliette Reinders Folmer <[email protected]> |
30 | 30 | */ |
31 | -class NewUseConstFunctionSniff extends Sniff |
|
32 | -{ |
|
31 | +class NewUseConstFunctionSniff extends Sniff { |
|
33 | 32 | |
34 | 33 | /** |
35 | 34 | * A list of keywords that can follow use statements. |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * |
47 | 46 | * @return array |
48 | 47 | */ |
49 | - public function register() |
|
50 | - { |
|
48 | + public function register() { |
|
51 | 49 | return array(\T_USE); |
52 | 50 | } |
53 | 51 | |
@@ -61,8 +59,7 @@ discard block |
||
61 | 59 | * |
62 | 60 | * @return void |
63 | 61 | */ |
64 | - public function process(File $phpcsFile, $stackPtr) |
|
65 | - { |
|
62 | + public function process(File $phpcsFile, $stackPtr) { |
|
66 | 63 | if ($this->supportsBelow('5.5') !== true) { |
67 | 64 | return; |
68 | 65 | } |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * @package PHPCompatibility |
20 | 20 | * @author Juliette Reinders Folmer <[email protected]> |
21 | 21 | */ |
22 | -class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff |
|
23 | -{ |
|
22 | +class RemovedTypeCastsSniff extends AbstractRemovedFeatureSniff { |
|
24 | 23 | /** |
25 | 24 | * A list of deprecated and removed type casts with their alternatives. |
26 | 25 | * |
@@ -43,8 +42,7 @@ discard block |
||
43 | 42 | * |
44 | 43 | * @return array |
45 | 44 | */ |
46 | - public function register() |
|
47 | - { |
|
45 | + public function register() { |
|
48 | 46 | $tokens = array(); |
49 | 47 | foreach ($this->deprecatedTypeCasts as $token => $versions) { |
50 | 48 | $tokens[] = constant($token); |
@@ -63,8 +61,7 @@ discard block |
||
63 | 61 | * |
64 | 62 | * @return void |
65 | 63 | */ |
66 | - public function process(File $phpcsFile, $stackPtr) |
|
67 | - { |
|
64 | + public function process(File $phpcsFile, $stackPtr) { |
|
68 | 65 | $tokens = $phpcsFile->getTokens(); |
69 | 66 | $tokenType = $tokens[$stackPtr]['type']; |
70 | 67 | |
@@ -81,8 +78,7 @@ discard block |
||
81 | 78 | * |
82 | 79 | * @return array |
83 | 80 | */ |
84 | - protected function getNonVersionArrayKeys() |
|
85 | - { |
|
81 | + protected function getNonVersionArrayKeys() { |
|
86 | 82 | return array('description', 'alternative'); |
87 | 83 | } |
88 | 84 | |
@@ -93,8 +89,7 @@ discard block |
||
93 | 89 | * |
94 | 90 | * @return array Version and other information about the item. |
95 | 91 | */ |
96 | - public function getItemArray(array $itemInfo) |
|
97 | - { |
|
92 | + public function getItemArray(array $itemInfo) { |
|
98 | 93 | return $this->deprecatedTypeCasts[$itemInfo['name']]; |
99 | 94 | } |
100 | 95 | |
@@ -104,8 +99,7 @@ discard block |
||
104 | 99 | * |
105 | 100 | * @return string |
106 | 101 | */ |
107 | - protected function getErrorMsgTemplate() |
|
108 | - { |
|
102 | + protected function getErrorMsgTemplate() { |
|
109 | 103 | return 'The %s cast is '; |
110 | 104 | } |
111 | 105 | |
@@ -119,8 +113,7 @@ discard block |
||
119 | 113 | * |
120 | 114 | * @return array |
121 | 115 | */ |
122 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
123 | - { |
|
116 | + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { |
|
124 | 117 | $data[0] = $itemInfo['description']; |
125 | 118 | return $data; |
126 | 119 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @package PHPCompatibility |
21 | 21 | * @author Juliette Reinders Folmer <[email protected]> |
22 | 22 | */ |
23 | -class NewTypeCastsSniff extends AbstractNewFeatureSniff |
|
24 | -{ |
|
23 | +class NewTypeCastsSniff extends AbstractNewFeatureSniff { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * A list of new type casts, not present in older versions. |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | * |
51 | 50 | * @return array |
52 | 51 | */ |
53 | - public function register() |
|
54 | - { |
|
52 | + public function register() { |
|
55 | 53 | $tokens = array(); |
56 | 54 | foreach ($this->newTypeCasts as $token => $versions) { |
57 | 55 | if (\defined($token)) { |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * |
87 | 85 | * @return void |
88 | 86 | */ |
89 | - public function process(File $phpcsFile, $stackPtr) |
|
90 | - { |
|
87 | + public function process(File $phpcsFile, $stackPtr) { |
|
91 | 88 | $tokens = $phpcsFile->getTokens(); |
92 | 89 | $tokenType = $tokens[$stackPtr]['type']; |
93 | 90 | |
@@ -136,8 +133,7 @@ discard block |
||
136 | 133 | * |
137 | 134 | * @return array Version and other information about the item. |
138 | 135 | */ |
139 | - public function getItemArray(array $itemInfo) |
|
140 | - { |
|
136 | + public function getItemArray(array $itemInfo) { |
|
141 | 137 | return $this->newTypeCasts[$itemInfo['name']]; |
142 | 138 | } |
143 | 139 | |
@@ -147,8 +143,7 @@ discard block |
||
147 | 143 | * |
148 | 144 | * @return array |
149 | 145 | */ |
150 | - protected function getNonVersionArrayKeys() |
|
151 | - { |
|
146 | + protected function getNonVersionArrayKeys() { |
|
152 | 147 | return array('description'); |
153 | 148 | } |
154 | 149 | |
@@ -161,8 +156,7 @@ discard block |
||
161 | 156 | * |
162 | 157 | * @return array |
163 | 158 | */ |
164 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
165 | - { |
|
159 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
166 | 160 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
167 | 161 | $errorInfo['description'] = $itemArray['description']; |
168 | 162 | |
@@ -179,8 +173,7 @@ discard block |
||
179 | 173 | * |
180 | 174 | * @return string |
181 | 175 | */ |
182 | - protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) |
|
183 | - { |
|
176 | + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) { |
|
184 | 177 | return $error . '. Found: %s'; |
185 | 178 | } |
186 | 179 | |
@@ -194,8 +187,7 @@ discard block |
||
194 | 187 | * |
195 | 188 | * @return array |
196 | 189 | */ |
197 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
198 | - { |
|
190 | + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { |
|
199 | 191 | $data[0] = $errorInfo['description']; |
200 | 192 | $data[] = $itemInfo['content']; |
201 | 193 | return $data; |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @author Wim Godden <[email protected]> |
24 | 24 | * @copyright 2012 Cu.be Solutions bvba |
25 | 25 | */ |
26 | -class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff |
|
27 | -{ |
|
26 | +class RemovedIniDirectivesSniff extends AbstractRemovedFeatureSniff { |
|
28 | 27 | /** |
29 | 28 | * A list of deprecated INI directives. |
30 | 29 | * |
@@ -287,8 +286,7 @@ discard block |
||
287 | 286 | * |
288 | 287 | * @return array |
289 | 288 | */ |
290 | - public function register() |
|
291 | - { |
|
289 | + public function register() { |
|
292 | 290 | return array(\T_STRING); |
293 | 291 | } |
294 | 292 | |
@@ -301,8 +299,7 @@ discard block |
||
301 | 299 | * |
302 | 300 | * @return void |
303 | 301 | */ |
304 | - public function process(File $phpcsFile, $stackPtr) |
|
305 | - { |
|
302 | + public function process(File $phpcsFile, $stackPtr) { |
|
306 | 303 | $tokens = $phpcsFile->getTokens(); |
307 | 304 | |
308 | 305 | $ignore = array( |
@@ -348,8 +345,7 @@ discard block |
||
348 | 345 | * |
349 | 346 | * @return array Version and other information about the item. |
350 | 347 | */ |
351 | - public function getItemArray(array $itemInfo) |
|
352 | - { |
|
348 | + public function getItemArray(array $itemInfo) { |
|
353 | 349 | return $this->deprecatedIniDirectives[$itemInfo['name']]; |
354 | 350 | } |
355 | 351 | |
@@ -362,8 +358,7 @@ discard block |
||
362 | 358 | * |
363 | 359 | * @return array |
364 | 360 | */ |
365 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
366 | - { |
|
361 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
367 | 362 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
368 | 363 | |
369 | 364 | // Lower error level to warning if the function used was ini_get. |
@@ -380,8 +375,7 @@ discard block |
||
380 | 375 | * |
381 | 376 | * @return string |
382 | 377 | */ |
383 | - protected function getErrorMsgTemplate() |
|
384 | - { |
|
378 | + protected function getErrorMsgTemplate() { |
|
385 | 379 | return "INI directive '%s' is "; |
386 | 380 | } |
387 | 381 | |
@@ -391,8 +385,7 @@ discard block |
||
391 | 385 | * |
392 | 386 | * @return string |
393 | 387 | */ |
394 | - protected function getAlternativeOptionTemplate() |
|
395 | - { |
|
388 | + protected function getAlternativeOptionTemplate() { |
|
396 | 389 | return str_replace("%s", "'%s'", parent::getAlternativeOptionTemplate()); |
397 | 390 | } |
398 | 391 | } |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @author Wim Godden <[email protected]> |
24 | 24 | * @copyright 2013 Cu.be Solutions bvba |
25 | 25 | */ |
26 | -class NewIniDirectivesSniff extends AbstractNewFeatureSniff |
|
27 | -{ |
|
26 | +class NewIniDirectivesSniff extends AbstractNewFeatureSniff { |
|
28 | 27 | /** |
29 | 28 | * A list of new INI directives |
30 | 29 | * |
@@ -509,8 +508,7 @@ discard block |
||
509 | 508 | * |
510 | 509 | * @return array |
511 | 510 | */ |
512 | - public function register() |
|
513 | - { |
|
511 | + public function register() { |
|
514 | 512 | return array(\T_STRING); |
515 | 513 | } |
516 | 514 | |
@@ -523,8 +521,7 @@ discard block |
||
523 | 521 | * |
524 | 522 | * @return void |
525 | 523 | */ |
526 | - public function process(File $phpcsFile, $stackPtr) |
|
527 | - { |
|
524 | + public function process(File $phpcsFile, $stackPtr) { |
|
528 | 525 | $tokens = $phpcsFile->getTokens(); |
529 | 526 | |
530 | 527 | $ignore = array( |
@@ -570,8 +567,7 @@ discard block |
||
570 | 567 | * |
571 | 568 | * @return array Version and other information about the item. |
572 | 569 | */ |
573 | - public function getItemArray(array $itemInfo) |
|
574 | - { |
|
570 | + public function getItemArray(array $itemInfo) { |
|
575 | 571 | return $this->newIniDirectives[$itemInfo['name']]; |
576 | 572 | } |
577 | 573 | |
@@ -581,8 +577,7 @@ discard block |
||
581 | 577 | * |
582 | 578 | * @return array |
583 | 579 | */ |
584 | - protected function getNonVersionArrayKeys() |
|
585 | - { |
|
580 | + protected function getNonVersionArrayKeys() { |
|
586 | 581 | return array('alternative'); |
587 | 582 | } |
588 | 583 | |
@@ -595,8 +590,7 @@ discard block |
||
595 | 590 | * |
596 | 591 | * @return array |
597 | 592 | */ |
598 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
599 | - { |
|
593 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
600 | 594 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
601 | 595 | $errorInfo['alternative'] = ''; |
602 | 596 | |
@@ -618,8 +612,7 @@ discard block |
||
618 | 612 | * |
619 | 613 | * @return string |
620 | 614 | */ |
621 | - protected function getErrorMsgTemplate() |
|
622 | - { |
|
615 | + protected function getErrorMsgTemplate() { |
|
623 | 616 | return "INI directive '%s' is not present in PHP version %s or earlier"; |
624 | 617 | } |
625 | 618 | |
@@ -633,8 +626,7 @@ discard block |
||
633 | 626 | * |
634 | 627 | * @return string |
635 | 628 | */ |
636 | - protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) |
|
637 | - { |
|
629 | + protected function filterErrorMsg($error, array $itemInfo, array $errorInfo) { |
|
638 | 630 | if ($errorInfo['alternative'] !== '') { |
639 | 631 | $error .= ". This directive was previously called '%s'."; |
640 | 632 | } |
@@ -652,8 +644,7 @@ discard block |
||
652 | 644 | * |
653 | 645 | * @return array |
654 | 646 | */ |
655 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
656 | - { |
|
647 | + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { |
|
657 | 648 | if ($errorInfo['alternative'] !== '') { |
658 | 649 | $data[] = $errorInfo['alternative']; |
659 | 650 | } |
@@ -27,16 +27,14 @@ discard block |
||
27 | 27 | * @package PHPCompatibility |
28 | 28 | * @author Juliette Reinders Folmer <[email protected]> |
29 | 29 | */ |
30 | -class NewMagicClassConstantSniff extends Sniff |
|
31 | -{ |
|
30 | +class NewMagicClassConstantSniff extends Sniff { |
|
32 | 31 | |
33 | 32 | /** |
34 | 33 | * Returns an array of tokens this test wants to listen for. |
35 | 34 | * |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public function register() |
|
39 | - { |
|
37 | + public function register() { |
|
40 | 38 | return array(\T_STRING); |
41 | 39 | } |
42 | 40 | |
@@ -49,8 +47,7 @@ discard block |
||
49 | 47 | * |
50 | 48 | * @return void |
51 | 49 | */ |
52 | - public function process(File $phpcsFile, $stackPtr) |
|
53 | - { |
|
50 | + public function process(File $phpcsFile, $stackPtr) { |
|
54 | 51 | if ($this->supportsBelow('5.4') === false) { |
55 | 52 | return; |
56 | 53 | } |