| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 4 | public function read($object) |
|
| 18 | { |
||
| 19 | |||
| 20 | |||
| 21 | 4 | $reflectionObject = new \ReflectionObject($object); |
|
| 22 | |||
| 23 | 4 | foreach ($reflectionObject->getMethods() as $reflectionMethod) { |
|
| 24 | |||
| 25 | /** |
||
| 26 | * Weird but still be need to do this. |
||
| 27 | */ |
||
| 28 | 4 | new $this->annotationClass; |
|
| 29 | |||
| 30 | /** |
||
| 31 | * Autoload or instantiate the object |
||
| 32 | */ |
||
| 33 | 4 | $annotation = $this->reader->getMethodAnnotation($reflectionMethod, $this->annotationClass); |
|
| 34 | |||
| 35 | 4 | Filters::addFilter( |
|
| 36 | 4 | $annotation->getPropertyName(), |
|
| 37 | 4 | [$object, $reflectionMethod->name], |
|
|
|
|||
| 38 | 4 | $annotation->priority |
|
| 39 | 2 | ); |
|
| 40 | 2 | } |
|
| 41 | 4 | } |
|
| 42 | } |
||
| 43 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: