Conditions | 7 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | public function visitPhpFunctionCall(FuncCall $funcCall, Context $context) |
||
23 | { |
||
24 | $name = false; |
||
25 | |||
26 | if ($funcCall->name instanceof Name && !$funcCall->name->isFullyQualified()) { |
||
27 | $name = $funcCall->name->getFirst(); |
||
28 | } |
||
29 | |||
30 | if ($name && isset($this->map[$name])) { |
||
|
|||
31 | /** |
||
32 | * Exclusion via intval with 2 args intval($number, int $base = 10); |
||
33 | */ |
||
34 | if ($name == 'intval' && count($funcCall->args) > 1) { |
||
35 | return; |
||
36 | } |
||
37 | |||
38 | $context->notice( |
||
39 | 'fcall.cast', |
||
40 | sprintf('Please use (%s) cast instead of function call.', $this->map[$name]), |
||
41 | $funcCall |
||
42 | ); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: