Issues (96)

src/Support/BasicFileUpload.php (4 issues)

1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Support;
4
5
use Ikechukwukalu\Clamavfileupload\Foundation\FileUpload;
6
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
7
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
8
9
class BasicFileUpload extends FileUpload
10
{
11
12
    /**
13
     * Run files scan and upload.
14
     *
15
     * @return  \Ikechukwukalu\Clamavfileupload\Models\FileUpload
16
     * @return  \Illuminate\Database\Eloquent\Collection
17
     * @return  bool
18
     */
19
    public function fileUpload(): bool|FileUploadModel|EloquentCollection
20
    {
21
        if($this->request->file()) {
22
            if (!$this->storeFiles()) {
23
                return $this->failedUpload(trans('clamavfileupload::clamav.failed'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->failedUplo...pload::clamav.failed')) returns the type false which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
24
            }
25
26
            if (is_array($this->request->file($this->input))) {
27
                return $this->insertMultipleFiles();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->insertMultipleFiles() returns the type Illuminate\Database\Eloquent\Collection|boolean which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
28
            }
29
30
            return $this->insertSingleFile();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->insertSingleFile() also could return the type boolean which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
31
        }
32
33
        $this->failedUpload(trans('clamavfileupload::clamav.empty_file_input'));
34
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type Ikechukwukalu\Clamavfileupload\Models\FileUpload.
Loading history...
35
    }
36
}
37