1 | <?php |
||||||
2 | namespace App\Form; |
||||||
3 | |||||||
4 | trait FormTrait |
||||||
5 | { |
||||||
6 | /** |
||||||
7 | * @return self|mixed return model itself if has errors, otherwise returns handled's result. |
||||||
8 | * @throws \Throwable rethrows exception if no error specified. |
||||||
9 | */ |
||||||
10 | 3 | public function handle() |
|||||
11 | { |
||||||
12 | try { |
||||||
13 | 3 | if (!$this->validate()) { |
|||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
14 | 2 | return $this; |
|||||
15 | } |
||||||
16 | |||||||
17 | 1 | $data = $this->handleInternal(); |
|||||
0 ignored issues
–
show
The method
handleInternal() does not exist on App\Form\FormTrait . Did you maybe mean handle() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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.
Loading history...
|
|||||||
18 | 1 | return $data; |
|||||
19 | } catch (\Throwable $e) { |
||||||
20 | if ($this->hasErrors()) { |
||||||
0 ignored issues
–
show
It seems like
hasErrors() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
21 | return $this; |
||||||
22 | } |
||||||
23 | |||||||
24 | throw $e; |
||||||
25 | } |
||||||
26 | } |
||||||
27 | } |
||||||
28 |