| Conditions | 3 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function createFormForClass($className) |
||
| 38 | { |
||
| 39 | $form = $this->factory->create(); |
||
| 40 | |||
| 41 | try { |
||
| 42 | foreach ($this->mapper->getApiProperties($className) as $apiProperty) { |
||
| 43 | $form->add( |
||
| 44 | $apiProperty, |
||
| 45 | $this->factory->createForProperty( |
||
|
|
|||
| 46 | $className, |
||
| 47 | $this->mapper->getObjectProperty($className, $apiProperty) |
||
| 48 | ) |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } catch (\Exception $exception) { |
||
| 52 | throw new EntityProcessingException( |
||
| 53 | sprintf( |
||
| 54 | 'Cannot create form for class %s: %s', |
||
| 55 | $className, |
||
| 56 | $exception->getMessage() |
||
| 57 | ), |
||
| 58 | $exception->getCode(), |
||
| 59 | $exception |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | |||
| 63 | return $form; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
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: