Skip to content

Commit

Permalink
Fix ClassConst::$type phpdoc
Browse files Browse the repository at this point in the history
The property should be nullable, and on 4.x we should convert
string to Identifier.

Fixes #939.
  • Loading branch information
nikic committed Aug 13, 2023
1 parent 844c228 commit 44fc921
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/PhpParser/Node/Stmt/ClassConst.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ClassConst extends Node\Stmt
public $consts;
/** @var Node\AttributeGroup[] PHP attribute groups */
public $attrGroups;
/** @var Node\Identifier|Node\Name|Node\ComplexType Type declaration */
/** @var Node\Identifier|Node\Name|Node\ComplexType|null Type declaration */
public $type;

/**
Expand All @@ -22,7 +22,7 @@ class ClassConst extends Node\Stmt
* @param int $flags Modifiers
* @param array $attributes Additional attributes
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
* @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration
* @param null|string|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration
*/
public function __construct(
array $consts,
Expand All @@ -35,7 +35,7 @@ public function __construct(
$this->flags = $flags;
$this->consts = $consts;
$this->attrGroups = $attrGroups;
$this->type = $type;
$this->type = \is_string($type) ? new Node\Identifier($type) : $type;
}

public function getSubNodeNames() : array {
Expand Down

0 comments on commit 44fc921

Please sign in to comment.