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: * @final
14: */
15: class ClassConstantsNode extends NodeAbstract implements VirtualNode
16: {
17:
18: /**
19: * @param ClassConst[] $constants
20: * @param ClassConstantFetch[] $fetches
21: */
22: public function __construct(private ClassLike $class, private array $constants, private array $fetches, private ClassReflection $classReflection)
23: {
24: parent::__construct($class->getAttributes());
25: }
26:
27: public function getClass(): ClassLike
28: {
29: return $this->class;
30: }
31:
32: /**
33: * @return ClassConst[]
34: */
35: public function getConstants(): array
36: {
37: return $this->constants;
38: }
39:
40: /**
41: * @return ClassConstantFetch[]
42: */
43: public function getFetches(): array
44: {
45: return $this->fetches;
46: }
47:
48: public function getType(): string
49: {
50: return 'PHPStan_Node_ClassConstantsNode';
51: }
52:
53: /**
54: * @return string[]
55: */
56: public function getSubNodeNames(): array
57: {
58: return [];
59: }
60:
61: public function getClassReflection(): ClassReflection
62: {
63: return $this->classReflection;
64: }
65:
66: }
67: