Nullable property types are stripped when adding existing property
Opened this issue · 1 comments
Deleted user commented
Hello
Adding an existing property with a nullable PHP 7.4 to the constructor will ignore the nullable type hint:
/**
* @var string|null
*/
private ?string $blah;
This will result in:
/**
* Constructor.
* @param string $blah
*/
public function __construct(string $blah)
{
$this->blah = $blah;
}
Where $blah
is a string
instead of a string|null
in the docblock and a ?string
in the constructor parameter.
PS: You may also be interested in knowing that PHP 8 will support union types, so types such as these become valid as well (they may already work):
private int|string $value;
Thanks!
kotfire commented
Added in v1.1.0