@@ -7,7 +7,7 @@ |
||
| 7 | 7 | |
| 8 | 8 | class NewInstanceSniff implements PHP_CodeSniffer_Sniff |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | + /** |
|
| 11 | 11 | * The forbidden strings this sniff looks for. |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Codor\Sniffs\Classes; |
| 4 | 4 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * The forbidden strings this sniff looks for. |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | - protected $keywords = ['And', '_and', 'Or', '_or']; |
|
| 14 | + protected $keywords = [ 'And', '_and', 'Or', '_or' ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Returns the token types that this sniff is interested in. |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function register(): array |
| 21 | 21 | { |
| 22 | - return [T_FUNCTION]; |
|
| 22 | + return [ T_FUNCTION ]; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
| 34 | 34 | { |
| 35 | 35 | $tokens = $phpcsFile->getTokens(); |
| 36 | - $functionName = $tokens[$stackPtr + 2]['content']; |
|
| 37 | - $token = $tokens[$stackPtr]; |
|
| 36 | + $functionName = $tokens[ $stackPtr + 2 ][ 'content' ]; |
|
| 37 | + $token = $tokens[ $stackPtr ]; |
|
| 38 | 38 | |
| 39 | - $start = $token['scope_opener']; |
|
| 40 | - $end = $token['scope_closer']; |
|
| 39 | + $start = $token[ 'scope_opener' ]; |
|
| 40 | + $end = $token[ 'scope_closer' ]; |
|
| 41 | 41 | |
| 42 | 42 | foreach (range($start, $end) as $index) { |
| 43 | - if ($tokens[$index]['type'] === 'T_NEW') { |
|
| 44 | - $phpcsFile->addWarning($this->getWarningMessage($functionName), $tokens[$index]['line'], __CLASS__); |
|
| 43 | + if ($tokens[ $index ][ 'type' ] === 'T_NEW') { |
|
| 44 | + $phpcsFile->addWarning($this->getWarningMessage($functionName), $tokens[ $index ][ 'line' ], __CLASS__); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |