1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace PHPStan\BetterReflection\Reflector;
6:
7: use PHPStan\BetterReflection\Reflection\ReflectionClass;
8: use PHPStan\BetterReflection\Reflection\ReflectionConstant;
9: use PHPStan\BetterReflection\Reflection\ReflectionFunction;
10: use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
11: use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
12:
13: /**
14: * @deprecated Use Roave\BetterReflection\Reflector\Reflector instead.
15: */
16: class ConstantReflector implements Reflector
17: {
18: /** @var Reflector */
19: private $reflector;
20:
21: public function __construct(SourceLocator $sourceLocator)
22: {
23: $this->reflector = new DefaultReflector($sourceLocator);
24: }
25:
26: /**
27: * Create a ReflectionFunction for the specified $functionName.
28: *
29: * @throws IdentifierNotFound
30: */
31: public function reflect(string $constantName): ReflectionConstant
32: {
33: return $this->reflector->reflectConstant($constantName);
34: }
35:
36: /**
37: * Get all the classes available in the scope specified by the SourceLocator.
38: *
39: * @return ReflectionConstant[]
40: */
41: public function getAllConstants(): array
42: {
43: return $this->reflector->reflectAllConstants();
44: }
45:
46: public function reflectClass(string $identifierName): ReflectionClass
47: {
48: return $this->reflector->reflectClass($identifierName);
49: }
50:
51: /**
52: * @return list<ReflectionClass>
53: */
54: public function reflectAllClasses(): iterable
55: {
56: return $this->reflector->reflectAllClasses();
57: }
58:
59: public function reflectFunction(string $identifierName): ReflectionFunction
60: {
61: return $this->reflector->reflectFunction($identifierName);
62: }
63:
64: /**
65: * @return list<ReflectionFunction>
66: */
67: public function reflectAllFunctions(): iterable
68: {
69: return $this->reflector->reflectAllFunctions();
70: }
71:
72: public function reflectConstant(string $identifierName): ReflectionConstant
73: {
74: return $this->reflector->reflectConstant($identifierName);
75: }
76:
77: /**
78: * @return list<ReflectionConstant>
79: */
80: public function reflectAllConstants(): iterable
81: {
82: return $this->reflector->reflectAllConstants();
83: }
84: }
85: