| Conditions | 3 |
| Paths | 4 |
| Total Lines | 7 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 41 | public function get(): ExtendedPdoInterface |
||
| 42 | { |
||
| 43 | $connectionLocator = $this->injector->getInstance(ConnectionLocatorInterface::class, $this->context); |
||
| 44 | assert($connectionLocator instanceof ConnectionLocatorInterface); |
||
| 45 | $isGetRequest = isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET'; |
||
| 46 | |||
| 47 | return $isGetRequest ? $connectionLocator->getRead() : $connectionLocator->getWrite(); |
||
|
|
|||
| 48 | } |
||
| 50 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: