Re: [RFC] Type hints

From: Date: Tue, 11 May 2004 13:01:39 +0000
Subject: Re: [RFC] Type hints
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to internals+get-9813@lists.php.net to get a copy of this message
On Tue, 2004-05-11 at 14:36, Jason Garber wrote: > Consider this below: [...] > class UserClass{ > public static function forName($name, $c = NULL) { > if(is_null($c)) > //... > elseif($c instanceof ClassLoader) > //... > else > //Throw an error > } > } > > Using this method, you can easily solve the issue pointed out above, while > allowing the type hint to be strict. Jason, I know how to build a workaround; but this is just kludgy. Marcus complained in his original mail that he was "annoyed" by the fact of having to check on a type-hinted parameter being NULL. How about I suggest I'm annoyed about having to check non-type-hinted parameters in the way you suggested above? - Timm

« previous php.internals (#9813) next »