# RFC: Make T_FUNCTION in method declarations optional.

- Status: Inactive
- Authors: Johannes Schlüter
- Date: 2010-11-27
- Version: 1.0
- Original: https://wiki.php.net/rfc/optional-t-function
- Page: https://externals.io/rfc/optional-t-function
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Discussions on the mailing list

- [RFC: Making T_FUNCTION optional in method declarations](https://externals.io/message/50628.md) — started on 2010-11-27, 64 messages

---

## 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:

```php
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:

```php
class Foo {
    const C = 42;
    private $var;
 
    bar() {
        echo "Hello World";
    }
}
 
$foo = new Foo();
$foo->bar();
```

## Patch

An initial patch can be found at [http://schlueters.de/~johannes/php/zend\_optional\_t\_function.diff](http://schlueters.de/~johannes/php/zend_optional_t_function.diff)

## Changelog

1.0: Initial proposal (JS)
