Hello internals.

I am looking into making the constructor body optional in classes,
essentially allowing you to write

```
class User {
    public function __construct(
        private string $name,
    )
}
```

Currently to make this code valid, it would have to be written the
following way

```
class User {
    public function __construct(
        public string $name,
    ) {}
}
```

With the introduction or constructor property promotion in 8.0, we often
see classes where the constructor has an empty body, and my guess would be
that this will only increase with the introduction of property access hooks
in 8.4 which is allowed to be defined in the constructor also.

This change would only be a cosmetic change and simplify the userland code
by removing two redundant characters.



This would be my first RFC and I am willing to try and implement it myself.


Best regards
Oliver Nybroe (he/him)

Reply via email to