| 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: | final class ReflectionAttribute extends CoreReflectionAttribute |
| 12: | { |
| 13: | |
| 14: | |
| 15: | |
| 16: | private $betterReflectionAttribute; |
| 17: | public function __construct(BetterReflectionAttribute $betterReflectionAttribute) |
| 18: | { |
| 19: | $this->betterReflectionAttribute = $betterReflectionAttribute; |
| 20: | } |
| 21: | |
| 22: | public function getName(): string |
| 23: | { |
| 24: | return $this->betterReflectionAttribute->getName(); |
| 25: | } |
| 26: | |
| 27: | public function getTarget(): int |
| 28: | { |
| 29: | return $this->betterReflectionAttribute->getTarget(); |
| 30: | } |
| 31: | |
| 32: | public function isRepeated(): bool |
| 33: | { |
| 34: | return $this->betterReflectionAttribute->isRepeated(); |
| 35: | } |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | public function getArguments(): array |
| 42: | { |
| 43: | return $this->betterReflectionAttribute->getArguments(); |
| 44: | } |
| 45: | |
| 46: | |
| 47: | public function getArgumentsExpressions(): array |
| 48: | { |
| 49: | return $this->betterReflectionAttribute->getArgumentsExpressions(); |
| 50: | } |
| 51: | |
| 52: | |
| 53: | public function newInstance(): object |
| 54: | { |
| 55: | $class = $this->getName(); |
| 56: | |
| 57: | return new $class(...$this->getArguments()); |
| 58: | } |
| 59: | |
| 60: | public function __toString(): string |
| 61: | { |
| 62: | return $this->betterReflectionAttribute->__toString(); |
| 63: | } |
| 64: | } |
| 65: | |