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
instanceof now allows literals as the first operand, in which case the result is always false.
(Note: that last part is not necessarily true anymore now object instances can be assigned to constants, though more testing to see what is and isn't allowed and since when would be needed to be sure)
https://3v4l.org/OUOD5 seems to be as minimally reproducible an example as I could get of the behaviour.
Interestingly (to me) https://3v4l.org/CvTrH (not doing anything with the variable) would seem to be the thing that could cause most confusion for coders (note the 5.x versions not erroring without an access)
Class constants too, not surprisingly, but the PHP < 7.0 results may be surprising. This needs looking into: https://3v4l.org/q0PRG#veol
(note the 5.x versions not erroring without an access)
Same goes for with an access.
This, to me, is actually not surprising as prior to PHP 5.2, there were some issues with the type system causing keywords (like false, self etc) to be interpreted as class names. I suspect it may have something to do with that.
Hmm, I riffed on your example as empty output in that UI bothers me. I'm surprised to see it "working" (realistically just not erroring) in some 5.x versions. Thanks for the explain on why that is.
Is your feature request related to a problem?
(Note: that last part is not necessarily true anymore now object instances can be assigned to constants, though more testing to see what is and isn't allowed and since when would be needed to be sure)
Refs:
Describe the solution you'd like
A new sniff to detect code like the below:
The text was updated successfully, but these errors were encountered: