Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
17 | 20 | public function setItemCode( $itemcode ) |
|
18 | { |
||
19 | 20 | if ($itemcode instanceOf ItemCodeProviderInterface): |
|
20 | 4 | $this->itemcode = $itemcode->getItemCode(); |
|
21 | 16 | elseif ($itemcode instanceOf ItemCodeInterface): |
|
22 | 4 | $this->itemcode = $itemcode; |
|
23 | |||
24 | 12 | elseif (is_string($itemcode)): |
|
25 | // Convert string to ItemCode instance |
||
26 | 4 | $ni = new ItemCode; |
|
27 | 4 | $ni->setCode( $itemcode )->setName( $itemcode ); |
|
28 | |||
29 | 4 | $this->itemcode = $ni; |
|
|
|||
30 | |||
31 | else: |
||
32 | 8 | throw new InvalidItemCodeArgumentException("ItemCodeInterface or Item code string expected."); |
|
33 | endif; |
||
34 | |||
35 | 12 | return $this; |
|
36 | } |
||
37 | } |
||
38 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..