note 84526 deleted from language.oop5.typehinting by cmb
| From: | cmb@php.net | Date: | Sat, 10 Dec 2016 11:42:59 +0000 |
| Subject: | note 84526 deleted from language.oop5.typehinting by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208438@lists.php.net to get a copy of this message | ||
Note Submitter: comments at ignorethis netweblogic com
----
Note that you cannot add a type hint and give a default value, apart from arrays. You will get an
internal server error, or fatal error.
e.g.
<?php
//Wont work
function test(ObjName $obj = ''){
//.....
}
//Will work
function test(Array $obj = array()){
//.....
}
?>
Even if you have Daniel's implementation of type hinting, a string typehint will still not work
if you give it an empty string default too.