The expression $expanded 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...
52
$aliased->$expanded = $value;
53
return true;
54
}
55
56
return false;
57
}
58
59
/**
60
* Expands an alias into its respective object property name.
61
*
62
* @param string $key Alias key
63
*
64
* @return string|false The expanded alias, or false no alias exists for the key.
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: