@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function passes(string $attribute, mixed $value): bool |
18 | 18 | { |
19 | - if (! enum_exists($this->enum)) { |
|
19 | + if (!enum_exists($this->enum)) { |
|
20 | 20 | return false; |
21 | 21 | } |
22 | 22 | |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | return true; |
25 | 25 | } |
26 | 26 | |
27 | - if (! in_array(EnumTraits::class, trait_uses_recursive($this->enum))) { |
|
27 | + if (!in_array(EnumTraits::class, trait_uses_recursive($this->enum))) { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
31 | 31 | if ($this->meta) { |
32 | - if (! is_subclass_of($this->meta, Meta::class)) { |
|
32 | + if (!is_subclass_of($this->meta, Meta::class)) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
36 | 36 | $value = new $this->meta($value); |
37 | 37 | } |
38 | 38 | |
39 | - return ! is_null($this->enum::tryFromMeta($value, $attribute)); |
|
39 | + return !is_null($this->enum::tryFromMeta($value, $attribute)); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function validate(string $attribute, mixed $value, Closure $fail): void |
43 | 43 | { |
44 | - if (! $this->passes($attribute, $value)) { |
|
44 | + if (!$this->passes($attribute, $value)) { |
|
45 | 45 | $fail(EnumServiceProvider::LANG_NAMESPACE.'::validations.enum_meta')->translate(); |
46 | 46 | } |
47 | 47 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function passes(string $attribute, mixed $value): bool |
16 | 16 | { |
17 | - if (! enum_exists($this->enum)) { |
|
17 | + if (!enum_exists($this->enum)) { |
|
18 | 18 | return false; |
19 | 19 | } |
20 | 20 | |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | return true; |
23 | 23 | } |
24 | 24 | |
25 | - if (! method_exists($this->enum, 'tryFrom')) { |
|
25 | + if (!method_exists($this->enum, 'tryFrom')) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | |
29 | - return ! is_null($this->enum::tryFrom($value)); |
|
29 | + return !is_null($this->enum::tryFrom($value)); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function validate(string $attribute, mixed $value, Closure $fail): void |
33 | 33 | { |
34 | - if (! $this->passes($attribute, $value)) { |
|
34 | + if (!$this->passes($attribute, $value)) { |
|
35 | 35 | $fail(EnumServiceProvider::LANG_NAMESPACE.'::validations.enumerate')->translate(); |
36 | 36 | } |
37 | 37 | } |
@@ -28,11 +28,11 @@ |
||
28 | 28 | |
29 | 29 | private function bootValidators(): void |
30 | 30 | { |
31 | - Validator::extend('enumerate', function ($attribute, $value, $parameters, $validator) { |
|
31 | + Validator::extend('enumerate', function($attribute, $value, $parameters, $validator) { |
|
32 | 32 | return (new Enum(...$parameters))->passes($attribute, $value); |
33 | 33 | }, trans(static::LANG_NAMESPACE.'::validations.enumerate')); |
34 | 34 | |
35 | - Validator::extend('enum_meta', function ($attribute, $value, $parameters, $validator) { |
|
35 | + Validator::extend('enum_meta', function($attribute, $value, $parameters, $validator) { |
|
36 | 36 | return (new EnumMeta(...$parameters))->passes($attribute, $value); |
37 | 37 | }, trans(static::LANG_NAMESPACE.'::validations.enum_meta')); |
38 | 38 | } |