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