1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\PhpDocParser\Ast\ConstExpr;
4:
5: use PHPStan\PhpDocParser\Ast\NodeAttributes;
6:
7: class ConstExprArrayItemNode implements ConstExprNode
8: {
9:
10: use NodeAttributes;
11:
12: /** @var ConstExprNode|null */
13: public $key;
14:
15: /** @var ConstExprNode */
16: public $value;
17:
18: public function __construct(?ConstExprNode $key, ConstExprNode $value)
19: {
20: $this->key = $key;
21: $this->value = $value;
22: }
23:
24:
25: public function __toString(): string
26: {
27: if ($this->key !== null) {
28: return "{$this->key} => {$this->value}";
29:
30: }
31:
32: return "{$this->value}";
33: }
34:
35: }
36: