mirror of
https://github.com/danog/phpdoc-parser.git
synced 2025-01-22 13:51:20 +01:00
TemplateTagValueNode: $bound is nullable
This commit is contained in:
parent
3e956143ed
commit
b3040ade88
@ -10,13 +10,13 @@ class TemplateTagValueNode implements PhpDocTagValueNode
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
/** @var TypeNode */
|
||||
/** @var TypeNode|null */
|
||||
public $bound;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(string $name, TypeNode $bound, string $description)
|
||||
public function __construct(string $name, ?TypeNode $bound, string $description)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->bound = $bound;
|
||||
@ -26,7 +26,8 @@ class TemplateTagValueNode implements PhpDocTagValueNode
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->name} of {$this->bound} {$this->description}");
|
||||
$bound = $this->bound ? " of {$this->bound}" : '';
|
||||
return trim("{$this->name}{$bound} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ class PhpDocParser
|
||||
$bound = $this->typeParser->parse($tokens);
|
||||
|
||||
} else {
|
||||
$bound = new IdentifierTypeNode('mixed');
|
||||
$bound = null;
|
||||
}
|
||||
|
||||
$description = $this->parseOptionalDescription($tokens);
|
||||
|
@ -2282,7 +2282,7 @@ some text in the middle'
|
||||
'@template',
|
||||
new TemplateTagValueNode(
|
||||
'T',
|
||||
new IdentifierTypeNode('mixed'),
|
||||
null,
|
||||
''
|
||||
)
|
||||
),
|
||||
@ -2297,7 +2297,7 @@ some text in the middle'
|
||||
'@template',
|
||||
new TemplateTagValueNode(
|
||||
'T',
|
||||
new IdentifierTypeNode('mixed'),
|
||||
null,
|
||||
'the value type'
|
||||
)
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user