1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Reflection; |
4: | |
5: | use PHPStan\TrinaryLogic; |
6: | use PHPStan\Type\Type; |
7: | |
8: | /** |
9: | * The purpose of this interface is to be able to |
10: | * answer more questions about methods |
11: | * without breaking backward compatibility |
12: | * with existing MethodsClassReflectionExtension. |
13: | * |
14: | * Developers are meant to only implement MethodReflection |
15: | * and its methods in their code. |
16: | * |
17: | * New methods on ExtendedMethodReflection will be added |
18: | * in minor versions. |
19: | * |
20: | * @api |
21: | */ |
22: | interface ExtendedMethodReflection extends MethodReflection |
23: | { |
24: | |
25: | /** |
26: | * @return list<ExtendedParametersAcceptor> |
27: | */ |
28: | public function getVariants(): array; |
29: | |
30: | /** |
31: | * @internal |
32: | */ |
33: | public function getOnlyVariant(): ExtendedParametersAcceptor; |
34: | |
35: | /** |
36: | * @return list<ExtendedParametersAcceptor>|null |
37: | */ |
38: | public function getNamedArgumentsVariants(): ?array; |
39: | |
40: | public function acceptsNamedArguments(): TrinaryLogic; |
41: | |
42: | public function getAsserts(): Assertions; |
43: | |
44: | public function getSelfOutType(): ?Type; |
45: | |
46: | public function returnsByReference(): TrinaryLogic; |
47: | |
48: | public function isFinalByKeyword(): TrinaryLogic; |
49: | |
50: | public function isAbstract(): TrinaryLogic|bool; |
51: | |
52: | public function isBuiltin(): TrinaryLogic|bool; |
53: | |
54: | /** |
55: | * This indicates whether the method has phpstan-pure |
56: | * or phpstan-impure annotation above it. |
57: | * |
58: | * In most cases asking hasSideEffects() is much more practical |
59: | * as it also accounts for void return type (method being always impure). |
60: | */ |
61: | public function isPure(): TrinaryLogic; |
62: | |
63: | /** |
64: | * @return list<AttributeReflection> |
65: | */ |
66: | public function getAttributes(): array; |
67: | |
68: | /** |
69: | * Has the #[\NoDiscard] attribute - on PHP 8.5+ if the function's return |
70: | * value is unused at runtime a warning is emitted, PHPStan will emit the |
71: | * warning during analysis and on older PHP versions too |
72: | */ |
73: | public function mustUseReturnValue(): TrinaryLogic; |
74: | |
75: | } |
76: |