@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | * @package PHPCompatibility |
| 30 | 30 | * @author Juliette Reinders Folmer <[email protected]> |
| 31 | 31 | */ |
| 32 | -class ForbiddenNamesAsDeclaredSniff extends Sniff |
|
| 33 | -{ |
|
| 32 | +class ForbiddenNamesAsDeclaredSniff extends Sniff { |
|
| 34 | 33 | |
| 35 | 34 | /** |
| 36 | 35 | * List of tokens which can not be used as class, interface, trait names or as part of a namespace. |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | * |
| 94 | 93 | * @return array |
| 95 | 94 | */ |
| 96 | - public function register() |
|
| 97 | - { |
|
| 95 | + public function register() { |
|
| 98 | 96 | // Do the list merge only once. |
| 99 | 97 | $this->allForbiddenNames = array_merge($this->forbiddenNames, $this->softReservedNames); |
| 100 | 98 | |
@@ -119,8 +117,7 @@ discard block |
||
| 119 | 117 | * |
| 120 | 118 | * @return void |
| 121 | 119 | */ |
| 122 | - public function process(File $phpcsFile, $stackPtr) |
|
| 123 | - { |
|
| 120 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 124 | 121 | if ($this->supportsAbove('7.0') === false) { |
| 125 | 122 | return; |
| 126 | 123 | } |
@@ -26,16 +26,14 @@ discard block |
||
| 26 | 26 | * @package PHPCompatibility |
| 27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
| 28 | 28 | */ |
| 29 | -class CaseSensitiveKeywordsSniff extends Sniff |
|
| 30 | -{ |
|
| 29 | +class CaseSensitiveKeywordsSniff extends Sniff { |
|
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Returns an array of tokens this test wants to listen for. |
| 34 | 33 | * |
| 35 | 34 | * @return array |
| 36 | 35 | */ |
| 37 | - public function register() |
|
| 38 | - { |
|
| 36 | + public function register() { |
|
| 39 | 37 | return array( |
| 40 | 38 | \T_SELF, |
| 41 | 39 | \T_STATIC, |
@@ -52,8 +50,7 @@ discard block |
||
| 52 | 50 | * |
| 53 | 51 | * @return void |
| 54 | 52 | */ |
| 55 | - public function process(File $phpcsFile, $stackPtr) |
|
| 56 | - { |
|
| 53 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 57 | 54 | if ($this->supportsBelow('5.4') === false) { |
| 58 | 55 | return; |
| 59 | 56 | } |
@@ -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 ForbiddenNamesSniff extends Sniff |
|
| 28 | -{ |
|
| 27 | +class ForbiddenNamesSniff extends Sniff { |
|
| 29 | 28 | |
| 30 | 29 | /** |
| 31 | 30 | * A list of keywords that can not be used as function, class and namespace name or constant name. |
@@ -133,8 +132,7 @@ discard block |
||
| 133 | 132 | * |
| 134 | 133 | * @return array |
| 135 | 134 | */ |
| 136 | - public function register() |
|
| 137 | - { |
|
| 135 | + public function register() { |
|
| 138 | 136 | $this->allowedModifiers = Tokens::$scopeModifiers; |
| 139 | 137 | $this->allowedModifiers[\T_FINAL] = \T_FINAL; |
| 140 | 138 | |
@@ -156,8 +154,7 @@ discard block |
||
| 156 | 154 | * |
| 157 | 155 | * @return void |
| 158 | 156 | */ |
| 159 | - public function process(File $phpcsFile, $stackPtr) |
|
| 160 | - { |
|
| 157 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 161 | 158 | $tokens = $phpcsFile->getTokens(); |
| 162 | 159 | |
| 163 | 160 | /* |
@@ -181,8 +178,7 @@ discard block |
||
| 181 | 178 | * |
| 182 | 179 | * @return void |
| 183 | 180 | */ |
| 184 | - public function processNonString(File $phpcsFile, $stackPtr, $tokens) |
|
| 185 | - { |
|
| 181 | + public function processNonString(File $phpcsFile, $stackPtr, $tokens) { |
|
| 186 | 182 | $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); |
| 187 | 183 | if ($nextNonEmpty === false) { |
| 188 | 184 | return; |
@@ -319,8 +315,7 @@ discard block |
||
| 319 | 315 | * |
| 320 | 316 | * @return void |
| 321 | 317 | */ |
| 322 | - public function processString(File $phpcsFile, $stackPtr, $tokens) |
|
| 323 | - { |
|
| 318 | + public function processString(File $phpcsFile, $stackPtr, $tokens) { |
|
| 324 | 319 | $tokenContentLc = strtolower($tokens[$stackPtr]['content']); |
| 325 | 320 | |
| 326 | 321 | /* |
@@ -368,8 +363,7 @@ discard block |
||
| 368 | 363 | * |
| 369 | 364 | * @return void |
| 370 | 365 | */ |
| 371 | - protected function addError(File $phpcsFile, $stackPtr, $content, $data) |
|
| 372 | - { |
|
| 366 | + protected function addError(File $phpcsFile, $stackPtr, $content, $data) { |
|
| 373 | 367 | $error = "Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)"; |
| 374 | 368 | $errorCode = $this->stringToErrorCode($content) . 'Found'; |
| 375 | 369 | $phpcsFile->addError($error, $stackPtr, $errorCode, $data); |
@@ -384,8 +378,7 @@ discard block |
||
| 384 | 378 | * |
| 385 | 379 | * @return bool |
| 386 | 380 | */ |
| 387 | - protected function isEndOfUseStatement($token) |
|
| 388 | - { |
|
| 381 | + protected function isEndOfUseStatement($token) { |
|
| 389 | 382 | return \in_array($token['code'], array(\T_CLOSE_CURLY_BRACKET, \T_SEMICOLON, \T_COMMA), true); |
| 390 | 383 | } |
| 391 | 384 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | * @package PHPCompatibility |
| 27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
| 28 | 28 | */ |
| 29 | -class DiscouragedSwitchContinueSniff extends Sniff |
|
| 30 | -{ |
|
| 29 | +class DiscouragedSwitchContinueSniff extends Sniff { |
|
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Token codes of control structures which can be targeted using continue. |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | * |
| 72 | 71 | * @return array |
| 73 | 72 | */ |
| 74 | - public function register() |
|
| 75 | - { |
|
| 73 | + public function register() { |
|
| 76 | 74 | $this->acceptedLevelTokens += Tokens::$arithmeticTokens; |
| 77 | 75 | $this->acceptedLevelTokens += Tokens::$emptyTokens; |
| 78 | 76 | |
@@ -88,8 +86,7 @@ discard block |
||
| 88 | 86 | * |
| 89 | 87 | * @return void |
| 90 | 88 | */ |
| 91 | - public function process(File $phpcsFile, $stackPtr) |
|
| 92 | - { |
|
| 89 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 93 | 90 | if ($this->supportsAbove('7.3') === false) { |
| 94 | 91 | return; |
| 95 | 92 | } |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | * @author Wim Godden <[email protected]> |
| 29 | 29 | * @copyright 2012 Cu.be Solutions bvba |
| 30 | 30 | */ |
| 31 | -class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff |
|
| 32 | -{ |
|
| 31 | +class ForbiddenBreakContinueVariableArgumentsSniff extends Sniff { |
|
| 33 | 32 | /** |
| 34 | 33 | * Error types this sniff handles for forbidden break/continue arguments. |
| 35 | 34 | * |
@@ -47,8 +46,7 @@ discard block |
||
| 47 | 46 | * |
| 48 | 47 | * @return array |
| 49 | 48 | */ |
| 50 | - public function register() |
|
| 51 | - { |
|
| 49 | + public function register() { |
|
| 52 | 50 | return array(\T_BREAK, \T_CONTINUE); |
| 53 | 51 | } |
| 54 | 52 | |
@@ -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->supportsAbove('5.4') === false) { |
| 67 | 64 | return; |
| 68 | 65 | } |
@@ -25,16 +25,14 @@ discard block |
||
| 25 | 25 | * @package PHPCompatibility |
| 26 | 26 | * @author Wim Godden <[email protected]> |
| 27 | 27 | */ |
| 28 | -class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff |
|
| 29 | -{ |
|
| 28 | +class ForbiddenSwitchWithMultipleDefaultBlocksSniff extends Sniff { |
|
| 30 | 29 | |
| 31 | 30 | /** |
| 32 | 31 | * Returns an array of tokens this test wants to listen for. |
| 33 | 32 | * |
| 34 | 33 | * @return array |
| 35 | 34 | */ |
| 36 | - public function register() |
|
| 37 | - { |
|
| 35 | + public function register() { |
|
| 38 | 36 | return array(\T_SWITCH); |
| 39 | 37 | } |
| 40 | 38 | |
@@ -47,8 +45,7 @@ discard block |
||
| 47 | 45 | * |
| 48 | 46 | * @return void |
| 49 | 47 | */ |
| 50 | - public function process(File $phpcsFile, $stackPtr) |
|
| 51 | - { |
|
| 48 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 52 | 49 | if ($this->supportsAbove('7.0') === false) { |
| 53 | 50 | return; |
| 54 | 51 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @package PHPCompatibility |
| 26 | 26 | * @author Juliette Reinders Folmer <[email protected]> |
| 27 | 27 | */ |
| 28 | -class ForbiddenBreakContinueOutsideLoopSniff extends Sniff |
|
| 29 | -{ |
|
| 28 | +class ForbiddenBreakContinueOutsideLoopSniff extends Sniff { |
|
| 30 | 29 | |
| 31 | 30 | /** |
| 32 | 31 | * Token codes of control structure in which usage of break/continue is valid. |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | * |
| 57 | 56 | * @return array |
| 58 | 57 | */ |
| 59 | - public function register() |
|
| 60 | - { |
|
| 58 | + public function register() { |
|
| 61 | 59 | return array( |
| 62 | 60 | \T_BREAK, |
| 63 | 61 | \T_CONTINUE, |
@@ -73,8 +71,7 @@ discard block |
||
| 73 | 71 | * |
| 74 | 72 | * @return void |
| 75 | 73 | */ |
| 76 | - public function process(File $phpcsFile, $stackPtr) |
|
| 77 | - { |
|
| 74 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 78 | 75 | $tokens = $phpcsFile->getTokens(); |
| 79 | 76 | $token = $tokens[$stackPtr]; |
| 80 | 77 | |
@@ -25,15 +25,13 @@ discard block |
||
| 25 | 25 | * @package PHPCompatibility |
| 26 | 26 | * @author Juliette Reinders Folmer <[email protected]> |
| 27 | 27 | */ |
| 28 | -class NewMultiCatchSniff extends Sniff |
|
| 29 | -{ |
|
| 28 | +class NewMultiCatchSniff extends Sniff { |
|
| 30 | 29 | /** |
| 31 | 30 | * Returns an array of tokens this test wants to listen for. |
| 32 | 31 | * |
| 33 | 32 | * @return array |
| 34 | 33 | */ |
| 35 | - public function register() |
|
| 36 | - { |
|
| 34 | + public function register() { |
|
| 37 | 35 | return array(\T_CATCH); |
| 38 | 36 | } |
| 39 | 37 | |
@@ -46,8 +44,7 @@ discard block |
||
| 46 | 44 | * |
| 47 | 45 | * @return void |
| 48 | 46 | */ |
| 49 | - public function process(File $phpcsFile, $stackPtr) |
|
| 50 | - { |
|
| 47 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 51 | 48 | if ($this->supportsBelow('7.0') === false) { |
| 52 | 49 | return; |
| 53 | 50 | } |
@@ -23,16 +23,14 @@ discard block |
||
| 23 | 23 | * @package PHPCompatibility |
| 24 | 24 | * @author Juliette Reinders Folmer <[email protected]> |
| 25 | 25 | */ |
| 26 | -class NewListInForeachSniff extends Sniff |
|
| 27 | -{ |
|
| 26 | +class NewListInForeachSniff extends Sniff { |
|
| 28 | 27 | |
| 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 | return array(\T_FOREACH); |
| 37 | 35 | } |
| 38 | 36 | |
@@ -45,8 +43,7 @@ discard block |
||
| 45 | 43 | * |
| 46 | 44 | * @return void |
| 47 | 45 | */ |
| 48 | - public function process(File $phpcsFile, $stackPtr) |
|
| 49 | - { |
|
| 46 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 50 | 47 | if ($this->supportsBelow('5.4') === false) { |
| 51 | 48 | return; |
| 52 | 49 | } |