| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Reflection; |
| 4: | |
| 5: | use PHPStan\Type\Type; |
| 6: | |
| 7: | /** |
| 8: | * Reflection for a PHP attribute (PHP 8.0+). |
| 9: | * |
| 10: | * Represents a single attribute applied to a class, method, property, function, |
| 11: | * parameter, or constant. Provides the attribute's class name and the types of |
| 12: | * its constructor arguments. |
| 13: | * |
| 14: | * Returned by the getAttributes() method on ExtendedMethodReflection, |
| 15: | * ExtendedPropertyReflection, FunctionReflection, ClassConstantReflection, etc. |
| 16: | * |
| 17: | * @api |
| 18: | */ |
| 19: | final class AttributeReflection |
| 20: | { |
| 21: | |
| 22: | /** |
| 23: | * @param array<string, Type> $argumentTypes Argument types keyed by parameter name |
| 24: | */ |
| 25: | public function __construct(private string $name, private array $argumentTypes) |
| 26: | { |
| 27: | } |
| 28: | |
| 29: | public function getName(): string |
| 30: | { |
| 31: | return $this->name; |
| 32: | } |
| 33: | |
| 34: | /** @return array<string, Type> */ |
| 35: | public function getArgumentTypes(): array |
| 36: | { |
| 37: | return $this->argumentTypes; |
| 38: | } |
| 39: | |
| 40: | } |
| 41: |