On Mon, Dec 18, 2017 at 10:34 PM, Michael Moravec <php....@majkl578.cz>
wrote:

> Hello internals,
>
> I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3:
> https://wiki.php.net/rfc/mixed-typehint
>
> The purpose of this RFC is to introduce "mixed" typehint on language level
> to be used
> as a valid typehint.


If I'm not mistaken, "mixed" is used in documentation when a function has
been overloaded to avoid needing to have documentation for all the methods.
C allows overloading, and I imagine that PHP functions implemented in the
engine using C are using overloading.

To be honest, I'd rather see function overloading in PHP than this, but
that's a massive can of worms with a lot of problems on both the
implementation side and also on the usage side. Function overloading can be
abused to create some rather bizarre and difficult to follow code.  That
said, with PHP moving to be at least a little more strict about variable
types.

As to the proposal itself, I see no advantage over not using a typehint at
all.

More on overloading: https://en.wikipedia.org/wiki/Function_overloading

Reply via email to