Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function getPostConstructMethod(WeavedInterface $weavedInstance): string |
||
39 | { |
||
40 | $methods = unserialize($weavedInstance->methodAnnotations); |
||
|
|||
41 | if (!is_array($methods)) { |
||
42 | return ''; |
||
43 | } |
||
44 | foreach ($methods as $method => $annotations) { |
||
45 | foreach ($annotations as $annotation) { |
||
46 | if ($annotation instanceof PostConstruct) { |
||
47 | return $method; |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 | |||
52 | return ''; |
||
53 | } |
||
54 | } |
||
55 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: