Conditions | 3 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.0416 |
Changes | 0 |
1 | <?php |
||
55 | 3 | private function getContents($request): string |
|
56 | { |
||
57 | 3 | if ($request instanceof RequestInterface) { |
|
58 | 2 | return $request->getBody()->getContents(); |
|
59 | } |
||
60 | 1 | if (\is_string($request)) { |
|
61 | 1 | return $request; |
|
62 | } |
||
63 | throw new BadRequestException('Request must be instance of Psr\Http\Message\RequestInterface or string.'); |
||
64 | } |
||
66 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.