1 | <?php declare(strict_types=1); |
||
11 | final class PhpCodeParser |
||
12 | { |
||
13 | /** @var Parser */ |
||
14 | private $parser; |
||
15 | |||
16 | /** @var NodeTraverser */ |
||
17 | private $nodeTraverser; |
||
18 | |||
19 | /** @var Printer */ |
||
20 | private $printer; |
||
21 | |||
22 | 1 | public function __construct(Parser $parser, NodeTraverser $nodeTraverser, Printer $printer) |
|
28 | |||
29 | 11 | public function parse(string $code): ParserResult |
|
44 | |||
45 | 11 | private function createVisitor(): NodeVisitor |
|
49 | } |
||
50 |
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.