You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since getting a non-existing element in KPHP leads to different results ("empty value of array type element" instead of null), people sometimes tend to write code like this:
$v = isset($data['k']) ? $data['k'] : '';
if ($v !== '') { // <- warning here
}
It makes sure that for both KPHP and PHP this code could behave identically.
But it looks like KPHP does not recognize this idiom.
Do we have any hints for this case (for example, !empty($v), etc.)?
In that case, we could suggest a potential fix to the problem inside the warning message.
Is it practical to improve this particular diagnostic so it doesn't report such cases?
The text was updated successfully, but these errors were encountered:
Since getting a non-existing element in KPHP leads to different results ("empty value of array type element" instead of null), people sometimes tend to write code like this:
It makes sure that for both KPHP and PHP this code could behave identically.
But it looks like KPHP does not recognize this idiom.
Do we have any hints for this case (for example,
!empty($v)
, etc.)?In that case, we could suggest a potential fix to the problem inside the warning message.
Is it practical to improve this particular diagnostic so it doesn't report such cases?
The text was updated successfully, but these errors were encountered: