Copied from wiki.php.net, last synchronized Oct 13, 2026 11:54 UTC
The purpose of this RFC is proposing to remove the requirement of T_FUNCTION keyword in method declarations if a visibility flag (T_PUBLIC,T_PROTECTED, T_PRIVATE, T_STATIC, T_ABSTRACT, T_FINAL) is given in a class, trait or interface declaration.
It is proposed that this is valid code:
class Foo {
const C = 42;
private $var;
public bar() {
echo "Hello World";
}
}
$foo = new Foo();
$foo->bar();
While technically possible this RFC suggests that the following shall NOT be valid for keeping the code readable:
class Foo {
const C = 42;
private $var;
bar() {
echo "Hello World";
}
}
$foo = new Foo();
$foo->bar();
An initial patch can be found at http://schlueters.de/~johannes/php/zend_optional_t_function.diff
1.0: Initial proposal (JS)