1 | <?php |
||
14 | class SyntaxHighlighter |
||
15 | { |
||
16 | /** |
||
17 | * @var \PhpParser\Parser |
||
18 | */ |
||
19 | private $parser; |
||
20 | |||
21 | /** |
||
22 | * @var SyntaxHighlightPrinter |
||
23 | */ |
||
24 | private $printer; |
||
25 | |||
26 | /** |
||
27 | * @param Parser $parser |
||
28 | * @param SyntaxHighlightPrinter $printer |
||
29 | */ |
||
30 | public function __construct(Parser $parser, SyntaxHighlightPrinter $printer) |
||
35 | |||
36 | /** |
||
37 | * @param string $code |
||
38 | * @return string |
||
39 | */ |
||
40 | public function highlight($code) |
||
53 | } |
||
54 |
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.