Re: RFC: Making T_FUNCTION optional in method declarations
| From: | Mike Van Riel | Date: | Sat, 27 Nov 2010 21:58:51 +0000 |
| Subject: | Re: RFC: Making T_FUNCTION optional in method declarations | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50642@lists.php.net to get a copy of this message | ||
On 27 nov 2010, at 18:40, Johannes Schlüter <johannes@schlueters.de> wrote:
Hi,
every now and then while writing classes I forget to add the "function"
keyword between my visibility modifier and the method name in a class
declaration. I don't think it is required for readability and it is not
needed by the parser to prevent conflicts, I therefore propose the
following RFC incl. patch to allow writing
class Foo {
public bar() {
echo "Hello World";
}
}
Without T_FUNCTION token. In my opinion an access modifier /public,
private protected, static, final) should still be required for keeping
readability.
RFC: http://wiki.php.net/rfc/optional-t-function
Patch: http://schlueters.de/~johannes/php/zend_optional_t_function.diff
FWIW: +1
Though I do have two questions regarding behaviour:
I am currently working on a documentation generator (DocBlox) which uses the tokenizer to analyze sourcefiles. The T_FUNCTION token is a clear sign for me that I am dealing with a method (as the visibility token can also be used with properties).
With this patch I will loose this recognition point and the first solution that comes to mind is to search for () or arguments. This sounds rather hackish to me, might I be missing a solution?
Another question is: when would you like to have this released? PHP-next? (thus either 5.4, 6, 7 or whichever is next?).
Thank you!
--
Kind regards,
Mike van Riel