Doc #68364 [Opn->Nab]: Missing reserved keyword 'self'

From: Date: Thu, 06 Nov 2014 13:45:46 +0000
Subject: Doc #68364 [Opn->Nab]: Missing reserved keyword 'self'
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11610@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68364&edit=1 ID: 68364 Updated by: bwoebi@php.net Reported by: nanne at huiges dot nl Summary: Missing reserved keyword 'self' -Status: Open +Status: Not a bug Type: Documentation Problem Package: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: No, self (and parent) aren't keywords. You can declare a function self() {} without problems. They're just forbidden to use in class contexts for resolving any ambiguity about what self:: and parent:: should address. The class itself/parent of the class or the classes self/parent? Previous Comments: ------------------------------------------------------------------------ [2014-11-06 12:46:40] nanne at huiges dot nl Description: ------------ --- From manual page: http://www.php.net/reserved.keywords --- The keyword 'self' is not featured in the list of reserved keywords, but it should be. Test script: --------------- <?php class self{ } Expected result: ---------------- The result "implied" by the manual is that this would work. (Not that I say the actual _expected_ result is empty by the way, this is obviously not a bug in code, but a bug in the manual). so you could say the expected 'result' is that it is in the manual :) Actual result: -------------- The correct PHP Fatal error: Cannot use 'self' as class name as it is reserved in test.php on line 3 is provided, even though it isn't in the documentation. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68364&edit=1

« previous php.doc.bugs (#11610) next »