Re: RFC: Making T_FUNCTION optional in method declarations
| From: | Patrick ALLAERT | Date: | Tue, 30 Nov 2010 10:00:06 +0000 |
| Subject: | Re: RFC: Making T_FUNCTION optional in method declarations | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50719@lists.php.net to get a copy of this message | ||
2010/11/27 Johannes Schlüter <johannes@schlueters.de>:
> 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
>
> johannes
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
With this patch, something looks inconsistent to me:
Both properties and methods have a visibility
(public|protected|private) and a keyword: "var" (T_VAR) and "function"
(T_FUNCTION) respectively.
However "private var $foo;" generates a fatal error but "private
function foo(){}" not?
Cheers,
--
Patrick Allaert
---
http://code.google.com/p/peclapm/ - Alternative PHP
Monitor