Doc #74463 [Opn]: Reserved keywords as function name?

From: Date: Tue, 18 Apr 2017 05:13:57 +0000
Subject: Doc #74463 [Opn]: Reserved keywords as function name?
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14641@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74463&edit=1 ID: 74463 User updated by: usr at airmail dot cc Reported by: usr at airmail dot cc Summary: Reserved keywords as function name? Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Mac OS X PHP Version: 7.1.4 Block user comment: N Private report: N New Comment: The RFC states 'restricted to OO scope only'. However my question is not about OO but rather a function name, so this RFC does not really answer my question. Or am I overseeing something? Previous Comments: ------------------------------------------------------------------------ [2017-04-18 04:58:44] wes at example dot org Hi, please read https://wiki.php.net/rfc/context_sensitive_lexer ------------------------------------------------------------------------ [2017-04-18 04:37:00] usr at airmail dot cc Description: ------------ The documentation says: --- The following words cannot be used to name a class, interface or trait, and they are also prohibited from being used in namespaces. --- http://php.net/manual/en/reserved.other-reserved-words.php But it does not mention the use of these words in function names. Is it safe to use those in the provided manner (see test case)? Test script: --------------- <?php /* This works??? */ namespace A\B { function String() { } } namespace { A\B\String(); } ?> <?php /* This breaks */ namespace A\B { function private() { } } namespace { A\B\private(); } ?> <?php /* This also breaks */ namespace A\B { class String {} } namespace { $str = new A\B\String(); } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74463&edit=1

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