#42802 [Asn->Csd]: Namespace not supported in typehints

From: Date: Mon, 01 Oct 2007 10:38:01 +0000
Subject: #42802 [Asn->Csd]: Namespace not supported in typehints
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118007@lists.php.net to get a copy of this message
ID: 42802 Updated by: dmitry@php.net Reported By: kore@php.net -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: Linux 2.6.21 PHP Version: 5CVS-2007-09-30 (CVS) Assigned To: dmitry New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-10-01 08:24:15] sebastian@php.net Looks like a duplicate of http://bugs.php.net/bug.php?id=42798 to me. ------------------------------------------------------------------------ [2007-09-30 13:05:52] johannes@php.net I think the reporter is right and bar inside the declaration should resolve to foo::bar. And function(foo::bar $param) {} should be allowed, too. Dmitry please take a look, thanks. ------------------------------------------------------------------------ [2007-09-30 13:01:38] kore@php.net Description: ------------ Namespaces are not supported in type hints. Type hints with namespace result in an "Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM". Reproduce code: --------------- <?php namespace foo; class bar {} class blubb { public function __construct( bar $bar ) {} } new blubb( new bar() ); Expected result: ---------------- No error. Actual result: -------------- Catchable fatal error: Argument 1 passed to foo::blubb::__construct( ) must be an instance of bar, instance of foo::bar given, called in ns_test.php on line 17 and defined in ns_test.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42802&edit=1

« previous php.bugs (#118007) next »