rfc:optional-t-function

Request for Comments: Making T_FUNCTION optional for method declarations

Introduction

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.

Syntax

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();

Patch

Changelog

1.0: Initial proposal (JS)

rfc/optional-t-function.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1