Total Complexity | 3 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | final class ProviderSetProvider implements ProviderInterface |
||
16 | { |
||
17 | /** @var InjectionPointInterface */ |
||
18 | private $ip; |
||
19 | |||
20 | /** @var InjectorInterface */ |
||
21 | private $injector; |
||
22 | |||
23 | /** @var ParamReaderInterface<T> */ |
||
24 | private $reader; |
||
25 | |||
26 | /** |
||
27 | * @param ParamReaderInterface<T> $reader |
||
28 | */ |
||
29 | public function __construct( |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function get() |
||
43 | { |
||
44 | $param = $this->ip->getParameter(); |
||
45 | /** @var ?Set<object> $set */ |
||
46 | $set = $this->reader->getParametrAnnotation($param, Set::class); // @phpstan-ignore-line |
||
47 | if ($set === null) { |
||
48 | throw new SetNotFound((string) $this->ip->getParameter()); |
||
49 | } |
||
50 | |||
51 | return new class ($this->injector, $set) implements ProviderInterface |
||
|
|||
52 | { |
||
53 | /** @var InjectorInterface */ |
||
54 | private $injector; |
||
55 | |||
56 | /** @var Set<object> */ |
||
57 | private $set; |
||
58 | |||
59 | /** |
||
60 | * @param Set<object> $set |
||
61 | */ |
||
62 | public function __construct(InjectorInterface $injector, Set $set) |
||
63 | { |
||
64 | $this->injector = $injector; |
||
65 | $this->set = $set; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function get() |
||
74 | } |
||
75 | }; |
||
76 | } |
||
78 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: