bearsunday /
BEAR.Package
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace BEAR\Package\Provide\Router; |
||
| 6 | |||
| 7 | use BEAR\Sunday\Extension\Router\RouterInterface; |
||
| 8 | use Override; |
||
| 9 | use Ray\Di\Di\Named; |
||
| 10 | use Ray\Di\ProviderInterface; |
||
| 11 | |||
| 12 | /** @implements ProviderInterface<RouterCollection> */ |
||
| 13 | final class RouterCollectionProvider implements ProviderInterface |
||
| 14 | { |
||
| 15 | public function __construct( |
||
| 16 | #[Named('primary_router')] |
||
| 17 | private RouterInterface $primaryRouter, |
||
| 18 | private WebRouterInterface $webRouter, |
||
| 19 | ) { |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritDoc} |
||
| 24 | */ |
||
| 25 | #[Override] |
||
| 26 | public function get(): RouterCollection |
||
| 27 | { |
||
| 28 | return new RouterCollection([$this->primaryRouter, $this->webRouter]); |
||
|
0 ignored issues
–
show
|
|||
| 29 | } |
||
| 30 | } |
||
| 31 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: