Full description
https://wiki.php.net/rfc/code_free_constructor
Draft realisation
https://github.com/php/php-src/compare/master...rjhdby:constructor

"Code free" constructor is constructor with only purpose to directly set 
object properties from received parameters and, optionally, call parent 
constructor.

Main idea is to move such constructor declaration inside class 
declaration.

Simple example:

Current syntax
class A extends B{
    public $prop;

    public function __construct($prop){
        parent::__construct("BlaBla", $prop);
        $this->prop = $prop;
    }
}

Proposed syntax
class A($prop) extends B("BlaBla", $prop) {
}

With respect, Andrey.

Reply via email to