Open iluuu1994 opened 2 years ago
I initially got the idea from https://wiki.php.net/rfc/coercive_sth which only affected scalar type declarations (and it rejects some other situations) but I felt rejecting only for type declarations was a bit weird. But what else other than type declarations would remain if we have an exception for these situations.
It is quite unfortunate that false
was use as an alternative to null
:-/ but it might indeed be too big of a break. Do you have a ballpark of internal test files affected?
In our test suite it seems pretty common to print/concat a falsy value. This makes me think these cases will be very common in userland code too. Doing something like this seems relatively harmless:
This comes back to the fact that we historically use
false
as an alternative tonull
. I think these changes are the worst offenders in the RFC at this point:.
echo
language constructprint
language constructI'm pretty sure this would be a major headache for a lot of people. We could theoretically only deprecate implicit coercion of
true
but that seems inconsistent. TBH my suggestion is inconsistent as well but I don't think going all the way is worth it.@Girgias WDYT?