Passed
Push — master ( c1662d...e44a52 )
by Fabien
01:53
created
src/Codor/Sniffs/Files/ReturnNullSniff.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.