UniSharp /
laravel-uploadable
| 1 | <?php |
||||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||
| 2 | |||||
|
0 ignored issues
–
show
|
|||||
| 3 | namespace UniSharp\Uploadable\Traits; |
||||
| 4 | |||||
| 5 | use UniSharp\Uploadable\File; |
||||
| 6 | use Illuminate\Database\Eloquent\Relations\MorphOne; |
||||
| 7 | use Illuminate\Database\Eloquent\Relations\MorphMany; |
||||
| 8 | |||||
| 9 | trait WithFiles |
||||
|
0 ignored issues
–
show
|
|||||
| 10 | { |
||||
|
0 ignored issues
–
show
|
|||||
| 11 | use Helpers; |
||||
| 12 | |||||
| 13 | public static function bootWithFiles(): void |
||||
|
0 ignored issues
–
show
|
|||||
| 14 | { |
||||
|
0 ignored issues
–
show
|
|||||
| 15 | static::deleted(function ($model) { |
||||
|
0 ignored issues
–
show
|
|||||
| 16 | 4 | $model->files->each(function ($file) { |
|||
|
0 ignored issues
–
show
|
|||||
| 17 | 4 | $file->delete(); |
|||
| 18 | 4 | }); |
|||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||||
| 19 | 6 | }); |
|||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||||
| 20 | 2 | } |
|||
|
0 ignored issues
–
show
|
|||||
| 21 | |||||
| 22 | 6 | public function file(): MorphOne |
|||
|
0 ignored issues
–
show
|
|||||
| 23 | { |
||||
|
0 ignored issues
–
show
|
|||||
| 24 | 6 | return $this->morphOne(File::class, 'uploadable')->latest('id'); |
|||
|
0 ignored issues
–
show
It seems like
morphOne() 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...
|
|||||
| 25 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 26 | |||||
| 27 | 6 | public function files(): MorphMany |
|||
|
0 ignored issues
–
show
|
|||||
| 28 | { |
||||
|
0 ignored issues
–
show
|
|||||
| 29 | 6 | return $this->morphMany(File::class, 'uploadable'); |
|||
|
0 ignored issues
–
show
It seems like
morphMany() 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...
|
|||||
| 30 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 31 | |||||
| 32 | 6 | public function bindFile(File $file, $extra = null): self |
|||
|
0 ignored issues
–
show
|
|||||
| 33 | { |
||||
|
0 ignored issues
–
show
|
|||||
| 34 | 6 | return $this->bindUploadable($file, $extra); |
|||
| 35 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 36 | } |
||||
|
0 ignored issues
–
show
|
|||||
| 37 |