I think an interface would be more appropriate than allowing multiple class types. Null would be an implied value and you cant really type hint scalars due to php's dynamic type system.
If both classes don't subscribe to a defined interface, then all the code you would have to write to handle them would be no different than if you didn't specify the type hint in the first place. Bob -----Original Message----- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, October 18, 2004 7:33 PM To: Robert Silva Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DEV] Type hints with null default values On Mon, 2004-10-18 at 22:09, Robert Silva wrote: > Based on the issues you listed, how about: > > function Method((MyClass) $obj); > function Method([MyClass] $obj); > > Surrounding the class type in () or [] thereby marking it as optional. > Much like you would do when commenting a function to take an optional > parameter. I like this idea and just for the sake of consideration and to elaborate on it: function Method( [MyClass,YourClass,null,bool] $obj ); which would allow all of the above types as values for $obj. Which would allow a great deal of flexibility while retaining a good deal of readability. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php