1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Node;
4:
5: use Override;
6: use PhpParser\Node\Stmt\ClassConst;
7: use PhpParser\Node\Stmt\ClassLike;
8: use PhpParser\NodeAbstract;
9: use PHPStan\Node\Constant\ClassConstantFetch;
10: use PHPStan\Reflection\ClassReflection;
11:
12: /**
13: * @api
14: */
15: final 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: #[Override]
49: public function getType(): string
50: {
51: return 'PHPStan_Node_ClassConstantsNode';
52: }
53:
54: /**
55: * @return string[]
56: */
57: #[Override]
58: public function getSubNodeNames(): array
59: {
60: return [];
61: }
62:
63: public function getClassReflection(): ClassReflection
64: {
65: return $this->classReflection;
66: }
67:
68: }
69: