The expression $name of type string|false is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== false instead.
In PHP, under loose comparison (like ==, or !=, or switch 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:
''==false// true''==null// true'ab'==false// false'ab'==null// false// It is often better to use strict comparison''===false// false''===null// false
Loading history...
25
if ($funcCall->getDocComment()) {
26
$phpdoc = new \phpDocumentor\Reflection\DocBlock($funcCall->getDocComment()->getText());
27
if ($phpdoc->hasTag('expected')) {
28
return true;
29
}
30
31
// return true;
32
}
33
34
$context->notice(
35
'debug.code',
36
sprintf('Function %s() is a debug code, please don`t use it in production.', $name),
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: