1 | <?php |
||
24 | final class FinalInterfaceSniff implements PHP_CodeSniffer_Sniff |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | const NAME = 'ZenifyCodingStandard.Classes.FinalInterface'; |
||
31 | |||
32 | /** |
||
33 | * @var PHP_CodeSniffer_File |
||
34 | */ |
||
35 | private $file; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $position; |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @return int[] |
||
45 | */ |
||
46 | 2 | public function register() : array |
|
50 | |||
51 | |||
52 | /** |
||
53 | * @param PHP_CodeSniffer_File $file |
||
54 | * @param int $position |
||
55 | */ |
||
56 | 2 | public function process(PHP_CodeSniffer_File $file, $position) |
|
79 | |||
80 | |||
81 | /** |
||
82 | * @return bool |
||
83 | */ |
||
84 | 2 | private function implementsInterface() |
|
88 | |||
89 | |||
90 | /** |
||
91 | * @return bool |
||
92 | */ |
||
93 | 2 | private function isFinalOrAbstractClass() |
|
98 | |||
99 | |||
100 | /** |
||
101 | * @return bool |
||
102 | */ |
||
103 | 2 | private function isDoctrineEntity() |
|
123 | |||
124 | |||
125 | 1 | public function addFinalToClass(int $position) |
|
129 | |||
130 | } |
||
131 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.