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 | 29 | public function init(SourceCollection $collection, SplFileInfo $file) |
|
46 | { |
||
47 | 29 | $this->collection = $collection; |
|
48 | 29 | $this->file = $file; |
|
49 | 29 | } |
|
50 | |||
51 | 26 | protected function getAbsoluteFilePath() |
|
52 | { |
||
53 | 26 | return $this->file->getRealPath(); |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param Node $node |
||
58 | * @param string $errorMessage |
||
59 | */ |
||
60 | 7 | 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 | 13 | protected function addLocation($text, $line, Node $node = null, array $context = []) |
|
96 | 2 | ||
97 | 2 | /** |
|
98 | * @param string $text |
||
99 | * @param int $line |
||
100 | * @param Node|null $node |
||
101 | * @param array $context |
||
102 | 13 | * |
|
103 | 13 | * @return SourceLocation|null |
|
104 | 13 | */ |
|
105 | protected function getLocation($text, $line, Node $node = null, array $context = []) |
||
121 | 4 | ||
122 | /** |
||
123 | * @return DocParser |
||
124 | */ |
||
125 | 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: