Re: [RFC] Strict type hints (parameter and return value)
| From: | Felipe Pena | Date: | Fri, 18 Apr 2008 00:24:26 +0000 |
| Subject: | Re: [RFC] Strict type hints (parameter and return value) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37122@lists.php.net to get a copy of this message | ||
Em Qui, 2008-04-17 às 23:14 +0200, Lars Strojny escreveu:
> Hi Felipe,
>
> first of all, thanks for your proposal. I like it.
>
> Am Donnerstag, den 17.04.2008, 11:42 -0300 schrieb Felipe Pena:
> > Hi.
> >
> > Well, thinking better about the behavior of type hinting, i decided to
> > change the proposal for strict type. I.e. don't accept numeric string
> > as an intenger, etc.
> [...]
>
> I would also like to see scalar and numeric too, but that's just for the
> record.
> For ReflectionParameter I would like to see an additional
> ReflectionParameter::isType(string $type_name) to allow constructs like
> foreach (array("string", "integer") as $type)
> if (!$reflection_param->isType($type))
> throw new Exception();
I also thought that when adding the is<type> methods! :D
> What about additions in the ReflectionMethod-class? I would say adding
> ReflectionMethod::isInt(), ...::isDouble() and isType() would be
> appropriate.
Sure, should there be! Thanks for remember me.
But i think that is<type> as name is confuse in this case.
We need a name for that.
--
Regards,
Felipe Pena.