Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function testInt() |
||
15 | { |
||
16 | $model = new BooleanBehaviorMock(); |
||
17 | $model->intValue = '1'; |
||
|
|||
18 | $model->validate(); |
||
19 | $this->assertTrue($model->intValue === 1); |
||
20 | |||
21 | $model->intValue = true; |
||
22 | $model->validate(); |
||
23 | $this->assertTrue($model->intValue === 1); |
||
24 | |||
25 | $model->intValue = 'true'; |
||
26 | $model->validate(); |
||
27 | $this->assertTrue($model->intValue === 1); |
||
28 | } |
||
29 | |||
45 | } |
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.