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