#33325 [Bgs->WFx]: Type hinting and defaults of NULL
| From: | tony2001@php.net | Date: | Mon, 13 Jun 2005 21:48:30 +0000 |
| Subject: | #33325 [Bgs->WFx]: Type hinting and defaults of NULL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80264@lists.php.net to get a copy of this message | ||
ID: 33325
Updated by: tony2001@php.net
Reported By: jacob at jacobweber dot com
-Status: Bogus
+Status: Wont fix
-Bug Type: Class/Object related
+Bug Type: Feature/Change Request
Operating System: All
PHP Version: 5.0.4
New Comment:
This was discussed before and the conclusion was not to implement it.
Please search internals archives for the discussion (this message can
help probably:
http://www.mail-archive.com/internals@lists.php.net/msg13629.html).
Previous Comments:
------------------------------------------------------------------------
[2005-06-13 23:44:36] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is intended behaviour.
------------------------------------------------------------------------
[2005-06-13 19:17:22] jacob at jacobweber dot com
Description:
------------
When using type-hinting in a function's arguments, PHP should allow a
default value of NULL. Otherwise you have to manaully check the type
with instanceof. This would make it more convenient, and more
consistent with Java.
Reproduce code:
---------------
function f (MyClass $o = NULL) {
echo "success";
}
f();
Expected result:
----------------
success
Actual result:
--------------
PHP compiler error.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33325&edit=1