1 | <?php |
||
12 | class Reflection |
||
13 | { |
||
14 | /** |
||
15 | * Get a property of an object. |
||
16 | * |
||
17 | * @param object|string $objectOrClass |
||
18 | * @param string $propertyName |
||
19 | * |
||
20 | * @return mixed |
||
21 | * |
||
22 | * @throws \InvalidArgumentException |
||
23 | */ |
||
24 | 24 | public static function getProperty($objectOrClass, $propertyName) |
|
28 | |||
29 | /** |
||
30 | * Set a property to an object. |
||
31 | * |
||
32 | * @param object|string $objectOrClass |
||
33 | * @param string $propertyName |
||
34 | * @param mixed $value |
||
35 | * |
||
36 | * @throws \InvalidArgumentException |
||
37 | */ |
||
38 | 9 | public static function setProperty($objectOrClass, $propertyName, $value) |
|
42 | |||
43 | /** |
||
44 | * Invoke a method on a object and get the return values. |
||
45 | * |
||
46 | * @param object|string $objectOrClass |
||
1 ignored issue
–
show
|
|||
47 | * @param string $methodName |
||
48 | * @param mixed ...$params |
||
49 | * |
||
50 | * @return mixed |
||
51 | * |
||
52 | * @throws \InvalidArgumentException |
||
53 | */ |
||
54 | 15 | public static function invokeMethod() |
|
83 | |||
84 | /** |
||
85 | * Get a reflection class that has this property. |
||
86 | * |
||
87 | * @param string $class |
||
88 | * @param string $propertyName |
||
89 | * |
||
90 | * @return \ReflectionClass|null |
||
91 | */ |
||
92 | 20 | protected static function getReflectionClassWithProperty($class, $propertyName) |
|
109 | |||
110 | /** |
||
111 | * Get an reflection property that you can access directly. |
||
112 | * |
||
113 | * @param object|string $objectOrClass |
||
114 | * @param string $propertyName |
||
115 | * |
||
116 | * @return \ReflectionProperty |
||
117 | * |
||
118 | * @throws \InvalidArgumentException |
||
119 | * @throws \LogicException if the property is not found on the object |
||
120 | */ |
||
121 | 24 | protected static function getAccessibleReflectionProperty($objectOrClass, $propertyName) |
|
142 | } |
||
143 |
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.