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 AssertTagMethodValueNode implements PhpDocTagValueNode
10: {
11:
12: use NodeAttributes;
13:
14: public TypeNode $type;
15:
16: public string $parameter;
17:
18: public string $method;
19:
20: public bool $isNegated;
21:
22: public bool $isEquality;
23:
24: /** @var string (may be empty) */
25: public string $description;
26:
27: public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality)
28: {
29: $this->type = $type;
30: $this->parameter = $parameter;
31: $this->method = $method;
32: $this->isNegated = $isNegated;
33: $this->isEquality = $isEquality;
34: $this->description = $description;
35: }
36:
37:
38: public function __toString(): string
39: {
40: $isNegated = $this->isNegated ? '!' : '';
41: $isEquality = $this->isEquality ? '=' : '';
42: return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter}->{$this->method}() {$this->description}");
43: }
44:
45: }
46: