Is the argument here that `void` is a supertype of everything?

@ellotheth Yeah, I don't get it ... :-( I I had a vote, I'd likely vote against that RFC. Seems unnecessary and confusing.

@ellotheth the argument is that because the original call returned nothing, nobody would be dumb enough to write:

if ($foo->returnsVoid()) { }

Therefore, returning anything won't break that code because nobody would be dumb to have written it in the first place!


@dshafik @ellotheth I feel like this is a great opportunity to remind everyone that "nobody would ever do that!" in software means "someone is ready to do it as soon as you push that new version, and they are licking their chops and rubbing a fork and knife together right now. You can see them"

@level2wizard @dshafik It's like Rule 34 for software development.


@ellotheth "Typescript does it" is not a good argument for something this bad

> denies methods to be overridden with different types in subclasses

but that's a feature

that's how overriding works, unless you can also override with a function that takes different arguments

@trickster YES. This really nifty (and already accepted) RFC to apply Liskov substitution principles to the PHP type system is also worth reading just for the explanation of How It Should Work:

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!