Total Lines | 32 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
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() |
||
72 | { |
||
73 | return $this->injector->getInstance($this->set->interface, $this->set->name); |
||
74 | } |
||
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: