Req #71678 [Asn]: class() extends self

From: Date: Sun, 29 Jan 2017 07:33:49 +0000
Subject: Req #71678 [Asn]: class() extends self
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207033@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71678&edit=1 ID: 71678 Updated by: krakjoe@php.net Reported by: php at thekid dot de Summary: class() extends self Status: Assigned Type: Feature/Change Request Package: Scripting Engine problem Operating System: Windows PHP Version: 7.0.3 -Assigned To: krakjoe +Assigned To: Block user comment: N Private report: N New Comment: For this kind of change, an RFC is required. Please see http://wiki.php.net/rfc/howto Previous Comments: ------------------------------------------------------------------------ [2016-07-14 09:44:04] dmitry@php.net This is not a bug, but a feature request. ------------------------------------------------------------------------ [2016-02-27 17:09:55] thekid@php.net Same goes for "parent" ------------------------------------------------------------------------ [2016-02-27 17:08:13] php at thekid dot de Description: ------------ Anonymous class syntax doesn't work with "self" keyword. Test script: --------------- class T { static function new() { return new class() extends self { }; } } var_dump(T::new()); Expected result: ---------------- object(class@anonymous)#1 (0) { } Actual result: -------------- Fatal error: Cannot use 'self' as class name as it is reserved in Command line code on line 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71678&edit=1

« previous php.bugs (#207033) next »