1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace BEAR\Package\Provide\Logger; |
||
6 | |||
7 | use BEAR\AppMeta\AbstractAppMeta; |
||
8 | use Monolog\Handler\ErrorLogHandler; |
||
9 | use Monolog\Logger; |
||
10 | use Ray\Di\ProviderInterface; |
||
11 | |||
12 | /** @implements ProviderInterface<Logger> */ |
||
13 | class ProdMonologProvider implements ProviderInterface |
||
14 | { |
||
15 | public function __construct( |
||
16 | private AbstractAppMeta $appMeta, |
||
17 | ) { |
||
18 | } |
||
19 | 8 | ||
20 | public function get(): Logger |
||
21 | 8 | { |
|
22 | 8 | return new Logger($this->appMeta->name, [new ErrorLogHandler()]); |
|
0 ignored issues
–
show
|
|||
23 | } |
||
24 | } |
||
25 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: