1 | <?php |
||
14 | class Parser { |
||
15 | |||
16 | /** @var Doku_Handler */ |
||
17 | protected $handler; |
||
18 | |||
19 | /** @var Lexer $lexer */ |
||
20 | protected $lexer; |
||
21 | |||
22 | /** @var ModeInterface[] $modes */ |
||
23 | protected $modes = array(); |
||
24 | |||
25 | /** @var bool mode connections may only be set up once */ |
||
26 | protected $connected = false; |
||
27 | |||
28 | /** |
||
29 | * dokuwiki\Parsing\Doku_Parser constructor. |
||
30 | * |
||
31 | * @param Doku_Handler $handler |
||
32 | */ |
||
33 | public function __construct(Doku_Handler $handler) { |
||
36 | |||
37 | /** |
||
38 | * Adds the base mode and initialized the lexer |
||
39 | * |
||
40 | * @param Base $BaseMode |
||
41 | */ |
||
42 | protected function addBaseMode($BaseMode) { |
||
49 | |||
50 | /** |
||
51 | * Add a new syntax element (mode) to the parser |
||
52 | * |
||
53 | * PHP preserves order of associative elements |
||
54 | * Mode sequence is important |
||
55 | * |
||
56 | * @param string $name |
||
57 | * @param ModeInterface $Mode |
||
58 | */ |
||
59 | public function addMode($name, ModeInterface $Mode) { |
||
66 | |||
67 | /** |
||
68 | * Connect all modes with each other |
||
69 | * |
||
70 | * This is the last step before actually parsing. |
||
71 | */ |
||
72 | protected function connectModes() { |
||
98 | |||
99 | /** |
||
100 | * Parses wiki syntax to instructions |
||
101 | * |
||
102 | * @param string $doc the wiki syntax text |
||
103 | * @return array instructions |
||
104 | */ |
||
105 | public function parse($doc) { |
||
127 | |||
128 | } |
||
129 |
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: