1 | <?php |
||
21 | class ReflectionUtility |
||
22 | { |
||
23 | /** |
||
24 | * Create a new class reflection. Do not use the makeInstance or objectManager |
||
25 | * because the reflection API is also used in front of the caching framework. |
||
26 | * |
||
27 | * @param string $className |
||
28 | * |
||
29 | * @return ClassReflection |
||
30 | */ |
||
31 | public static function createReflectionClass($className) |
||
35 | |||
36 | /** |
||
37 | * Check if the given class is instantiable. |
||
38 | * |
||
39 | * @param string $className |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public static function isInstantiable($className):bool |
||
53 | |||
54 | /** |
||
55 | * Get the name of the parent class. |
||
56 | * |
||
57 | * @param string $className |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function getParentClassName($className) |
||
67 | |||
68 | /** |
||
69 | * Get all properties that are tagged with the given tag. |
||
70 | * |
||
71 | * @param string $className |
||
72 | * @param string $tag |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | public static function getPropertiesTaggedWith($className, $tag) |
||
89 | |||
90 | /** |
||
91 | * Get all properties that are tagged with the given tag. |
||
92 | * |
||
93 | * @param string $className |
||
94 | * @param string $tag |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | public static function getPropertyNamesTaggedWith($className, $tag):array |
||
111 | |||
112 | /** |
||
113 | * Get all public methods of the given class. |
||
114 | * |
||
115 | * @param string $className |
||
116 | * |
||
117 | * @return MethodReflection[] |
||
118 | */ |
||
119 | public static function getPublicMethods($className) |
||
124 | |||
125 | /** |
||
126 | * Get first class tag information. |
||
127 | * The trimmed value if the tag exists and FALSE if the tag do not exists. |
||
128 | * |
||
129 | * @param string $className |
||
130 | * @param string $tag |
||
131 | * |
||
132 | * @return string|bool |
||
133 | */ |
||
134 | public static function getFirstTagValue(string $className, string $tag) |
||
147 | |||
148 | /** |
||
149 | * Get the tag configuration from this method and respect multiple line and space configuration. |
||
150 | * |
||
151 | * @param MethodReflection|ClassReflection $reflectionObject |
||
152 | * @param array $tagNames |
||
153 | * |
||
154 | * @return array |
||
155 | */ |
||
156 | public static function getTagConfiguration($reflectionObject, array $tagNames): array |
||
175 | |||
176 | |||
177 | /** |
||
178 | * Get the tag configuration from this method and respect multiple line and space configuration. |
||
179 | * |
||
180 | * @param MethodReflection|ClassReflection $reflectionObject |
||
|
|||
181 | * @param array $tagNames |
||
182 | * |
||
183 | * @return array |
||
184 | */ |
||
185 | public static function getTagConfigurationForMethod($className, $methodName, array $tagNames): array |
||
205 | |||
206 | |||
207 | /** |
||
208 | * Get the tag configuration from this method and respect multiple line and space configuration. |
||
209 | * |
||
210 | * @param MethodReflection|ClassReflection $reflectionObject |
||
211 | * @param array $tagNames |
||
212 | * |
||
213 | * @return array |
||
214 | */ |
||
215 | public static function getTagConfigurationForClass($className, array $tagNames): array |
||
236 | |||
237 | |||
238 | |||
239 | /** |
||
240 | * Get public method names |
||
241 | * |
||
242 | * @param string $className |
||
243 | * @return array |
||
244 | */ |
||
245 | public static function getPublicMethodNames(string $className): array |
||
266 | |||
267 | /** |
||
268 | * Get properties of the given class, that are als declared in the given class. |
||
269 | * |
||
270 | * @param string $className |
||
271 | * |
||
272 | * @return array |
||
273 | */ |
||
274 | public static function getDeclaringProperties($className) |
||
289 | |||
290 | /** |
||
291 | * Is 9 or higher |
||
292 | * |
||
293 | * @return bool |
||
294 | */ |
||
295 | public static function is9orHigher(): bool |
||
299 | } |
||
300 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.