1 | <?php |
||
28 | abstract class BaseVisitor implements Visitor |
||
29 | { |
||
30 | /** |
||
31 | * @var SourceCollection |
||
32 | */ |
||
33 | protected $collection; |
||
34 | |||
35 | /** |
||
36 | * @var SplFileInfo |
||
37 | */ |
||
38 | protected $file; |
||
39 | |||
40 | /** |
||
41 | * @var DocParser |
||
42 | */ |
||
43 | private $docParser; |
||
44 | |||
45 | 32 | public function init(SourceCollection $collection, SplFileInfo $file) |
|
50 | |||
51 | 29 | protected function getAbsoluteFilePath() |
|
55 | |||
56 | /** |
||
57 | * @param Node $node |
||
58 | * @param string $errorMessage |
||
59 | */ |
||
60 | 8 | protected function addError(Node $node, $errorMessage) |
|
81 | |||
82 | /** |
||
83 | * @param string $text |
||
84 | * @param int $line |
||
85 | * @param Node|null $node |
||
86 | * @param array $context |
||
87 | */ |
||
88 | 9 | protected function addLocation($text, $line, Node $node = null, array $context = []) |
|
96 | |||
97 | /** |
||
98 | * @param string $text |
||
99 | * @param int $line |
||
100 | * @param Node|null $node |
||
101 | * @param array $context |
||
102 | * |
||
103 | * @return SourceLocation|null |
||
104 | */ |
||
105 | 15 | protected function getLocation($text, $line, Node $node = null, array $context = []) |
|
121 | |||
122 | /** |
||
123 | * @return DocParser |
||
124 | */ |
||
125 | 5 | private function getDocParser() |
|
139 | |||
140 | /** |
||
141 | * @param DocParser $docParser |
||
142 | */ |
||
143 | public function setDocParser(DocParser $docParser) |
||
147 | } |
||
148 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: