Test Failed
Pull Request — main (#11)
by Yunfeng
03:49
created
src/Rules/EnumMeta.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  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
 
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
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.'::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('enum', function ($attribute, $value, $parameters, $validator) {
31
+        Validator::extend('enum', 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.
src/Rules/Enum.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function passes(string $attribute, mixed $value): bool
16 16
     {
17
-        echo 'this is today?' . $attribute;
18
-        if (! enum_exists($this->enum)) {
17
+        echo 'this is today?'.$attribute;
18
+        if (!enum_exists($this->enum)) {
19 19
             return false;
20 20
         }
21 21
 
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
             return true;
24 24
         }
25 25
 
26
-        if (! method_exists($this->enum, 'tryFrom')) {
26
+        if (!method_exists($this->enum, 'tryFrom')) {
27 27
             return false;
28 28
         }
29 29
 
30
-        return ! is_null($this->enum::tryFrom($value));
30
+        return !is_null($this->enum::tryFrom($value));
31 31
     }
32 32
 
33 33
     public function validate(string $attribute, mixed $value, Closure $fail): void
34 34
     {
35
-        if (! $this->passes($attribute, $value)) {
35
+        if (!$this->passes($attribute, $value)) {
36 36
             $fail(EnumServiceProvider::LANG_NAMESPACE.'::validation.enum')->translate();
37 37
         }
38 38
     }
Please login to merge, or discard this patch.