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