@@ -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\Files; |
4 | 4 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function register(): array |
16 | 16 | { |
17 | - return [T_RETURN]; |
|
17 | + return [ T_RETURN ]; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | $returnTokenIndex = $stackPtr; |
31 | 31 | |
32 | 32 | $scope = array_slice($tokens, $returnTokenIndex, null, true); |
33 | - $semicolons = array_filter($scope, function ($token) { |
|
34 | - return $token['type'] === 'T_SEMICOLON'; |
|
33 | + $semicolons = array_filter($scope, function($token) { |
|
34 | + return $token[ 'type' ] === 'T_SEMICOLON'; |
|
35 | 35 | }); |
36 | 36 | |
37 | 37 | $returnValueIndex = key($semicolons) - 1; |
38 | 38 | $comparisonIndex = key($semicolons) - 3; |
39 | 39 | |
40 | - if ($scope[$returnValueIndex]['type'] === 'T_NULL' && $this->isComparisonType($scope[$comparisonIndex]['type']) === false) { |
|
40 | + if ($scope[ $returnValueIndex ][ 'type' ] === 'T_NULL' && $this->isComparisonType($scope[ $comparisonIndex ][ 'type' ]) === false) { |
|
41 | 41 | $error = "Return null value found."; |
42 | 42 | $phpcsFile->addError($error, $returnValueIndex, __CLASS__); |
43 | 43 | } |
@@ -45,6 +45,6 @@ discard block |
||
45 | 45 | |
46 | 46 | private function isComparisonType(string $type) : bool |
47 | 47 | { |
48 | - return in_array($type, ['T_IS_NOT_IDENTICAL', 'T_IS_IDENTICAL', 'T_IS_NOT_EQUAL', 'T_IS_EQUAL'], true); |
|
48 | + return in_array($type, [ 'T_IS_NOT_IDENTICAL', 'T_IS_IDENTICAL', 'T_IS_NOT_EQUAL', 'T_IS_EQUAL' ], true); |
|
49 | 49 | } |
50 | 50 | } |