| Total Lines | 28 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function get() |
||
| 36 | { |
||
| 37 | /** @var ?Set $set */ |
||
| 38 | $set = $this->reader->getParametrAnnotation($this->ip->getParameter(), Set::class); |
||
| 39 | if ($set === null) { |
||
| 40 | throw new SetNotFound((string) $this->ip->getParameter()); |
||
| 41 | } |
||
| 42 | |||
| 43 | return new class ($this->injector, $set) implements ProviderInterface |
||
|
|
|||
| 44 | { |
||
| 45 | /** @var InjectorInterface */ |
||
| 46 | private $injector; |
||
| 47 | |||
| 48 | /** @var Set */ |
||
| 49 | private $set; |
||
| 50 | |||
| 51 | public function __construct(InjectorInterface $injector, Set $set) |
||
| 52 | { |
||
| 53 | $this->injector = $injector; |
||
| 54 | $this->set = $set; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function get() |
||
| 61 | { |
||
| 62 | return $this->injector->getInstance($this->set->interface, $this->set->name); |
||
| 63 | } |
||
| 67 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: