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

Passed
Push — fix-uploaders ( 5b8cb7...c8e752 )
by Pedro
15:13
created
src/app/Library/Validation/Rules/BackpackCustomRule.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 
30 30
     public bool $implicit = true;
31 31
 
32
-    public static function field(string|array|ValidationRule|Rule $rules = []): self
32
+    public static function field(string | array | ValidationRule | Rule $rules = []): self
33 33
     {
34 34
         $instance = new static();
35 35
         $instance->fieldRules = self::getRulesAsArray($rules);
36 36
 
37 37
         if ($instance->validatesArrays()) {
38
-            if (! in_array('array', $instance->getFieldRules())) {
38
+            if (!in_array('array', $instance->getFieldRules())) {
39 39
                 $instance->fieldRules[] = 'array';
40 40
             }
41 41
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     public function getFieldRules(): array
97 97
     {
98
-        return tap($this->fieldRules, function ($rule) {
98
+        return tap($this->fieldRules, function($rule) {
99 99
             if (is_a($rule, BackpackCustomRule::class, true)) {
100 100
                 $rule = $rule->getFieldRules();
101 101
             }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $rules = explode('|', $rules);
111 111
         }
112 112
 
113
-        if (! is_array($rules)) {
113
+        if (!is_array($rules)) {
114 114
             $rules = [$rules];
115 115
         }
116 116
 
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
     protected function ensureValueIsValid($value)
121 121
     {
122
-        if ($this->validatesArrays() && ! is_array($value)) {
122
+        if ($this->validatesArrays() && !is_array($value)) {
123 123
             try {
124 124
                 $value = json_decode($value, true) ?? [];
125
-            } catch(\Exception $e) {
125
+            } catch (\Exception $e) {
126 126
                 return false;
127 127
             }
128 128
         }
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
             $attribute => $rules,
142 142
         ], $this->validator->customMessages, $this->getValidatorCustomAttributes($attribute));
143 143
        
144
-        return $validator->errors()->messages()[$attribute] ?? (! empty($validator->errors()->messages()) ? current($validator->errors()->messages()) : []);
144
+        return $validator->errors()->messages()[$attribute] ?? (!empty($validator->errors()->messages()) ? current($validator->errors()->messages()) : []);
145 145
     }
146 146
 
147 147
     private function getValidatorCustomAttributes(string $attribute): array
148 148
     {
149
-        if(! is_a($this, ValidGenericAjaxEndpoint::class) && ! Str::contains($attribute, '.*.')) {
149
+        if (!is_a($this, ValidGenericAjaxEndpoint::class) && !Str::contains($attribute, '.*.')) {
150 150
             return $this->validator->customAttributes;
151 151
         }
152 152
         // generic fallback to `profile picture` from `profile.*.picture`
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
     protected function getValidationAttributeString(string $attribute)
156 156
     {
157 157
         return Str::substrCount($attribute, '.') > 1 ?
158
-                Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') :
159
-                $attribute;
158
+                Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : $attribute;
160 159
     }
161 160
 
162 161
     protected function validateOnSubmit(string $attribute, mixed $value): array
@@ -164,7 +163,7 @@  discard block
 block discarded – undo
164 163
         return $this->validateRules($attribute, $value);
165 164
     }
166 165
 
167
-    protected function validateFieldAndFile(string $attribute, null|array $data = null, array|null $customRules = null): array
166
+    protected function validateFieldAndFile(string $attribute, null | array $data = null, array | null $customRules = null): array
168 167
     {
169 168
         $fieldErrors = $this->validateFieldRules($attribute, $data, $customRules);
170 169
 
@@ -176,7 +175,7 @@  discard block
 block discarded – undo
176 175
     /**
177 176
      * Implementation.
178 177
      */
179
-    public function validateFieldRules(string $attribute, null|array|string|UploadedFile $data = null, array|null $customRules = null): array
178
+    public function validateFieldRules(string $attribute, null | array | string | UploadedFile $data = null, array | null $customRules = null): array
180 179
     {
181 180
         $data = $data ?? $this->data;
182 181
         $validationRuleAttribute = $this->getValidationAttributeString($attribute);
@@ -185,16 +184,16 @@  discard block
 block discarded – undo
185 184
         return $this->validateAndGetErrors($validationRuleAttribute, $data, $customRules ?? $this->getFieldRules());
186 185
     }
187 186
 
188
-    protected function prepareValidatorData(array|string|UploadedFile $data, string $attribute): array
187
+    protected function prepareValidatorData(array | string | UploadedFile $data, string $attribute): array
189 188
     {
190
-        if ($this->validatesArrays() && is_array($data) && ! Str::contains($attribute, '.')) {
189
+        if ($this->validatesArrays() && is_array($data) && !Str::contains($attribute, '.')) {
191 190
             return Arr::has($data, $attribute) ? $data : [$attribute => $data];
192 191
         }
193 192
 
194 193
         if (Str::contains($attribute, '.')) {
195 194
             $validData = [];
196 195
 
197
-            Arr::set($validData, $attribute, ! is_array($data) ? $data : Arr::get($data, $attribute));
196
+            Arr::set($validData, $attribute, !is_array($data) ? $data : Arr::get($data, $attribute));
198 197
 
199 198
             return $validData;
200 199
         }
@@ -209,7 +208,7 @@  discard block
 block discarded – undo
209 208
         $validationRuleAttribute = $this->getValidationAttributeString($attribute);
210 209
         
211 210
         $filesToValidate = Arr::get($items, $attribute);
212
-        $filesToValidate = is_array($filesToValidate) ? array_filter($filesToValidate, function ($item) {
211
+        $filesToValidate = is_array($filesToValidate) ? array_filter($filesToValidate, function($item) {
213 212
             return $item instanceof UploadedFile;
214 213
         }) : (is_a($filesToValidate, UploadedFile::class, true) ? [$filesToValidate] : []);
215 214
 
Please login to merge, or discard this patch.