Open Zerotask opened 1 year ago
A great addition would be to add properties to an already present constructor. This would also be helpful for #192 Example:
<?php
class User
{
private ?string $name;
private int $age;
private bool $isDeveloper;
private string $lastName;
/**
* @param null|string $name
* @param int $age
* @param bool $isDeveloper
*/
public function __construct(?string $name, int $age, bool $isDeveloper)
{
$this->name = $name;
$this->age = $age;
$this->isDeveloper = $isDeveloper;
}
}
Now I'd like to have it as follows:
<?php
class User
{
private ?string $name;
private int $age;
private bool $isDeveloper;
private string $lastName;
/**
* @param null|string $name
* @param int $age
* @param bool $isDeveloper
* @param string $lastName
*/
public function __construct(?string $name, int $age, bool $isDeveloper, string $lastName)
{
$this->name = $name;
$this->age = $age;
$this->isDeveloper = $isDeveloper;
$this->lastName = $lastName;
}
}
(docblock, param and assignment)
There could be a quick fix for properties to be added to the constructor and/or a quick fix for the class to sync properties with the constructor
thank you for the detailed suggestions! Working on it:
Assume you have the following:
The quick fix will generate the following:
Suggestions:
@param $age int
->@param int $age
null
is not?
:@param $name ?string
->@param null|string $name
public
by default)The expected output would be: