Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function toArray() |
||
37 | { |
||
38 | if ($this->value) { |
||
39 | if (is_numeric($this->value)) { |
||
40 | if ((int) $this->value == $this->value) { |
||
41 | $this->value = (int) $this->value; |
||
|
|||
42 | } else { |
||
43 | $this->value = (float) $this->value; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return array($this->name => $this->value); |
||
48 | } |
||
49 | |||
50 | $forms = array(); |
||
51 | foreach ($this->forms as $form) { |
||
52 | $forms = array_replace($forms, $form->toArray()); |
||
53 | } |
||
54 | |||
55 | return array($this->name => $forms); |
||
56 | } |
||
57 | } |
||
58 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.