| Conditions | 3 |
| Paths | 2 |
| Total Lines | 32 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 1 | public function __invoke(Request $request) |
|
| 18 | { |
||
| 19 | // the Admin with auto injected with the KernelSubscriber |
||
| 20 | $this |
||
| 21 | 1 | ->admin |
|
| 22 | 1 | ->handleRequest($request) |
|
| 23 | ; |
||
| 24 | |||
| 25 | // create the associated form type |
||
| 26 | $form = $this |
||
| 27 | 1 | ->formFactory |
|
| 28 | 1 | ->create( |
|
| 29 | 1 | $this->configuration->getParameter('form'), |
|
| 30 | 1 | $this->admin->getUniqueEntity(), |
|
| 31 | 1 | $this->configuration->getParameter('form_options') |
|
| 32 | ) |
||
| 33 | ; |
||
| 34 | 1 | $form->handleRequest($request); |
|
| 35 | |||
| 36 | 1 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 37 | // save the updated entity |
||
| 38 | $this |
||
| 39 | 1 | ->admin |
|
| 40 | 1 | ->save() |
|
| 41 | ; |
||
| 42 | } |
||
| 43 | |||
| 44 | return $this |
||
|
|
|||
| 45 | 1 | ->responder |
|
| 46 | 1 | ->respond($this->configuration, $this->admin, $form, $request) |
|
| 47 | ; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: