> > That is fine for code that is broken in the first place. Similarly we added > a warning some years back about array to string conversions. >
Code using instanceof on possible non-objects isn't broken. instanceof simply does an implicit is_object() check without needing an extra function call. I know that a change there would break Amp in quite a few places ( https://github.com/amphp/amp/search?utf8=%E2%9C%93&q=instanceof&type=) and I'm very sure that a lot of other applications would break, too. > The impact should be minimal as is, so persevering bc for broken usage is a > poor argument imo > Why is it broken? What's wrong with the implicit is_object() check? 1 instanceof XXX *is clearly broken* on the other hand, which can be statically verified to fail in all cases. Regards, Niklas