Hello Johannes, Thursday, February 5, 2009, 8:02:47 PM, you wrote:
> On Thu, 2009-02-05 at 10:36 -0800, Sebastian Bergmann wrote: >> Johannes Schlüter wrote: >> > - No typehint, as it is now, #47206 "Expected / to be documented", >> > incompatible with 5.2.6-5.2.8 but compatible with most other 5.2 >> > versions >> >> Could we extend the arginfo system to allow for multiple typehints? Of >> course the Reflection API would have to support this :-/ > Of course we could, we'd "just" have to change a structure and > zend_verify_arg_class_kind() and of course the language syntax to allow > something like "function foo(A|B $bar) {}" but this still would mean to > break source compatibility in a bad way here as the user's code would > have to follow the signature and won't be able to be 5.2 and 5.3 > compatible in one file. I actually think we only need this as an internal option and not for reflection. For user code and reflection we would want to add support for plain object (any class) type hinting - oh wait I said that before. Right, my suggestion was to di: function foo(Class $object) {} It got rejected becuase I used the existing keyword ;class' rather then inventing a new one that will in any case create a massive amount of new issues (as with any new keyword). The only wayt out would be using magic indication, as in two underscores. For instance: function foo(__Object__ $object) {} Internally this obviously requires a change of the API and needs to be done now, prior to 5.3.0. For internal functions, we can get more precise, by providing a new 'i' option in zend_parse_args. That would take the allowed classes from a zend_class_entry**, with the last one being NULL. (But well, it anyway already got rejected. So I guess we just live with the problems. And changing it now would come with the risk of another delay, which would of course be the worst thing ever). Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php