#42802 [Asn]: Namespace not supported in typehints

From: Date: Mon, 01 Oct 2007 08:24:16 +0000
Subject: #42802 [Asn]: Namespace not supported in typehints
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117999@lists.php.net to get a copy of this message
ID: 42802 Updated by: sebastian@php.net Reported By: kore@php.net Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux 2.6.21 PHP Version: 5CVS-2007-09-30 (CVS) Assigned To: dmitry New Comment: Looks like a duplicate of http://bugs.php.net/bug.php?id=42798 to me. Previous Comments: ------------------------------------------------------------------------ [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 (#117999) next »