On 10 December 2017 11:05:23 GMT+00:00, Niklas Keller <m...@kelunik.com> wrote: >> >> This. There's nothing undefinable about "1 instanceof \stdClass", >the >> clear and obvious answer is: "No, it's not an instance of \stdClass, >> it's an integer." The runtime result of false makes sense, the >> compile time error doesn't. Let's relax the compile time error (fold >> it into a const false if you truly must) and call it done. There's >no >> need to be hostile to users just because the code *seems* silly. >> > >This code doesn't just *seem* silly. For everything but testing whether >it >works it is totally useless.
It's useless, but also harmless. Unless anyone can think of a scenario where someone would do this by mistake intending to do something else? >But we might turn the fatal error into a warning like we do it for >"use" in >the global namespace: https://3v4l.org/ph7KW I feel like both that example and the case we're discussing should be a notice at most; it's not telling me my code is broken, just that some of it's unnecessary. Maybe I've decided it makes my code more self-documenting, and don't care that the compiler thinks I'm dumb. Adding warnings has a "boy who cried wolf" cost: if people get used to ignoring ones they disagree with, they'll miss ones that are genuine problems. Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php