Re: Mixed type-hint
| From: | Robert Korulczyk | Date: | Fri, 08 Feb 2019 12:13:24 +0000 |
| Subject: | Re: Mixed type-hint | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104311@lists.php.net to get a copy of this message | ||
Sounds like an arbitrary interpretation. Treating `?mixed" as "top type" (including
null) would be more practical and consistent with other type-hints.
Regards,
Robert Korulczyk
W dniu 08.02.2019 o 12:47, Marco Pivetta pisze:
>
mixed is the "top" type, which means that it contains
> anything at all. See https://en.wikipedia.org/wiki/Top_type
>
> On Fri, 8 Feb 2019, 12:45 Robert Korulczyk <robert@korulczyk.pl
> <mailto:robert@korulczyk.pl> wrote:
>
> What definition?
>
> Regards,
> Robert Korulczyk
>
> W dniu 08.02.2019 o 12:37, Marco Pivetta pisze:
> > Mixed includes null by definition.
> >
> > On Fri, 8 Feb 2019, 12:21 Robert Korulczyk <robert@korulczyk.pl
> > <mailto:robert@korulczyk.pl>
> > <mailto:robert@korulczyk.pl
> <mailto:robert@korulczyk.pl>> wrote:
> >
> > > Without this, the mixed type-hint is basically meaningless noise, is it
> > > not? About as effective is a doc-block?
> >
> > This mixed type seems to be meaningless by design since its main goal is to
> >work the same as if it was no type-hint at all...
> >
> > Another thing is that including null as part of mixed is not very pragmatic -
> >mixed could be used to disallow null, so it will actually work
> for type
> > check.
> >
> >
> >
> > Regards,
> > Robert Korulczyk
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit:
> >http://www.php.net/unsub.php
> >
>