RE: [PHP-DEV] Scalar Type Hints v0.4
| From: | François Laupretre | Date: | Wed, 18 Feb 2015 21:20:22 +0000 |
| Subject: | RE: [PHP-DEV] Scalar Type Hints v0.4 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83122@lists.php.net to get a copy of this message | ||
> De : Rowan Collins [mailto:rowan.collins@gmail.com]
>
> They'd use whatever (non-reserved) namespace the implementer wanted.
> e.g.
>
> namespace Symfony\Component\TypeChecking;
>
> basicType nonNegativeInt extends PHP\types\int {
> public function isValid(int $value) {
> return $value >= 0;
> }
> }
>
> basicType PositiveInt extends nonNegativeInt {
> public function isValid(nonNegativeInt $value) {
> return $value != 0;
> }
> }
Interesting. But, if I understand well, these are not classes, as they keep dealing with scalars. Or
we should create an OO API to scalars, which is a very complex project.
Regards
François