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