1: <?php declare(strict_types = 1);
2:
3: namespace PHPStan\Reflection;
4:
5: use PHPStan\TrinaryLogic;
6: use PHPStan\Turbo\ReferencedByTurboExtension;
7: use PHPStan\Type\Type;
8:
9: /**
10: * Reflection for a class method.
11: *
12: * This is the interface extension developers should implement when creating custom
13: * MethodsClassReflectionExtension implementations for magic methods (__call, etc.).
14: *
15: * Methods can have multiple "variants" (overloaded signatures) — for example,
16: * built-in functions like `array_map` have different signatures depending on
17: * the number of arguments. Each variant is a ParametersAcceptor.
18: *
19: * For additional method metadata (assertions, purity, named arguments, attributes),
20: * see ExtendedMethodReflection which extends this interface.
21: *
22: * @api
23: */
24: #[ReferencedByTurboExtension(key: 'methodReflection')]
25: interface MethodReflection extends ClassMemberReflection
26: {
27:
28: public function getName(): string;
29:
30: /**
31: * For methods that override a parent method, this returns the parent's
32: * method reflection. For methods with no parent, returns itself.
33: */
34: public function getPrototype(): ClassMemberReflection;
35:
36: /**
37: * Most methods have a single variant. Built-in PHP functions with overloaded
38: * signatures (e.g. different return types based on argument count) have multiple.
39: *
40: * @return list<ParametersAcceptor>
41: */
42: public function getVariants(): array;
43:
44: public function isDeprecated(): TrinaryLogic;
45:
46: public function getDeprecatedDescription(): ?string;
47:
48: public function isFinal(): TrinaryLogic;
49:
50: public function isInternal(): TrinaryLogic;
51:
52: public function getThrowType(): ?Type;
53:
54: /**
55: * Void methods are always considered impure since they must do something
56: * to be useful.
57: */
58: public function hasSideEffects(): TrinaryLogic;
59:
60: }
61: