@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * @package PHPCompatibility |
20 | 20 | * @author Juliette Reinders Folmer <[email protected]> |
21 | 21 | */ |
22 | -class RemovedConstantsSniff extends AbstractRemovedFeatureSniff |
|
23 | -{ |
|
22 | +class RemovedConstantsSniff extends AbstractRemovedFeatureSniff { |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * A list of removed PHP Constants. |
@@ -487,8 +486,7 @@ discard block |
||
487 | 486 | * |
488 | 487 | * @return array |
489 | 488 | */ |
490 | - public function register() |
|
491 | - { |
|
489 | + public function register() { |
|
492 | 490 | return array(\T_STRING); |
493 | 491 | } |
494 | 492 | |
@@ -502,8 +500,7 @@ discard block |
||
502 | 500 | * |
503 | 501 | * @return void |
504 | 502 | */ |
505 | - public function process(File $phpcsFile, $stackPtr) |
|
506 | - { |
|
503 | + public function process(File $phpcsFile, $stackPtr) { |
|
507 | 504 | $tokens = $phpcsFile->getTokens(); |
508 | 505 | $constantName = $tokens[$stackPtr]['content']; |
509 | 506 | |
@@ -529,8 +526,7 @@ discard block |
||
529 | 526 | * |
530 | 527 | * @return array Version and other information about the item. |
531 | 528 | */ |
532 | - public function getItemArray(array $itemInfo) |
|
533 | - { |
|
529 | + public function getItemArray(array $itemInfo) { |
|
534 | 530 | return $this->removedConstants[$itemInfo['name']]; |
535 | 531 | } |
536 | 532 | |
@@ -540,8 +536,7 @@ discard block |
||
540 | 536 | * |
541 | 537 | * @return string |
542 | 538 | */ |
543 | - protected function getErrorMsgTemplate() |
|
544 | - { |
|
539 | + protected function getErrorMsgTemplate() { |
|
545 | 540 | return 'The constant "%s" is '; |
546 | 541 | } |
547 | 542 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @package PHPCompatibility |
21 | 21 | * @author Juliette Reinders Folmer <[email protected]> |
22 | 22 | */ |
23 | -class NewInterfacesSniff extends AbstractNewFeatureSniff |
|
24 | -{ |
|
23 | +class NewInterfacesSniff extends AbstractNewFeatureSniff { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * A list of new interfaces, not present in older versions. |
@@ -116,8 +115,7 @@ discard block |
||
116 | 115 | * |
117 | 116 | * @return array |
118 | 117 | */ |
119 | - public function register() |
|
120 | - { |
|
118 | + public function register() { |
|
121 | 119 | // Handle case-insensitivity of interface names. |
122 | 120 | $this->newInterfaces = $this->arrayKeysToLowercase($this->newInterfaces); |
123 | 121 | $this->unsupportedMethods = $this->arrayKeysToLowercase($this->unsupportedMethods); |
@@ -149,8 +147,7 @@ discard block |
||
149 | 147 | * |
150 | 148 | * @return void |
151 | 149 | */ |
152 | - public function process(File $phpcsFile, $stackPtr) |
|
153 | - { |
|
150 | + public function process(File $phpcsFile, $stackPtr) { |
|
154 | 151 | $tokens = $phpcsFile->getTokens(); |
155 | 152 | |
156 | 153 | switch ($tokens[$stackPtr]['type']) { |
@@ -194,8 +191,7 @@ discard block |
||
194 | 191 | * |
195 | 192 | * @return void |
196 | 193 | */ |
197 | - private function processClassToken(File $phpcsFile, $stackPtr) |
|
198 | - { |
|
194 | + private function processClassToken(File $phpcsFile, $stackPtr) { |
|
199 | 195 | $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr); |
200 | 196 | |
201 | 197 | if (\is_array($interfaces) === false || $interfaces === array()) { |
@@ -259,8 +255,7 @@ discard block |
||
259 | 255 | * |
260 | 256 | * @return void |
261 | 257 | */ |
262 | - private function processFunctionToken(File $phpcsFile, $stackPtr) |
|
263 | - { |
|
258 | + private function processFunctionToken(File $phpcsFile, $stackPtr) { |
|
264 | 259 | $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); |
265 | 260 | if (empty($typeHints) || \is_array($typeHints) === false) { |
266 | 261 | return; |
@@ -292,8 +287,7 @@ discard block |
||
292 | 287 | * |
293 | 288 | * @return void |
294 | 289 | */ |
295 | - private function processReturnTypeToken(File $phpcsFile, $stackPtr) |
|
296 | - { |
|
290 | + private function processReturnTypeToken(File $phpcsFile, $stackPtr) { |
|
297 | 291 | $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); |
298 | 292 | $returnTypeHint = ltrim($returnTypeHint, '\\'); |
299 | 293 | $returnTypeHintLc = strtolower($returnTypeHint); |
@@ -318,8 +312,7 @@ discard block |
||
318 | 312 | * |
319 | 313 | * @return array Version and other information about the item. |
320 | 314 | */ |
321 | - public function getItemArray(array $itemInfo) |
|
322 | - { |
|
315 | + public function getItemArray(array $itemInfo) { |
|
323 | 316 | return $this->newInterfaces[$itemInfo['nameLc']]; |
324 | 317 | } |
325 | 318 | |
@@ -329,8 +322,7 @@ discard block |
||
329 | 322 | * |
330 | 323 | * @return string |
331 | 324 | */ |
332 | - protected function getErrorMsgTemplate() |
|
333 | - { |
|
325 | + protected function getErrorMsgTemplate() { |
|
334 | 326 | return 'The built-in interface ' . parent::getErrorMsgTemplate(); |
335 | 327 | } |
336 | 328 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @package PHPCompatibility |
21 | 21 | * @author Juliette Reinders Folmer <[email protected]> |
22 | 22 | */ |
23 | -class InternalInterfacesSniff extends Sniff |
|
24 | -{ |
|
23 | +class InternalInterfacesSniff extends Sniff { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * A list of PHP internal interfaces, not intended to be implemented by userland classes. |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | * |
43 | 42 | * @return array |
44 | 43 | */ |
45 | - public function register() |
|
46 | - { |
|
44 | + public function register() { |
|
47 | 45 | // Handle case-insensitivity of interface names. |
48 | 46 | $this->internalInterfaces = $this->arrayKeysToLowercase($this->internalInterfaces); |
49 | 47 | |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | * |
67 | 65 | * @return void |
68 | 66 | */ |
69 | - public function process(File $phpcsFile, $stackPtr) |
|
70 | - { |
|
67 | + public function process(File $phpcsFile, $stackPtr) { |
|
71 | 68 | $interfaces = PHPCSHelper::findImplementedInterfaceNames($phpcsFile, $stackPtr); |
72 | 69 | |
73 | 70 | if (\is_array($interfaces) === false || $interfaces === array()) { |
@@ -19,8 +19,7 @@ discard block |
||
19 | 19 | * @package PHPCompatibility |
20 | 20 | * @author Juliette Reinders Folmer <[email protected]> |
21 | 21 | */ |
22 | -class ValidIntegersSniff extends Sniff |
|
23 | -{ |
|
22 | +class ValidIntegersSniff extends Sniff { |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * Whether PHPCS is run on a PHP < 5.4. |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | * |
35 | 34 | * @return array |
36 | 35 | */ |
37 | - public function register() |
|
38 | - { |
|
36 | + public function register() { |
|
39 | 37 | $this->isLowPHPVersion = version_compare(\PHP_VERSION_ID, '50400', '<'); |
40 | 38 | |
41 | 39 | return array( |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return void |
56 | 54 | */ |
57 | - public function process(File $phpcsFile, $stackPtr) |
|
58 | - { |
|
55 | + public function process(File $phpcsFile, $stackPtr) { |
|
59 | 56 | $tokens = $phpcsFile->getTokens(); |
60 | 57 | $token = $tokens[$stackPtr]; |
61 | 58 | |
@@ -115,8 +112,7 @@ discard block |
||
115 | 112 | * |
116 | 113 | * @return bool |
117 | 114 | */ |
118 | - private function couldBeBinaryInteger($tokens, $stackPtr) |
|
119 | - { |
|
115 | + private function couldBeBinaryInteger($tokens, $stackPtr) { |
|
120 | 116 | $token = $tokens[$stackPtr]; |
121 | 117 | |
122 | 118 | if ($token['code'] !== \T_LNUMBER) { |
@@ -141,8 +137,7 @@ discard block |
||
141 | 137 | * |
142 | 138 | * @return bool |
143 | 139 | */ |
144 | - private function isInvalidBinaryInteger($tokens, $stackPtr) |
|
145 | - { |
|
140 | + private function isInvalidBinaryInteger($tokens, $stackPtr) { |
|
146 | 141 | if ($this->couldBeBinaryInteger($tokens, $stackPtr) === false) { |
147 | 142 | return false; |
148 | 143 | } |
@@ -165,8 +160,7 @@ discard block |
||
165 | 160 | * |
166 | 161 | * @return string |
167 | 162 | */ |
168 | - private function getBinaryInteger(File $phpcsFile, $tokens, $stackPtr) |
|
169 | - { |
|
163 | + private function getBinaryInteger(File $phpcsFile, $tokens, $stackPtr) { |
|
170 | 164 | $length = 2; // PHP < 5.4 T_LNUMBER + T_STRING. |
171 | 165 | |
172 | 166 | if ($this->isLowPHPVersion === false) { |
@@ -188,8 +182,7 @@ discard block |
||
188 | 182 | * |
189 | 183 | * @return bool |
190 | 184 | */ |
191 | - private function isInvalidOctalInteger($tokens, $stackPtr) |
|
192 | - { |
|
185 | + private function isInvalidOctalInteger($tokens, $stackPtr) { |
|
193 | 186 | $token = $tokens[$stackPtr]; |
194 | 187 | |
195 | 188 | if ($token['code'] === \T_LNUMBER && preg_match('`^0[0-7]*[8-9]+[0-9]*$`D', $token['content']) === 1) { |
@@ -207,8 +200,7 @@ discard block |
||
207 | 200 | * |
208 | 201 | * @return bool |
209 | 202 | */ |
210 | - private function isHexidecimalNumericString($tokens, $stackPtr) |
|
211 | - { |
|
203 | + private function isHexidecimalNumericString($tokens, $stackPtr) { |
|
212 | 204 | $token = $tokens[$stackPtr]; |
213 | 205 | |
214 | 206 | if ($token['code'] === \T_CONSTANT_ENCAPSED_STRING && preg_match('`^0x[a-f0-9]+$`iD', $this->stripQuotes($token['content'])) === 1) { |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | * Based on `Generic_Sniffs_PHP_DisallowAlternativePHPTags` by Juliette Reinders Folmer |
29 | 29 | * which was merged into PHPCS 2.7.0. |
30 | 30 | */ |
31 | -class RemovedAlternativePHPTagsSniff extends Sniff |
|
32 | -{ |
|
31 | +class RemovedAlternativePHPTagsSniff extends Sniff { |
|
33 | 32 | |
34 | 33 | /** |
35 | 34 | * Whether ASP tags are enabled or not. |
@@ -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 | if (version_compare(\PHP_VERSION_ID, '70000', '<') === true) { |
49 | 47 | // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.asp_tagsRemoved |
50 | 48 | $this->aspTags = (bool) ini_get('asp_tags'); |
@@ -67,8 +65,7 @@ discard block |
||
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 | if ($this->supportsAbove('7.0') === false) { |
73 | 70 | return; |
74 | 71 | } |
@@ -145,8 +142,7 @@ discard block |
||
145 | 142 | * |
146 | 143 | * @return string |
147 | 144 | */ |
148 | - protected function getSnippet($content, $startAt = '', $length = 25) |
|
149 | - { |
|
145 | + protected function getSnippet($content, $startAt = '', $length = 25) { |
|
150 | 146 | $startPos = 0; |
151 | 147 | |
152 | 148 | if ($startAt !== '') { |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @package PHPCompatibility |
27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
28 | 28 | */ |
29 | -class NewGeneratorReturnSniff extends Sniff |
|
30 | -{ |
|
29 | +class NewGeneratorReturnSniff extends Sniff { |
|
31 | 30 | /** |
32 | 31 | * Scope conditions within which a yield can exist. |
33 | 32 | * |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @return array |
46 | 45 | */ |
47 | - public function register() |
|
48 | - { |
|
46 | + public function register() { |
|
49 | 47 | $targets = array( |
50 | 48 | \T_YIELD, |
51 | 49 | ); |
@@ -85,8 +83,7 @@ discard block |
||
85 | 83 | * |
86 | 84 | * @return void|int Void or a stack pointer to skip forward. |
87 | 85 | */ |
88 | - public function process(File $phpcsFile, $stackPtr) |
|
89 | - { |
|
86 | + public function process(File $phpcsFile, $stackPtr) { |
|
90 | 87 | if ($this->supportsBelow('5.6') !== true) { |
91 | 88 | return; |
92 | 89 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @since 9.2.0 |
27 | 27 | */ |
28 | -class ForbiddenToStringParametersSniff extends Sniff |
|
29 | -{ |
|
28 | +class ForbiddenToStringParametersSniff extends Sniff { |
|
30 | 29 | |
31 | 30 | /** |
32 | 31 | * Returns an array of tokens this test wants to listen for. |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public function register() |
|
39 | - { |
|
37 | + public function register() { |
|
40 | 38 | return array( |
41 | 39 | \T_DOUBLE_COLON, |
42 | 40 | \T_OBJECT_OPERATOR, |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return void |
56 | 54 | */ |
57 | - public function process(File $phpcsFile, $stackPtr) |
|
58 | - { |
|
55 | + public function process(File $phpcsFile, $stackPtr) { |
|
59 | 56 | if ($this->supportsAbove('5.3') === false) { |
60 | 57 | return; |
61 | 58 | } |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @since 9.1.0 |
29 | 29 | */ |
30 | -class NewDirectCallsToCloneSniff extends Sniff |
|
31 | -{ |
|
30 | +class NewDirectCallsToCloneSniff extends Sniff { |
|
32 | 31 | |
33 | 32 | /** |
34 | 33 | * Returns an array of tokens this test wants to listen for. |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | * |
38 | 37 | * @return array |
39 | 38 | */ |
40 | - public function register() |
|
41 | - { |
|
39 | + public function register() { |
|
42 | 40 | return array( |
43 | 41 | \T_DOUBLE_COLON, |
44 | 42 | \T_OBJECT_OPERATOR, |
@@ -56,8 +54,7 @@ discard block |
||
56 | 54 | * |
57 | 55 | * @return void |
58 | 56 | */ |
59 | - public function process(File $phpcsFile, $stackPtr) |
|
60 | - { |
|
57 | + public function process(File $phpcsFile, $stackPtr) { |
|
61 | 58 | if ($this->supportsBelow('5.6') === false) { |
62 | 59 | return; |
63 | 60 | } |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | * @package PHPCompatibility |
22 | 22 | * @author Wim Godden <[email protected]> |
23 | 23 | */ |
24 | -class RemovedMagicAutoloadSniff extends Sniff |
|
25 | -{ |
|
24 | +class RemovedMagicAutoloadSniff extends Sniff { |
|
26 | 25 | /** |
27 | 26 | * Scopes to look for when testing using validDirectScope |
28 | 27 | * |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | * |
42 | 41 | * @return array |
43 | 42 | */ |
44 | - public function register() |
|
45 | - { |
|
43 | + public function register() { |
|
46 | 44 | return array(\T_FUNCTION); |
47 | 45 | } |
48 | 46 | |
@@ -55,8 +53,7 @@ discard block |
||
55 | 53 | * |
56 | 54 | * @return void |
57 | 55 | */ |
58 | - public function process(File $phpcsFile, $stackPtr) |
|
59 | - { |
|
56 | + public function process(File $phpcsFile, $stackPtr) { |
|
60 | 57 | if ($this->supportsAbove('7.2') === false) { |
61 | 58 | return; |
62 | 59 | } |