Fix ClassConst::$type phpdoc

The property should be nullable, and on 4.x we should convert
string to Identifier.

Fixes #939.
This commit is contained in:
Nikita Popov 2023-08-13 21:49:54 +02:00
parent 844c228bf2
commit 44fc92194b

View File

@ -12,7 +12,7 @@ class ClassConst extends Node\Stmt
public $consts; public $consts;
/** @var Node\AttributeGroup[] PHP attribute groups */ /** @var Node\AttributeGroup[] PHP attribute groups */
public $attrGroups; public $attrGroups;
/** @var Node\Identifier|Node\Name|Node\ComplexType Type declaration */ /** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */
public $type; public $type;
/** /**
@ -35,7 +35,7 @@ class ClassConst extends Node\Stmt
$this->flags = $flags; $this->flags = $flags;
$this->consts = $consts; $this->consts = $consts;
$this->attrGroups = $attrGroups; $this->attrGroups = $attrGroups;
$this->type = $type; $this->type = \is_string($type) ? new Node\Identifier($type) : $type;
} }
public function getSubNodeNames() : array { public function getSubNodeNames() : array {