Re: RFC: Type hinting revisited for PHP 5.3
| From: | Stanislav Malyshev | Date: | Wed, 01 Jul 2009 22:04:56 +0000 |
| Subject: | Re: RFC: Type hinting revisited for PHP 5.3 | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44613@lists.php.net to get a copy of this message | ||
Hi!
You are wrong. Internal type hinting is done in the form of argument information.You are confusing arginfo's with zend_parse_parameters types. They work differently (class typehints are strict, because there's no way to convert classes from one type to another). These aren't even the same types - all objects have the same internal type, IS_OBJECT, so it works on entirely different level.
The current patch is missing a ZEND_ARG_STRING_INFO(0, argumentName, 0) which would be the same as fnuction foo(string $argumentName){}That doesn't exist and wouldn't exist for currently available functions since making internal functions do that (strict type matching) would be a huge code breakage.
zend_parse_parameters(... abcdefg) is the same as function($a, $b, $c..) { $a = (int) $a; $b = (string) $b; $c = (array) $c...}Now it is, but that's not the way typehints work in the proposed patch. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com