#43332 [Opn->Asn]: self and parent as type hint in namespace

From: Date: Sat, 24 Nov 2007 12:32:38 +0000
Subject: #43332 [Opn->Asn]: self and parent as type hint in namespace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120016@lists.php.net to get a copy of this message
ID: 43332 Updated by: jani@php.net Reported By: felipensp at gmail dot com -Status: Open +Status: Assigned Bug Type: Scripting Engine problem PHP Version: 5.3CVS-2007-11-19 (snap) -Assigned To: +Assigned To: dmitry New Comment: Another namespace issue. Previous Comments: ------------------------------------------------------------------------ [2007-11-19 11:40:02] felipensp at gmail dot com Description: ------------ self and parent as type hint in namespace must be prefixed with '::', but not is possible to use them as class name. So, i'm guessing that shouldn't be necessary the prefix. Reproduce code: --------------- <?php namespace foobar; class foo { // no namespace //public function baz(self $a) { } // with namespace public function baz(::self $a) { } } $foo = new foo; $foo->baz($foo); // Ok! //$foo->baz(new stdclass); // Error, ok! Expected result: ---------------- Don't be necessary prefix in self/parent. Actual result: -------------- They must be prefixed. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43332&edit=1

« previous php.bugs (#120016) next »