| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function store(StoreFormRequest $request, Filesystem $files) |
||
| 19 | { |
||
| 20 | $path = storage_path('tmp'); |
||
| 21 | |||
| 22 | if (! $files->isDirectory($path)) { |
||
| 23 | $files->makeDirectory($path, 0777, true); |
||
| 24 | } |
||
| 25 | |||
| 26 | $file = $request->file('file'); |
||
| 27 | |||
| 28 | $file->move($path, $name = uniqid() . '_' . trim($file->getClientOriginalName())); |
||
| 29 | |||
| 30 | return response()->json([ |
||
|
|
|||
| 31 | 'name' => $name, |
||
| 32 | 'original_name' => $file->getClientOriginalName(), |
||
| 33 | ]); |
||
| 34 | } |
||
| 35 | |||
| 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: