Debian Codegraph @

vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php

raw
1 <?php declare(strict_types = 1);
2
3 namespace PHPStan\PhpDocParser\Ast\PhpDoc;
4
5 use PHPStan\PhpDocParser\Ast\NodeAttributes;
6
7 class PhpDocTextNode implements PhpDocChildNode
8 {
9
10 use NodeAttributes;
11
12 public string $text;
13
14 public function __construct(string $text)
15 {
16 $this->text = $text;
17 }
18
19 public function __toString(): string
20 {
21 return $this->text;
22 }
23
24 /**
25 * @param array<string, mixed> $properties
26 */
27 public static function __set_state(array $properties): self
28 {
29 $instance = new self($properties['text']);
30 if (isset($properties['attributes'])) {
31 foreach ($properties['attributes'] as $key => $value) {
32 $instance->setAttribute($key, $value);
33 }
34 }
35 return $instance;
36 }
37
38 }