Re: [RFC] Strict type hints (parameter and return value)
| From: | Lars Strojny | Date: | Thu, 17 Apr 2008 21:14:28 +0000 |
| Subject: | Re: [RFC] Strict type hints (parameter and return value) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37120@lists.php.net to get a copy of this message | ||
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();
What about additions in the ReflectionMethod-class? I would say adding
ReflectionMethod::isInt(), ...::isDouble() and isType() would be
appropriate.
cu, Lars
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc