1 | <?php |
||
18 | trait HasInheritance |
||
19 | { |
||
20 | /** |
||
21 | * @var array|string[] |
||
22 | */ |
||
23 | protected $parents = []; |
||
24 | |||
25 | /** |
||
26 | * @param string|TypeDefinition $type |
||
27 | * @return TypeDefinition |
||
28 | */ |
||
29 | abstract protected function fetch($type): TypeDefinition; |
||
30 | |||
31 | /** |
||
32 | * @return iterable|TypeDefinition[] |
||
33 | */ |
||
34 | public function getParents(): iterable |
||
40 | |||
41 | /** |
||
42 | * @param string $name |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function hasParent(string $name): bool |
||
49 | |||
50 | /** |
||
51 | * @param string $name |
||
52 | * @return null|TypeDefinition |
||
53 | */ |
||
54 | public function getParent(string $name): ?TypeDefinition |
||
58 | |||
59 | /** |
||
60 | * @param TypeDefinition|string ...$definitions |
||
61 | * @return ProvidesInheritance|$this |
||
62 | */ |
||
63 | public function extends(...$definitions): ProvidesInheritance |
||
73 | |||
74 | /** |
||
75 | * @param string|TypeDefinition $type |
||
76 | * @return bool |
||
77 | */ |
||
78 | public function isExtends($type): bool |
||
90 | } |
||
91 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.