Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Test Failed
Push — add-method-to-get-ajax-uploade... ( 20693f...16244a )
by Pedro
11:40
created

ValidUpload::validateRules()   A

Complexity

Conditions 5
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 7
c 0
b 0
f 0
nc 3
nop 2
dl 0
loc 15
rs 9.6111
1
<?php
2
3
namespace Backpack\CRUD\app\Library\Validation\Rules;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade;
6
use Backpack\CRUD\app\Library\Validation\Rules\Support\HasFiles;
7
use Closure;
8
use Illuminate\Contracts\Validation\Rule;
9
use Illuminate\Contracts\Validation\ValidationRule;
10
use Illuminate\Support\Facades\Validator;
11
12
class ValidUpload extends BackpackCustomRule
13
{
14
    use HasFiles;
15
16
    /**
17
     * Run the validation rule.
18
     *
19
     * @param  string  $attribute
20
     * @param  mixed  $value
21
     * @param  Closure(string): \Illuminate\Translation\PotentiallyTranslatedString  $fail
22
     * @return void
23
     */
24
    public function validateRules(string $attribute, mixed $value): array
25
    {
26
        $entry = CrudPanelFacade::getCurrentEntry();
0 ignored issues
show
Bug introduced by
The method getCurrentEntry() does not exist on Backpack\CRUD\app\Librar...udPanel\CrudPanelFacade. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        /** @scrutinizer ignore-call */ 
27
        $entry = CrudPanelFacade::getCurrentEntry();
Loading history...
27
28
        if (! array_key_exists($attribute, $this->data) && $entry) {
29
            return [];
0 ignored issues
show
Bug Best Practice introduced by
The expression return array() returns the type array which is incompatible with the documented return type void.
Loading history...
30
        }
31
32
        $fieldErrors = $this->validateFieldRules($attribute, $value);
33
34
        if (! empty($value) && ! empty($this->getFileRules())) {
35
            $fileErrors = $this->validateFileRules($attribute, $value);
36
        }
37
38
        return array_merge($fieldErrors, $fileErrors ?? []);
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_merge($fiel...$fileErrors ?? array()) returns the type array which is incompatible with the documented return type void.
Loading history...
39
40
    }
41
42
    public static function field(string|array|ValidationRule|Rule $rules = []): self
43
    {
44
        return parent::field($rules);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::field($rules) returns the type Backpack\CRUD\app\Librar...ules\BackpackCustomRule which includes types incompatible with the type-hinted return Backpack\CRUD\app\Librar...ation\Rules\ValidUpload.
Loading history...
45
    }
46
}
47