| Conditions | 5 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function add(Result $result) |
||
| 25 | { |
||
| 26 | switch (get_class($result)) { |
||
| 27 | case Error::class: |
||
| 28 | $this->addError($result); |
||
|
|
|||
| 29 | break; |
||
| 30 | case Failure::class: |
||
| 31 | $this->addFailure($result); |
||
| 32 | break; |
||
| 33 | case Created::class: |
||
| 34 | $this->addCreated($result); |
||
| 35 | break; |
||
| 36 | case Updated::class: |
||
| 37 | $this->addUpdated($result); |
||
| 38 | break; |
||
| 39 | default: |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 94 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.