Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
34 | 1 | public function updateEntity($entity, $data) |
|
35 | { |
||
36 | 1 | $form = $this->factory->create($this->form, $entity, $this->options); |
|
|
|||
37 | |||
38 | 1 | $form->submit($data, false); |
|
39 | |||
40 | 1 | if (!$form->isValid()) { |
|
41 | 1 | throw EntityProcessingException::invalidDataSubmitted((string)$form->getErrors(true), $data); |
|
42 | } |
||
43 | |||
44 | 1 | return $form->getData(); |
|
45 | } |
||
46 | } |
||
47 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.