1 | <?php |
||
14 | class RawPropertyAccessor |
||
15 | { |
||
16 | /** |
||
17 | * The object being accessed |
||
18 | * |
||
19 | * @var object |
||
20 | */ |
||
21 | protected $object; |
||
22 | |||
23 | /** |
||
24 | * A PHP Reflector for access |
||
25 | * |
||
26 | * @var ReflectionClass |
||
27 | */ |
||
28 | protected $reflector; |
||
29 | |||
30 | /** |
||
31 | * @param object $object The object to access |
||
32 | * @param ReflectionModel|null $reflect A reflection entity |
||
|
|||
33 | */ |
||
34 | 1 | public function __construct($object) |
|
39 | |||
40 | /** |
||
41 | * Access a property and sets it with the given value, irrespective |
||
42 | * of access permissions |
||
43 | * |
||
44 | * @param string $key The property to write to |
||
45 | * @param mixed $value The value to set |
||
46 | * @throws CannotWritePropertyException In the event the property |
||
47 | * does not exist |
||
48 | */ |
||
49 | 2 | public function setRawValue($key, $value) |
|
58 | |||
59 | /** |
||
60 | * Access a property and returns its value, irresepective of access |
||
61 | * permissions |
||
62 | * |
||
63 | * @param string $key The property to read |
||
64 | * @return mixed The property's value |
||
65 | * @throws CannotReadPropertyException In the event the property |
||
66 | * does not exist |
||
67 | */ |
||
68 | 1 | public function getRawValue($key) |
|
78 | |||
79 | /** |
||
80 | * Adds a value to a property, irrespective of access permissions |
||
81 | * |
||
82 | * @param string $key The property to write to |
||
83 | * @param mixed $value The value to add |
||
84 | * @throws CannotWritePropertyException In the event the property |
||
85 | * does not exist |
||
86 | */ |
||
87 | 2 | public function rawAddToValue($key, $value) |
|
96 | |||
97 | /** |
||
98 | * Checks if a property exists and returns its ReflectionProperty |
||
99 | * |
||
100 | * @param string $key The property to access |
||
101 | * @param string $class The name of the exception to throw on error |
||
102 | * @throws $class If the property does not exist |
||
103 | * @return ReflectionProperty |
||
104 | */ |
||
105 | 4 | private function getPropertyOrFail($key, $class) |
|
124 | } |
||
125 |
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.