PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.23.1
GiveWP – Donation Plugin and Fundraising Platform v2.23.1
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / .phpstan / Log / Methods / MagicCallStaticMethodReflection.php
MagicCallStaticMethodReflection.php
123 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\PHPStan\Log\Methods;
4
5 use Give\Log\Log;
6 use Give\PHPStan\Log\Parameters\ContextParameterReflection;
7 use Give\PHPStan\Log\Parameters\MessageParameterReflection;
8 use PHPStan\Analyser\OutOfClassScope;
9 use PHPStan\Reflection\ClassMemberReflection;
10 use PHPStan\Reflection\ClassReflection;
11 use PHPStan\Reflection\FunctionVariant;
12 use PHPStan\Reflection\MethodReflection;
13 use PHPStan\Type\Generic\TemplateTypeMap;
14 use PHPStan\Type\ObjectType;
15
16 /**
17 * Adds support for __callStatic method reflection to the LogMethodsReflectionExtension.
18 *
19 * @unreleased
20 */
21 class MagicCallStaticMethodReflection implements MethodReflection
22 {
23 private $classReflection;
24 private $name;
25 private $callStaticMethod;
26
27 public function __construct(ClassReflection $classReflection, string $name)
28 {
29 $this->classReflection = $classReflection;
30 $this->callStaticMethod = $this->classReflection->getMethod('__callStatic', new OutOfClassScope());
31 $this->name = $name;
32 }
33
34 public function getDeclaringClass(): ClassReflection
35 {
36 return $this->classReflection;
37 }
38
39 public function getPrototype(): ClassMemberReflection
40 {
41 return $this;
42 }
43
44 public function isStatic(): bool
45 {
46 return true;
47 }
48
49 public function isPrivate(): bool
50 {
51 return false;
52 }
53
54 public function isPublic(): bool
55 {
56 return true;
57 }
58
59 public function getName(): string
60 {
61 return $this->name;
62 }
63
64 public function isVariadic(): bool
65 {
66 return false;
67 }
68
69 /**
70 * @return \PHPStan\Reflection\ParametersAcceptor[]
71 */
72 public function getVariants(): array
73 {
74 return [
75 new FunctionVariant(
76 TemplateTypeMap::createEmpty(),
77 TemplateTypeMap::createEmpty(),
78 [
79 new MessageParameterReflection(),
80 new ContextParameterReflection(),
81 ],
82 false,
83 new ObjectType(Log::class)
84 ),
85 ];
86 }
87
88 public function getDocComment(): ?string
89 {
90 return $this->callStaticMethod->getDocComment();
91 }
92
93 public function isDeprecated(): \PHPStan\TrinaryLogic
94 {
95 return $this->callStaticMethod->isDeprecated();
96 }
97
98 public function getDeprecatedDescription(): ?string
99 {
100 return $this->callStaticMethod->getDeprecatedDescription();
101 }
102
103 public function isFinal(): \PHPStan\TrinaryLogic
104 {
105 return $this->callStaticMethod->isFinal();
106 }
107
108 public function isInternal(): \PHPStan\TrinaryLogic
109 {
110 return $this->callStaticMethod->isInternal();
111 }
112
113 public function getThrowType(): ?\PHPStan\Type\Type
114 {
115 return $this->callStaticMethod->getThrowType();
116 }
117
118 public function hasSideEffects(): \PHPStan\TrinaryLogic
119 {
120 return $this->callStaticMethod->hasSideEffects();
121 }
122 }
123