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