1 | <?php |
||
24 | class ParamsExpander |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Expand params to annotation values. |
||
29 | * When annotation is used with multi top values, this will help assign this values to annotation. |
||
30 | * Examples of multi valued params include: |
||
31 | * <ul> |
||
32 | * <li>@Annotation(Class\Literal, 2)</li> |
||
33 | * <li>@Annotation(class = Class\Literal, items = 2)</li> |
||
34 | * </ul> |
||
35 | * Example of use: |
||
36 | * ParamsExpander::expand($annotation, ['class', 'items']) |
||
37 | * This will assign `$annotation->class` and `$annotation->items` with named or anonymous params (based on order of params). |
||
38 | * @param AnnotationInterface $annotation |
||
39 | * @param string[] $params List of parameters names in order. |
||
40 | * @param mixed[] $values Values used to expand params, if not set `$annotation->value` will be used if available. |
||
41 | * @return mixed[] Expanded params |
||
42 | */ |
||
43 | 2 | public static function expand(AnnotationInterface $annotation, $params, $values = []) |
|
69 | |||
70 | } |
||
71 |
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: