1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDocParser\Ast\PhpDoc\Doctrine;
4:
5: use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode;
6: use PHPStan\PhpDocParser\Ast\Node;
7: use PHPStan\PhpDocParser\Ast\NodeAttributes;
8: use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
9:
10: /**
11: * @phpstan-type ValueType = DoctrineAnnotation|IdentifierTypeNode|DoctrineArray|ConstExprNode
12: */
13: class DoctrineArgument implements Node
14: {
15:
16: use NodeAttributes;
17:
18: public ?IdentifierTypeNode $key = null;
19:
20: /** @var ValueType */
21: public $value;
22:
23: /**
24: * @param ValueType $value
25: */
26: public function __construct(?IdentifierTypeNode $key, $value)
27: {
28: $this->key = $key;
29: $this->value = $value;
30: }
31:
32:
33: public function __toString(): string
34: {
35: if ($this->key === null) {
36: return (string) $this->value;
37: }
38:
39: return $this->key . '=' . $this->value;
40: }
41:
42: }
43: