These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Encore\Admin\Form\Field; |
||
4 | |||
5 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
||
6 | |||
7 | class MultipleImage extends MultipleFile |
||
8 | { |
||
9 | use ImageField; |
||
10 | |||
11 | /** |
||
12 | * {@inheritdoc} |
||
13 | */ |
||
14 | protected $view = 'admin::form.multiplefile'; |
||
15 | |||
16 | /** |
||
17 | * Validation rules. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $rules = 'image'; |
||
22 | |||
23 | /** |
||
24 | * Prepare for each file. |
||
25 | * |
||
26 | * @param UploadedFile $image |
||
27 | * |
||
28 | * @return mixed|string |
||
29 | */ |
||
30 | View Code Duplication | protected function prepareForeach(UploadedFile $image = null) |
|
31 | { |
||
32 | $this->name = $this->getStoreName($image); |
||
33 | |||
34 | $this->callInterventionMethods($image->getRealPath()); |
||
35 | |||
36 | return tap($this->upload($image), function () { |
||
0 ignored issues
–
show
|
|||
37 | $this->name = null; |
||
38 | }); |
||
39 | } |
||
40 | } |
||
41 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):