Conditions | 3 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 4.125 |
Changes | 0 |
1 | <?php |
||
25 | 3 | public function __construct(\stdClass $attributes = null) |
|
26 | { |
||
27 | 3 | if (isset($attributes->AccountNumber)) { |
|
28 | $this->setAccountNumber($attributes->AccountNumber); |
||
29 | } |
||
30 | 3 | if (isset($attributes->CreditCard)) { |
|
31 | $this->setAccountNumber(new CreditCard($attributes->CreditCard)); |
||
|
|||
32 | } |
||
33 | 3 | } |
|
34 | |||
93 |
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: