note 50443 deleted from language.oop5.typehinting by bjori

From: Date: Fri, 14 Apr 2006 14:58:28 +0000
Subject: note 50443 deleted from language.oop5.typehinting by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108083@lists.php.net to get a copy of this message
Note Submitter: ryo at shadowlair dot info ---- Although type-hinting prevents null values from being passed, setting a default null value is not a parse error. However, calling the function with a null parameter, or calling it without the parameter (thus using the default value) will result in a fatal error: <?php function foo(MyClass $object = null) { // this is a valid function definition } $o = new MyClass(); foo($o); foo(null); // fatal error foo(); // fatal error ?>

« previous php.notes (#108083) next »