-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathParamTagValueNode.php
More file actions
42 lines (29 loc) · 988 Bytes
/
Copy pathParamTagValueNode.php
File metadata and controls
42 lines (29 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php declare(strict_types = 1);
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\NodeAttributes;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use function trim;
class ParamTagValueNode implements PhpDocTagValueNode
{
use NodeAttributes;
public TypeNode $type;
public bool $isReference;
public bool $isVariadic;
public string $parameterName;
/** @var string (may be empty) */
public string $description;
public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference)
{
$this->type = $type;
$this->isReference = $isReference;
$this->isVariadic = $isVariadic;
$this->parameterName = $parameterName;
$this->description = $description;
}
public function __toString(): string
{
$reference = $this->isReference ? '&' : '';
$variadic = $this->isVariadic ? '...' : '';
return trim("{$this->type} {$reference}{$variadic}{$this->parameterName} {$this->description}");
}
}