1 | <?php |
||
16 | class BasicNavigation implements Navigation |
||
17 | { |
||
18 | const DEFAULT_MAX_LEVEL = 3; |
||
19 | |||
20 | /** @var NavigationItem[] */ |
||
21 | private $ancestors = []; |
||
22 | /** @var NavigationItem */ |
||
23 | private $current = null; |
||
24 | /** @var int */ |
||
25 | private $maxLevel; |
||
26 | /** @var RootNavigationItem */ |
||
27 | private $root; |
||
28 | |||
29 | public function __construct(RootNavigationItem $root, Matcher $matcher, int $maxLevel = self::DEFAULT_MAX_LEVEL) |
||
35 | |||
36 | public function getRoot() |
||
40 | |||
41 | /** |
||
42 | * @param NavigationItem $item |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function isAncestor(NavigationItem $item): bool |
||
52 | |||
53 | /** |
||
54 | * @param NavigationItem $item |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function isCurrent(NavigationItem $item): bool |
||
61 | |||
62 | /** |
||
63 | * @return array |
||
64 | */ |
||
65 | public function getBreadcrumbs(): array |
||
69 | |||
70 | /** |
||
71 | * @return NavigationItem |
||
72 | * @throws CurrentItemNotMatchedException |
||
73 | */ |
||
74 | public function getCurrent(): NavigationItem |
||
82 | |||
83 | /** |
||
84 | * @param Item $item |
||
85 | * @param Matcher $matcher |
||
86 | * @param int $depth |
||
87 | * @return Item|null |
||
88 | */ |
||
89 | private function process(Item &$item, Matcher &$matcher, int $depth = 0) |
||
118 | } |
||
119 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.