| Conditions | 7 |
| Paths | 24 |
| Total Lines | 31 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 56 | public function getFlattenErrors(FormInterface $form = null, $subForm = false) |
||
| 57 | { |
||
| 58 | $form = $form ?: $this->form; |
||
| 59 | $flatten = []; |
||
| 60 | |||
| 61 | foreach ($form->getErrors() as $error) { |
||
| 62 | if ($subForm) { |
||
| 63 | $flatten[] = $error->getMessage(); |
||
|
|
|||
| 64 | } else { |
||
| 65 | $path = $error->getCause()->getPropertyPath(); |
||
| 66 | |||
| 67 | if (!array_key_exists($path, $flatten)) { |
||
| 68 | $flatten[$path] = [$error->getMessage()]; |
||
| 69 | continue; |
||
| 70 | } |
||
| 71 | |||
| 72 | $flatten[$path][] = $error->getMessage(); |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | $subForm = true; |
||
| 77 | foreach ($form->all() as $key => $child) { |
||
| 78 | $childErrors = $this->getFlattenErrors($child, $subForm); |
||
| 79 | |||
| 80 | if (!empty($childErrors)) { |
||
| 81 | $flatten[$key] = $childErrors; |
||
| 82 | } |
||
| 83 | } |
||
| 84 | |||
| 85 | return $flatten; |
||
| 86 | } |
||
| 87 | } |
||
| 88 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.