1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | namespace PHPStan\BetterReflection\Reflection\Adapter; |
6: | |
7: | use PhpParser\Node\Expr; |
8: | use ReflectionAttribute as CoreReflectionAttribute; |
9: | use PHPStan\BetterReflection\Reflection\ReflectionAttribute as BetterReflectionAttribute; |
10: | |
11: | |
12: | final class ReflectionAttribute extends CoreReflectionAttribute |
13: | { |
14: | |
15: | |
16: | |
17: | private $betterReflectionAttribute; |
18: | public function __construct(BetterReflectionAttribute $betterReflectionAttribute) |
19: | { |
20: | $this->betterReflectionAttribute = $betterReflectionAttribute; |
21: | } |
22: | |
23: | |
24: | public function getName(): string |
25: | { |
26: | return $this->betterReflectionAttribute->getName(); |
27: | } |
28: | |
29: | |
30: | public function getTarget(): int |
31: | { |
32: | return $this->betterReflectionAttribute->getTarget(); |
33: | } |
34: | |
35: | |
36: | public function isRepeated(): bool |
37: | { |
38: | return $this->betterReflectionAttribute->isRepeated(); |
39: | } |
40: | |
41: | |
42: | |
43: | |
44: | |
45: | public function getArguments(): array |
46: | { |
47: | return $this->betterReflectionAttribute->getArguments(); |
48: | } |
49: | |
50: | |
51: | public function getArgumentsExpressions(): array |
52: | { |
53: | return $this->betterReflectionAttribute->getArgumentsExpressions(); |
54: | } |
55: | |
56: | |
57: | public function newInstance(): object |
58: | { |
59: | $class = $this->getName(); |
60: | |
61: | return new $class(...$this->getArguments()); |
62: | } |
63: | |
64: | |
65: | public function __toString(): string |
66: | { |
67: | return $this->betterReflectionAttribute->__toString(); |
68: | } |
69: | } |
70: | |