| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function testForObject() |
||
| 39 | { |
||
| 40 | $this |
||
| 41 | ->given($cause = new \Exception('some cause')) |
||
| 42 | ->when($exception = SerializationException::forObject('foo', $cause)) |
||
|
|
|||
| 43 | ->then() |
||
| 44 | ->object($exception) |
||
| 45 | ->isInstanceOf(SerializationException::class) |
||
| 46 | ->integer($exception->getCode()) |
||
| 47 | ->isEqualTo(0) |
||
| 48 | ->object($exception->getPrevious()) |
||
| 49 | ->isIdenticalTo($cause) |
||
| 50 | ; |
||
| 51 | |||
| 52 | $this |
||
| 53 | ->given($exception = SerializationException::forObject('bar')) |
||
| 54 | ->then() |
||
| 55 | ->variable($exception->getPrevious()) |
||
| 56 | ->isNull() |
||
| 57 | ; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: