Marcus Boerger wrote: > Their usage means you can rely on the fact that a certain class type > or interface is present. That means i could agree to have a way to > mark typehinted values as optional
I second that. NULL (or anything else than object of the hinted type) is not an option. But the ability to declared a typehinted parameter as optional is something I really need. In PHPUnit2 I have several occurences of the following workaround: public function run($result = NULL) { if ($result === NULL) { $result = $this->createResult(); } // XXX: Workaround for missing ability to // declare type-hinted parameters as optional. else if (!($result instanceof PHPUnit2_Framework_TestResult)) { throw new Exception( 'Argument 1 must be an instance of PHPUnit2_Framework_TestResult.' ); } // ... } -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php