1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use PhpParser\Node\Stmt\ClassConst;
6: use PhpParser\Node\Stmt\ClassLike;
7: use PhpParser\NodeAbstract;
8: use PHPStan\Node\Constant\ClassConstantFetch;
9: use PHPStan\Reflection\ClassReflection;
10:
11: /**
12: * @api
13: */
14: final class ClassConstantsNode extends NodeAbstract implements VirtualNode
15: {
16:
17: /**
18: * @param ClassConst[] $constants
19: * @param ClassConstantFetch[] $fetches
20: */
21: public function __construct(private ClassLike $class, private array $constants, private array $fetches, private ClassReflection $classReflection)
22: {
23: parent::__construct($class->getAttributes());
24: }
25:
26: public function getClass(): ClassLike
27: {
28: return $this->class;
29: }
30:
31: /**
32: * @return ClassConst[]
33: */
34: public function getConstants(): array
35: {
36: return $this->constants;
37: }
38:
39: /**
40: * @return ClassConstantFetch[]
41: */
42: public function getFetches(): array
43: {
44: return $this->fetches;
45: }
46:
47: public function getType(): string
48: {
49: return 'PHPStan_Node_ClassConstantsNode';
50: }
51:
52: /**
53: * @return string[]
54: */
55: public function getSubNodeNames(): array
56: {
57: return [];
58: }
59:
60: public function getClassReflection(): ClassReflection
61: {
62: return $this->classReflection;
63: }
64:
65: }
66: