| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Reflection; |
| 4: | |
| 5: | use PHPStan\Type\Generic\TemplateTypeMap; |
| 6: | use PHPStan\Type\Type; |
| 7: | |
| 8: | /** |
| 9: | * Describes one signature variant of a function or method. |
| 10: | * |
| 11: | * A function/method may have multiple ParametersAcceptor variants — for example, |
| 12: | * the built-in `strtok` function has different signatures depending on argument count. |
| 13: | * Each variant describes the template type parameters, positional parameters, variadicity, |
| 14: | * and return type. |
| 15: | * |
| 16: | * This is the base interface. ExtendedParametersAcceptor adds separate PHPDoc/native |
| 17: | * return types and extended parameter reflection. CallableParametersAcceptor adds |
| 18: | * throw points, impure points, and purity information. |
| 19: | * |
| 20: | * Use ParametersAcceptorSelector to choose the best variant for a given call site. |
| 21: | * |
| 22: | * @api |
| 23: | */ |
| 24: | interface ParametersAcceptor |
| 25: | { |
| 26: | |
| 27: | public const VARIADIC_FUNCTIONS = [ |
| 28: | 'func_get_args', |
| 29: | 'func_get_arg', |
| 30: | 'func_num_args', |
| 31: | ]; |
| 32: | |
| 33: | public function getTemplateTypeMap(): TemplateTypeMap; |
| 34: | |
| 35: | /** |
| 36: | * After template type inference at a call site, this map contains the |
| 37: | * concrete types inferred for each template parameter. |
| 38: | */ |
| 39: | public function getResolvedTemplateTypeMap(): TemplateTypeMap; |
| 40: | |
| 41: | /** @return list<ParameterReflection> */ |
| 42: | public function getParameters(): array; |
| 43: | |
| 44: | public function isVariadic(): bool; |
| 45: | |
| 46: | public function getReturnType(): Type; |
| 47: | |
| 48: | } |
| 49: |