News for hackers. Stuff that matters.
Re:Whats New in PHP 8.2 by blowski on Monday April 25, 2022 @10:13AM (#31155076)
It's for backwards compatibility with functions that return either the expected value (maybe an array or a string) or false (never true). So you can use it in a union like `foo(): string|false {}`. In that sense, it's not a boolean because it will only ever be a string or false.
Re:Whats New in PHP 8.2 by tyingq on Monday April 25, 2022 @11:08AM (#31155929)
That makes sense, though you would want a linter or something to check that callers are doing "=== false" and not "== false", since falsy (but not false) values would match the latter.
Re:Whats New in PHP 8.2 by blowski on Monday April 25, 2022 @11:12AM (#31155993)
If you're using `==` in 2022 without testing or linting, this would be the least of your problems. Also, with the strict_types declaration, it wouldn't be coerced.
Re:Whats New in PHP 8.2 by tyingq on Monday April 25, 2022 @11:25AM (#31156194)
" == false" is sprinkled all over some pretty popular products, like Wordpress.