1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDocParser\Ast\PhpDoc;
4:
5: use PHPStan\PhpDocParser\Ast\NodeAttributes;
6: use PHPStan\PhpDocParser\Ast\Type\TypeNode;
7: use function trim;
8:
9: class AssertTagValueNode implements PhpDocTagValueNode
10: {
11:
12: use NodeAttributes;
13:
14: /** @var TypeNode */
15: public $type;
16:
17: /** @var string */
18: public $parameter;
19:
20: /** @var bool */
21: public $isNegated;
22:
23: /** @var string (may be empty) */
24: public $description;
25:
26: public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description)
27: {
28: $this->type = $type;
29: $this->parameter = $parameter;
30: $this->isNegated = $isNegated;
31: $this->description = $description;
32: }
33:
34:
35: public function __toString(): string
36: {
37: $isNegated = $this->isNegated ? '!' : '';
38: return trim("{$this->type} {$isNegated}{$this->parameter} {$this->description}");
39: }
40:
41: }
42: