note 84526 added to language.oop5.typehinting
| From: | commentsatignorethisnetweblogiccom at osu1 dot php dot net | Date: | Thu, 17 Jul 2008 14:39:44 +0000 |
| Subject: | note 84526 added to language.oop5.typehinting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141628@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 194.153.94.10
Probable Submitter: 81.37.117.140
----
Manual Page -- http://www.php.net/manual/en/language.oop5.typehinting.php
Edit -- https://master.php.net/note/edit/84526
Del: integrated -- https://master.php.net/note/delete/84526/integrated
Del: useless -- https://master.php.net/note/delete/84526/useless
Del: bad code -- https://master.php.net/note/delete/84526/bad+code
Del: spam -- https://master.php.net/note/delete/84526/spam
Del: non-english -- https://master.php.net/note/delete/84526/non-english
Del: in docs -- https://master.php.net/note/delete/84526/in+docs
Del: other reasons-- https://master.php.net/note/delete/84526
Reject -- https://master.php.net/note/reject/84526
Search -- https://master.php.net/manage/user-notes.php