1 | <?php |
||
15 | final class ClassMetrics |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * @var PHP_CodeSniffer_File |
||
20 | */ |
||
21 | private $file; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $classPosition; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $tokens; |
||
32 | |||
33 | |||
34 | 2 | public function __construct(PHP_CodeSniffer_File $file, int $classPosition) |
|
40 | |||
41 | |||
42 | /** |
||
43 | * @return FALSE|int |
||
44 | */ |
||
45 | 2 | public function getLineDistanceBetweenClassAndLastUseStatement() |
|
56 | |||
57 | |||
58 | /** |
||
59 | * @return FALSE|int |
||
60 | */ |
||
61 | 2 | public function getLastUseStatementPosition() |
|
65 | |||
66 | |||
67 | /** |
||
68 | * @return FALSE|int |
||
69 | */ |
||
70 | 2 | public function getLineDistanceBetweenNamespaceAndFirstUseStatement() |
|
85 | |||
86 | |||
87 | /** |
||
88 | * @return FALSE|int |
||
89 | */ |
||
90 | 2 | public function getLineDistanceBetweenClassAndNamespace() |
|
102 | |||
103 | |||
104 | /** |
||
105 | * @return FALSE|int |
||
106 | */ |
||
107 | 2 | private function getClassPositionIncludingComment() |
|
116 | |||
117 | |||
118 | 2 | private function isInsideClass(int $position) : bool |
|
127 | |||
128 | } |
||
129 |
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.