1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace drupol\phpvfs\Exporter; |
||
6 | |||
7 | use drupol\phptree\Exporter\Ascii; |
||
8 | use drupol\phptree\Node\NodeInterface; |
||
9 | use drupol\phpvfs\Node\FilesystemNodeInterface; |
||
10 | |||
11 | /** |
||
12 | * Class AttributeAscii. |
||
13 | */ |
||
14 | final class AttributeAscii extends Ascii |
||
15 | { |
||
16 | /** |
||
17 | * @param \drupol\phptree\Node\NodeInterface $node |
||
18 | * The node. |
||
19 | * |
||
20 | * @return string |
||
21 | * The node representation. |
||
22 | */ |
||
23 | protected function getNodeRepresentation(NodeInterface $node): string |
||
24 | { |
||
25 | if ($node instanceof FilesystemNodeInterface) { |
||
26 | return $node->getAttribute('label'); |
||
27 | } |
||
0 ignored issues
–
show
|
|||
28 | } |
||
29 | } |
||
30 |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: