| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Ray\AuraSqlModule; |
||
| 6 | |||
| 7 | use Aura\Sql\Profiler\Profiler; |
||
| 8 | use Override; |
||
| 9 | use Psr\Log\LoggerInterface; |
||
| 10 | use Ray\Di\Provider; |
||
| 11 | |||
| 12 | final class ProfilerProvider implements Provider |
||
|
0 ignored issues
–
show
|
|||
| 13 | { |
||
| 14 | public function __construct(private LoggerInterface $logger) |
||
| 15 | { |
||
| 16 | } |
||
| 17 | |||
| 18 | #[Override] |
||
| 19 | public function get(): Profiler |
||
| 20 | { |
||
| 21 | $profiler = new Profiler($this->logger); |
||
| 22 | $profiler->setLogFormat('{duration}: {function} {statement}:{values}'); |
||
| 23 | $profiler->setActive(true); |
||
| 24 | |||
| 25 | return $profiler; |
||
|
0 ignored issues
–
show
The expression
return $profiler returns the type Aura\Sql\Profiler\Profiler which is incompatible with the return type mandated by Ray\Di\ProviderInterface::get() of Ray\Di\T.
In the issue above, the returned value is violating the contract defined by the mentioned interface. Let's take a look at an example: interface HasName {
/** @return string */
public function getName();
}
class Name {
public $name;
}
class User implements HasName {
/** @return string|Name */
public function getName() {
return new Name('foo'); // This is a violation of the ``HasName`` interface
// which only allows a string value to be returned.
}
}
Loading history...
|
|||
| 26 | } |
||
| 27 | } |
||
| 28 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.