Passed
Pull Request — main (#9)
by Yunfeng
03:17
created
src/Rules/EnumMeta.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
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
 
23
-        if (! in_array(EnumTraits::class, trait_uses_recursive($this->enum))) {
23
+        if (!in_array(EnumTraits::class, trait_uses_recursive($this->enum))) {
24 24
             return false;
25 25
         }
26 26
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             return true;
29 29
         }
30 30
 
31
-        if ($this->meta && ! is_subclass_of($this->meta, Meta::class)) {
31
+        if ($this->meta && !is_subclass_of($this->meta, Meta::class)) {
32 32
             return false;
33 33
         }
34 34
 
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
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.'::validation.enum_meta')->translate();
46 46
         }
47 47
     }
Please login to merge, or discard this patch.
src/EnumServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
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.'::validation.enum'));
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.'::validation.enum_meta'));
38 38
     }
Please login to merge, or discard this patch.