If the constructor consists solely of assignments, you can include the Constructor trait and remove it. The parameters will be declared in the order the fields are declared: top to bottom, left to right in the source code.
Writing this:
namespace example;
use lang\partial\Constructor;
class Author extends \lang\Object {
use Author\including\Constructor;
private $handle, $name;
}
...is equivalent to:
namespace example;
class Author extends \lang\Object {
private $handle, $name;
public function __construct($handle, $name) {
$this->handle= $handle;
$this->name= $name;
}
}
If the constructor consists solely of assignments, you can include the
Constructor
trait and remove it. The parameters will be declared in the order the fields are declared: top to bottom, left to right in the source code.