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
Functions can't refine input types in Hack, meaning that if the argument to Str\is_empty is non-null, it won't get refined even if the function returns true. This means that the function is, effectively, not valuable, since checking for emptiness via === '' or a nullcheck is more explicit.
We've found this function in practice to confuse developers, who expect type refinement, so we may deprecate this function and suggest explicit equality checks instead.
The text was updated successfully, but these errors were encountered:
diffs up to start migration at FB; need to figure out the best way to do this with HHAST to deal with cases like Str\is_empty($foo[$bar][$baz] ?? null)
At FB, I'm adding a PHPism_FIXME::isEmptyStringOrNull() static method and using that for the non-trivial cases
Functions can't refine input types in Hack, meaning that if the argument to
Str\is_empty
is non-null, it won't get refined even if the function returns true. This means that the function is, effectively, not valuable, since checking for emptiness via=== ''
or a nullcheck is more explicit.We've found this function in practice to confuse developers, who expect type refinement, so we may deprecate this function and suggest explicit equality checks instead.
The text was updated successfully, but these errors were encountered: