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 MixinTagValueNode implements PhpDocTagValueNode
10: {
11:
12: use NodeAttributes;
13:
14: public TypeNode $type;
15:
16: /** @var string (may be empty) */
17: public string $description;
18:
19: public function __construct(TypeNode $type, string $description)
20: {
21: $this->type = $type;
22: $this->description = $description;
23: }
24:
25: public function __toString(): string
26: {
27: return trim("{$this->type} {$this->description}");
28: }
29:
30: /**
31: * @param array<string, mixed> $properties
32: */
33: public static function __set_state(array $properties): self
34: {
35: $instance = new self($properties['type'], $properties['description']);
36: if (isset($properties['attributes'])) {
37: foreach ($properties['attributes'] as $key => $value) {
38: $instance->setAttribute($key, $value);
39: }
40: }
41: return $instance;
42: }
43:
44: }
45: