We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | $errors[] = $this->validateAndGetErrors($attribute, [$attribute => $sentFiles], $this->getFileRules()); |
| 208 | 208 | } |
| 209 | 209 | continue; |
| 210 | - }catch(\Exception) { |
|
| 210 | + } catch(\Exception) { |
|
| 211 | 211 | $errors[] = 'Unknown datatype, aborting upload process.'; |
| 212 | 212 | break; |
| 213 | 213 | } |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public bool $implicit = true; |
| 30 | 30 | |
| 31 | - public static function field(string|array|ValidationRule|Rule $rules = []): self |
|
| 31 | + public static function field(string | array | ValidationRule | Rule $rules = []): self |
|
| 32 | 32 | { |
| 33 | 33 | $instance = new static(); |
| 34 | 34 | $instance->fieldRules = self::getRulesAsArray($rules); |
| 35 | 35 | |
| 36 | - if($instance->validatesArrays()) { |
|
| 37 | - if (! in_array('array', $instance->getFieldRules())) { |
|
| 36 | + if ($instance->validatesArrays()) { |
|
| 37 | + if (!in_array('array', $instance->getFieldRules())) { |
|
| 38 | 38 | $instance->fieldRules[] = 'array'; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function getFieldRules(): array |
| 95 | 95 | { |
| 96 | - return tap($this->fieldRules, function ($rule) { |
|
| 96 | + return tap($this->fieldRules, function($rule) { |
|
| 97 | 97 | if (is_a($rule, BackpackCustomRule::class, true)) { |
| 98 | 98 | $rule = $rule->getFieldRules(); |
| 99 | 99 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $rules = explode('|', $rules); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (! is_array($rules)) { |
|
| 111 | + if (!is_array($rules)) { |
|
| 112 | 112 | $rules = [$rules]; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | protected function ensureValueIsValid($value) |
| 119 | 119 | { |
| 120 | - if($this->validatesArrays() && ! is_array($value)) { |
|
| 120 | + if ($this->validatesArrays() && !is_array($value)) { |
|
| 121 | 121 | try { |
| 122 | 122 | $value = json_decode($value, true) ?? []; |
| 123 | - } catch(\Exception $e) { |
|
| 123 | + } catch (\Exception $e) { |
|
| 124 | 124 | return false; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -144,8 +144,7 @@ discard block |
||
| 144 | 144 | protected function getValidationAttributeString(string $attribute) |
| 145 | 145 | { |
| 146 | 146 | return Str::substrCount($attribute, '.') > 1 ? |
| 147 | - Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : |
|
| 148 | - $attribute; |
|
| 147 | + Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : $attribute; |
|
| 149 | 148 | } |
| 150 | 149 | |
| 151 | 150 | protected function validateOnSubmit(string $attribute, mixed $value): array |
@@ -153,7 +152,7 @@ discard block |
||
| 153 | 152 | return $this->validateRules($attribute, $value); |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | - protected function validateFieldAndFile(string $attribute, null|array $data = null, array|null $customRules = null): array |
|
| 155 | + protected function validateFieldAndFile(string $attribute, null | array $data = null, array | null $customRules = null): array |
|
| 157 | 156 | { |
| 158 | 157 | $fieldErrors = $this->validateFieldRules($attribute, $data, $customRules); |
| 159 | 158 | $fileErrors = $this->validateFileRules($attribute, $data); |
@@ -164,7 +163,7 @@ discard block |
||
| 164 | 163 | /** |
| 165 | 164 | * Implementation. |
| 166 | 165 | */ |
| 167 | - public function validateFieldRules(string $attribute, null|array|UploadedFile $data = null, array|null $customRules = null): array |
|
| 166 | + public function validateFieldRules(string $attribute, null | array | UploadedFile $data = null, array | null $customRules = null): array |
|
| 168 | 167 | { |
| 169 | 168 | $data = $data ?? $this->data; |
| 170 | 169 | $validationRuleAttribute = $this->getValidationAttributeString($attribute); |
@@ -174,10 +173,10 @@ discard block |
||
| 174 | 173 | return $this->validateAndGetErrors($validationRuleAttribute, $data, $customRules ?? $this->getFieldRules()); |
| 175 | 174 | } |
| 176 | 175 | |
| 177 | - protected function prepareValidatorData(array|UploadedFile $data, string $attribute): array |
|
| 176 | + protected function prepareValidatorData(array | UploadedFile $data, string $attribute): array |
|
| 178 | 177 | { |
| 179 | 178 | |
| 180 | - if($this->validatesArrays() && is_array($data)) { |
|
| 179 | + if ($this->validatesArrays() && is_array($data)) { |
|
| 181 | 180 | return Arr::has($data, $attribute) ? $data : [$attribute => Arr::get($data, $attribute)]; |
| 182 | 181 | } |
| 183 | 182 | return [$attribute => $data]; |
@@ -191,13 +190,13 @@ discard block |
||
| 191 | 190 | $errors = []; |
| 192 | 191 | // we validate each file individually to avoid returning messages like: `field.0` is not a pdf. |
| 193 | 192 | foreach ($items as $sentFiles) { |
| 194 | - if(!is_array($sentFiles)) { |
|
| 193 | + if (!is_array($sentFiles)) { |
|
| 195 | 194 | try { |
| 196 | 195 | if (is_file($sentFiles)) { |
| 197 | 196 | $errors[] = $this->validateAndGetErrors($attribute, [$attribute => $sentFiles], $this->getFileRules()); |
| 198 | 197 | } |
| 199 | 198 | continue; |
| 200 | - }catch(\Exception) { |
|
| 199 | + } catch (\Exception) { |
|
| 201 | 200 | $errors[] = 'Unknown datatype, aborting upload process.'; |
| 202 | 201 | break; |
| 203 | 202 | } |