@@ -28,16 +28,14 @@ discard block |
||
| 28 | 28 | * @author Ben Selby <[email protected]> |
| 29 | 29 | * @copyright 2012 Ben Selby |
| 30 | 30 | */ |
| 31 | -class NewShortTernarySniff extends Sniff |
|
| 32 | -{ |
|
| 31 | +class NewShortTernarySniff extends Sniff { |
|
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | 34 | * Returns an array of tokens this test wants to listen for. |
| 36 | 35 | * |
| 37 | 36 | * @return array |
| 38 | 37 | */ |
| 39 | - public function register() |
|
| 40 | - { |
|
| 38 | + public function register() { |
|
| 41 | 39 | return array(\T_INLINE_THEN); |
| 42 | 40 | } |
| 43 | 41 | |
@@ -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('5.2') === false) { |
| 56 | 53 | return; |
| 57 | 54 | } |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @since 9.2.0 |
| 34 | 34 | */ |
| 35 | -class ChangedConcatOperatorPrecedenceSniff extends Sniff |
|
| 36 | -{ |
|
| 35 | +class ChangedConcatOperatorPrecedenceSniff extends Sniff { |
|
| 37 | 36 | |
| 38 | 37 | /** |
| 39 | 38 | * List of tokens with a lower operator precedence than concatenation in PHP >= 8.0. |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | * |
| 62 | 61 | * @return array |
| 63 | 62 | */ |
| 64 | - public function register() |
|
| 65 | - { |
|
| 63 | + public function register() { |
|
| 66 | 64 | return array( |
| 67 | 65 | \T_PLUS, |
| 68 | 66 | \T_MINUS, |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * |
| 81 | 79 | * @return void |
| 82 | 80 | */ |
| 83 | - public function process(File $phpcsFile, $stackPtr) |
|
| 84 | - { |
|
| 81 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 85 | 82 | if ($this->supportsAbove('7.4') === false) { |
| 86 | 83 | return; |
| 87 | 84 | } |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * @package PHPCompatibility |
| 28 | 28 | * @author Wim Godden <[email protected]> |
| 29 | 29 | */ |
| 30 | -class ForbiddenNegativeBitshiftSniff extends Sniff |
|
| 31 | -{ |
|
| 30 | +class ForbiddenNegativeBitshiftSniff extends Sniff { |
|
| 32 | 31 | /** |
| 33 | 32 | * Potential end tokens for which the end pointer has to be set back by one. |
| 34 | 33 | * |
@@ -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 | return array( |
| 56 | 54 | \T_SL, |
| 57 | 55 | \T_SL_EQUAL, |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | * |
| 70 | 68 | * @return void |
| 71 | 69 | */ |
| 72 | - public function process(File $phpcsFile, $stackPtr) |
|
| 73 | - { |
|
| 70 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 74 | 71 | if ($this->supportsAbove('7.0') === false) { |
| 75 | 72 | return; |
| 76 | 73 | } |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @since 9.2.0 |
| 29 | 29 | */ |
| 30 | -class RemovedTernaryAssociativitySniff extends Sniff |
|
| 31 | -{ |
|
| 30 | +class RemovedTernaryAssociativitySniff extends Sniff { |
|
| 32 | 31 | |
| 33 | 32 | /** |
| 34 | 33 | * List of tokens with a lower operator precedence than ternary. |
@@ -53,8 +52,7 @@ discard block |
||
| 53 | 52 | * |
| 54 | 53 | * @return array |
| 55 | 54 | */ |
| 56 | - public function register() |
|
| 57 | - { |
|
| 55 | + public function register() { |
|
| 58 | 56 | return array(\T_INLINE_THEN); |
| 59 | 57 | } |
| 60 | 58 | |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | * |
| 70 | 68 | * @return void |
| 71 | 69 | */ |
| 72 | - public function process(File $phpcsFile, $stackPtr) |
|
| 73 | - { |
|
| 70 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 74 | 71 | if ($this->supportsAbove('7.4') === false) { |
| 75 | 72 | return; |
| 76 | 73 | } |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | * @author Wim Godden <[email protected]> |
| 22 | 22 | * @copyright 2013 Cu.be Solutions bvba |
| 23 | 23 | */ |
| 24 | -class NewOperatorsSniff extends AbstractNewFeatureSniff |
|
| 25 | -{ |
|
| 24 | +class NewOperatorsSniff extends AbstractNewFeatureSniff { |
|
| 26 | 25 | |
| 27 | 26 | /** |
| 28 | 27 | * A list of new operators, not present in older versions. |
@@ -125,8 +124,7 @@ discard block |
||
| 125 | 124 | * |
| 126 | 125 | * @return array |
| 127 | 126 | */ |
| 128 | - public function register() |
|
| 129 | - { |
|
| 127 | + public function register() { |
|
| 130 | 128 | $tokens = array(); |
| 131 | 129 | foreach ($this->newOperators as $token => $versions) { |
| 132 | 130 | if (\defined($token)) { |
@@ -148,8 +146,7 @@ discard block |
||
| 148 | 146 | * |
| 149 | 147 | * @return void |
| 150 | 148 | */ |
| 151 | - public function process(File $phpcsFile, $stackPtr) |
|
| 152 | - { |
|
| 149 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 153 | 150 | $tokens = $phpcsFile->getTokens(); |
| 154 | 151 | $tokenType = $tokens[$stackPtr]['type']; |
| 155 | 152 | |
@@ -190,8 +187,7 @@ discard block |
||
| 190 | 187 | * |
| 191 | 188 | * @return array Version and other information about the item. |
| 192 | 189 | */ |
| 193 | - public function getItemArray(array $itemInfo) |
|
| 194 | - { |
|
| 190 | + public function getItemArray(array $itemInfo) { |
|
| 195 | 191 | return $this->newOperators[$itemInfo['name']]; |
| 196 | 192 | } |
| 197 | 193 | |
@@ -201,8 +197,7 @@ discard block |
||
| 201 | 197 | * |
| 202 | 198 | * @return array |
| 203 | 199 | */ |
| 204 | - protected function getNonVersionArrayKeys() |
|
| 205 | - { |
|
| 200 | + protected function getNonVersionArrayKeys() { |
|
| 206 | 201 | return array('description'); |
| 207 | 202 | } |
| 208 | 203 | |
@@ -215,8 +210,7 @@ discard block |
||
| 215 | 210 | * |
| 216 | 211 | * @return array |
| 217 | 212 | */ |
| 218 | - public function getErrorInfo(array $itemArray, array $itemInfo) |
|
| 219 | - { |
|
| 213 | + public function getErrorInfo(array $itemArray, array $itemInfo) { |
|
| 220 | 214 | $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); |
| 221 | 215 | $errorInfo['description'] = $itemArray['description']; |
| 222 | 216 | |
@@ -233,8 +227,7 @@ discard block |
||
| 233 | 227 | * |
| 234 | 228 | * @return array |
| 235 | 229 | */ |
| 236 | - protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) |
|
| 237 | - { |
|
| 230 | + protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { |
|
| 238 | 231 | $data[0] = $errorInfo['description']; |
| 239 | 232 | return $data; |
| 240 | 233 | } |
@@ -248,8 +241,7 @@ discard block |
||
| 248 | 241 | * |
| 249 | 242 | * @return bool |
| 250 | 243 | */ |
| 251 | - private function isTCoalesceEqual($tokens, $stackPtr) |
|
| 252 | - { |
|
| 244 | + private function isTCoalesceEqual($tokens, $stackPtr) { |
|
| 253 | 245 | if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) { |
| 254 | 246 | // Function called for wrong token or token has no predecesor. |
| 255 | 247 | return false; |
@@ -275,8 +267,7 @@ discard block |
||
| 275 | 267 | * |
| 276 | 268 | * @return bool |
| 277 | 269 | */ |
| 278 | - private function isTCoalesce($tokens, $stackPtr) |
|
| 279 | - { |
|
| 270 | + private function isTCoalesce($tokens, $stackPtr) { |
|
| 280 | 271 | if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) { |
| 281 | 272 | // Function called for wrong token or token has no predecesor. |
| 282 | 273 | return false; |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @package PHPCompatibility |
| 33 | 33 | * @author Juliette Reinders Folmer <[email protected]> |
| 34 | 34 | */ |
| 35 | -class LowPHPCSSniff extends Sniff |
|
| 36 | -{ |
|
| 35 | +class LowPHPCSSniff extends Sniff { |
|
| 37 | 36 | /** |
| 38 | 37 | * The minimum supported PHPCS version. |
| 39 | 38 | * |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * |
| 70 | 69 | * @return array |
| 71 | 70 | */ |
| 72 | - public function register() |
|
| 73 | - { |
|
| 71 | + public function register() { |
|
| 74 | 72 | return array( |
| 75 | 73 | \T_OPEN_TAG, |
| 76 | 74 | ); |
@@ -86,8 +84,7 @@ discard block |
||
| 86 | 84 | * @return int|void Integer stack pointer to skip forward or void to continue |
| 87 | 85 | * normal file processing. |
| 88 | 86 | */ |
| 89 | - public function process(File $phpcsFile, $stackPtr) |
|
| 90 | - { |
|
| 87 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 91 | 88 | // Don't do anything if the warning has already been thrown or is not necessary. |
| 92 | 89 | if ($this->examine === false) { |
| 93 | 90 | return ($phpcsFile->numTokens + 1); |
@@ -47,8 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @since 9.1.0 |
| 49 | 49 | */ |
| 50 | -class ForbiddenThisUseContextsSniff extends Sniff |
|
| 51 | -{ |
|
| 50 | +class ForbiddenThisUseContextsSniff extends Sniff { |
|
| 52 | 51 | |
| 53 | 52 | /** |
| 54 | 53 | * OO scope tokens. |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | * |
| 97 | 96 | * @return array |
| 98 | 97 | */ |
| 99 | - public function register() |
|
| 100 | - { |
|
| 98 | + public function register() { |
|
| 101 | 99 | if (\defined('T_ANON_CLASS')) { |
| 102 | 100 | $this->ooScopeTokens['T_ANON_CLASS'] = \T_ANON_CLASS; |
| 103 | 101 | } |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | * |
| 126 | 124 | * @return void |
| 127 | 125 | */ |
| 128 | - public function process(File $phpcsFile, $stackPtr) |
|
| 129 | - { |
|
| 126 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 130 | 127 | if ($this->supportsAbove('7.1') === false) { |
| 131 | 128 | return; |
| 132 | 129 | } |
@@ -303,8 +300,7 @@ discard block |
||
| 303 | 300 | * |
| 304 | 301 | * @return void |
| 305 | 302 | */ |
| 306 | - protected function isThisUsedAsParameter(File $phpcsFile, $stackPtr) |
|
| 307 | - { |
|
| 303 | + protected function isThisUsedAsParameter(File $phpcsFile, $stackPtr) { |
|
| 308 | 304 | if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) !== false) { |
| 309 | 305 | return; |
| 310 | 306 | } |
@@ -355,8 +351,7 @@ discard block |
||
| 355 | 351 | * |
| 356 | 352 | * @return void |
| 357 | 353 | */ |
| 358 | - protected function isThisUsedOutsideObjectContext(File $phpcsFile, $stackPtr) |
|
| 359 | - { |
|
| 354 | + protected function isThisUsedOutsideObjectContext(File $phpcsFile, $stackPtr) { |
|
| 360 | 355 | $tokens = $phpcsFile->getTokens(); |
| 361 | 356 | |
| 362 | 357 | if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { |
@@ -26,15 +26,13 @@ discard block |
||
| 26 | 26 | * @package PHPCompatibility |
| 27 | 27 | * @author Juliette Reinders Folmer <[email protected]> |
| 28 | 28 | */ |
| 29 | -class NewUniformVariableSyntaxSniff extends Sniff |
|
| 30 | -{ |
|
| 29 | +class NewUniformVariableSyntaxSniff extends Sniff { |
|
| 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_VARIABLE); |
| 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 | } |
@@ -26,16 +26,14 @@ discard block |
||
| 26 | 26 | * @package PHPCompatibility |
| 27 | 27 | * @author Wim Godden <[email protected]> |
| 28 | 28 | */ |
| 29 | -class ForbiddenGlobalVariableVariableSniff extends Sniff |
|
| 30 | -{ |
|
| 29 | +class ForbiddenGlobalVariableVariableSniff 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(\T_GLOBAL); |
| 40 | 38 | } |
| 41 | 39 | |
@@ -48,8 +46,7 @@ discard block |
||
| 48 | 46 | * |
| 49 | 47 | * @return void |
| 50 | 48 | */ |
| 51 | - public function process(File $phpcsFile, $stackPtr) |
|
| 52 | - { |
|
| 49 | + public function process(File $phpcsFile, $stackPtr) { |
|
| 53 | 50 | if ($this->supportsAbove('7.0') === false) { |
| 54 | 51 | return; |
| 55 | 52 | } |