We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | { |
23 | 23 | $entry = CrudPanelFacade::getCurrentEntry(); |
24 | 24 | |
25 | - if (! array_key_exists($attribute, $this->data)) { |
|
25 | + if (!array_key_exists($attribute, $this->data)) { |
|
26 | 26 | |
27 | 27 | $requestAttribute = Arr::get($this->data, '_order_'.$attribute); |
28 | 28 | |
29 | - if($entry && Arr::get($entry->{Str::before($attribute, '.')}, Str::after($attribute, '.')) === $requestAttribute) { |
|
29 | + if ($entry && Arr::get($entry->{Str::before($attribute, '.')}, Str::after($attribute, '.')) === $requestAttribute) { |
|
30 | 30 | return []; |
31 | 31 | } |
32 | 32 | // set the empty attribute in data |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | |
36 | 36 | $fieldErrors = $this->validateFieldRules($attribute, $value); |
37 | 37 | |
38 | - if (! empty($value) && ! empty($this->getFileRules())) { |
|
38 | + if (!empty($value) && !empty($this->getFileRules())) { |
|
39 | 39 | $fileErrors = $this->validateFileRules($attribute, $value); |
40 | 40 | } |
41 | 41 | |
42 | 42 | return array_merge($fieldErrors, $fileErrors ?? []); |
43 | 43 | } |
44 | 44 | |
45 | - public static function field(string|array|ValidationRule|Rule $rules = []): self |
|
45 | + public static function field(string | array | ValidationRule | Rule $rules = []): self |
|
46 | 46 | { |
47 | 47 | return parent::field($rules); |
48 | 48 | } |
@@ -21,8 +21,7 @@ |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | $previousValues = str_contains($attribute, '.') ? |
24 | - Arr::get($entry->{Str::before($attribute, '.')}, Str::after($attribute, '.')) : |
|
25 | - $entry->{$attribute}; |
|
24 | + Arr::get($entry->{Str::before($attribute, '.')}, Str::after($attribute, '.')) : $entry->{$attribute}; |
|
26 | 25 | |
27 | 26 | if (is_string($previousValues)) { |
28 | 27 | $previousValues = json_decode($previousValues, true) ?? []; |
@@ -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 | 36 | if ($instance->validatesArrays()) { |
37 | - if (! in_array('array', $instance->getFieldRules())) { |
|
37 | + if (!in_array('array', $instance->getFieldRules())) { |
|
38 | 38 | $instance->fieldRules[] = 'array'; |
39 | 39 | } |
40 | 40 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public function getFieldRules(): array |
96 | 96 | { |
97 | - return tap($this->fieldRules, function ($rule) { |
|
97 | + return tap($this->fieldRules, function($rule) { |
|
98 | 98 | if (is_a($rule, BackpackCustomRule::class, true)) { |
99 | 99 | $rule = $rule->getFieldRules(); |
100 | 100 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $rules = explode('|', $rules); |
110 | 110 | } |
111 | 111 | |
112 | - if (! is_array($rules)) { |
|
112 | + if (!is_array($rules)) { |
|
113 | 113 | $rules = [$rules]; |
114 | 114 | } |
115 | 115 | |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | |
119 | 119 | protected function ensureValueIsValid($value) |
120 | 120 | { |
121 | - if ($this->validatesArrays() && ! is_array($value)) { |
|
121 | + if ($this->validatesArrays() && !is_array($value)) { |
|
122 | 122 | try { |
123 | 123 | $value = json_decode($value, true) ?? []; |
124 | - } catch(\Exception $e) { |
|
124 | + } catch (\Exception $e) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | } |
@@ -145,8 +145,7 @@ discard block |
||
145 | 145 | protected function getValidationAttributeString(string $attribute) |
146 | 146 | { |
147 | 147 | return Str::substrCount($attribute, '.') > 1 ? |
148 | - Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : |
|
149 | - $attribute; |
|
148 | + Str::before($attribute, '.').'.*.'.Str::afterLast($attribute, '.') : $attribute; |
|
150 | 149 | } |
151 | 150 | |
152 | 151 | protected function validateOnSubmit(string $attribute, mixed $value): array |
@@ -154,7 +153,7 @@ discard block |
||
154 | 153 | return $this->validateRules($attribute, $value); |
155 | 154 | } |
156 | 155 | |
157 | - protected function validateFieldAndFile(string $attribute, null|array $data = null, array|null $customRules = null): array |
|
156 | + protected function validateFieldAndFile(string $attribute, null | array $data = null, array | null $customRules = null): array |
|
158 | 157 | { |
159 | 158 | $fieldErrors = $this->validateFieldRules($attribute, $data, $customRules); |
160 | 159 | |
@@ -166,7 +165,7 @@ discard block |
||
166 | 165 | /** |
167 | 166 | * Implementation. |
168 | 167 | */ |
169 | - public function validateFieldRules(string $attribute, null|array|UploadedFile $data = null, array|null $customRules = null): array |
|
168 | + public function validateFieldRules(string $attribute, null | array | UploadedFile $data = null, array | null $customRules = null): array |
|
170 | 169 | { |
171 | 170 | $data = $data ?? $this->data; |
172 | 171 | $validationRuleAttribute = $this->getValidationAttributeString($attribute); |
@@ -174,13 +173,13 @@ 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 | - if ($this->validatesArrays() && is_array($data) && ! Str::contains($attribute, '.')) { |
|
178 | + if ($this->validatesArrays() && is_array($data) && !Str::contains($attribute, '.')) { |
|
180 | 179 | return Arr::has($data, $attribute) ? $data : [$attribute => Arr::get($data, $attribute)]; |
181 | 180 | } |
182 | 181 | |
183 | - if(Str::contains($attribute, '.')) { |
|
182 | + if (Str::contains($attribute, '.')) { |
|
184 | 183 | $validData = []; |
185 | 184 | |
186 | 185 | Arr::set($validData, $attribute, !is_array($data) ? $data : Arr::get($data, $attribute)); |
@@ -196,7 +195,7 @@ discard block |
||
196 | 195 | $items = is_array($items) ? $items : [$items]; |
197 | 196 | $validationRuleAttribute = $this->getValidationAttributeString($attribute); |
198 | 197 | |
199 | - $filesToValidate = array_filter(Arr::get($items, $attribute), function ($item) { |
|
198 | + $filesToValidate = array_filter(Arr::get($items, $attribute), function($item) { |
|
200 | 199 | return $item instanceof UploadedFile; |
201 | 200 | }); |
202 | 201 |