@@ -64,6 +64,9 @@ final class ContextFactory
64
64
public function createFromReflector (Reflector $ reflector ) : Context
65
65
{
66
66
if ($ reflector instanceof ReflectionClass) {
67
+ //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
68
+ /** @var ReflectionClass<object> $reflector */
69
+
67
70
return $ this ->createFromReflectionClass ($ reflector );
68
71
}
69
72
@@ -89,33 +92,45 @@ public function createFromReflector(Reflector $reflector) : Context
89
92
private function createFromReflectionParameter (ReflectionParameter $ parameter ) : Context
90
93
{
91
94
$ class = $ parameter ->getDeclaringClass ();
92
- if ($ class ) {
93
- //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
94
- /** @var ReflectionClass<object> $class */
95
-
96
- return $ this ->createFromReflectionClass ($ class );
95
+ if (!$ class ) {
96
+ throw new InvalidArgumentException ('Unable to get class of ' . $ parameter ->getName ());
97
97
}
98
98
99
- throw new InvalidArgumentException ('Unable to get class of ' . $ parameter ->getName ());
99
+ //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
100
+ /** @var ReflectionClass<object> $class */
101
+
102
+ return $ this ->createFromReflectionClass ($ class );
100
103
}
101
104
102
105
private function createFromReflectionMethod (ReflectionMethod $ method ) : Context
103
106
{
104
- return $ this ->createFromReflectionClass ($ method ->getDeclaringClass ());
107
+ //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
108
+ /** @var ReflectionClass<object> $class */
109
+ $ class = $ method ->getDeclaringClass ();
110
+
111
+ return $ this ->createFromReflectionClass ($ class );
105
112
}
106
113
107
114
private function createFromReflectionProperty (ReflectionProperty $ property ) : Context
108
115
{
109
- return $ this ->createFromReflectionClass ($ property ->getDeclaringClass ());
116
+ //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
117
+ /** @var ReflectionClass<object> $class */
118
+ $ class = $ property ->getDeclaringClass ();
119
+
120
+ return $ this ->createFromReflectionClass ($ class );
110
121
}
111
122
112
123
private function createFromReflectionClassConstant (ReflectionClassConstant $ constant ) : Context
113
124
{
114
- return $ this ->createFromReflectionClass ($ constant ->getDeclaringClass ());
125
+ //phpcs:ignore SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable
126
+ /** @var ReflectionClass<object> $class */
127
+ $ class = $ constant ->getDeclaringClass ();
128
+
129
+ return $ this ->createFromReflectionClass ($ class );
115
130
}
116
131
117
132
/**
118
- * @phpstan- param ReflectionClass<object> $class
133
+ * @param ReflectionClass<object> $class
119
134
*/
120
135
private function createFromReflectionClass (ReflectionClass $ class ) : Context
121
136
{
0 commit comments