@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | if ($classNames = (array) $this->argument('enum')) { |
48 | 48 | foreach ($classNames as $className) { |
49 | 49 | /** @var class-string $className */ |
50 | - if (! enum_exists($className)) { |
|
50 | + if (!enum_exists($className)) { |
|
51 | 51 | throw new InvalidArgumentException( |
52 | 52 | sprintf('The given class must be an instance of %s: %s', UnitEnum::class, $className) |
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
56 | - if (! in_array(EnumTraits::class, class_uses_recursive($className))) { |
|
56 | + if (!in_array(EnumTraits::class, class_uses_recursive($className))) { |
|
57 | 57 | throw new InvalidArgumentException( |
58 | 58 | sprintf('The given class must be use trait of %s: %s', EnumTraits::class, $className) |
59 | 59 | ); |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $metaTags = collect($reflection->getCases()) |
104 | - ->flatMap(function (ReflectionEnumUnitCase $reflectionEnumUnitCase) use (&$caseTags, $enumBackingType) { |
|
104 | + ->flatMap(function(ReflectionEnumUnitCase $reflectionEnumUnitCase) use (&$caseTags, $enumBackingType) { |
|
105 | 105 | $case = $reflectionEnumUnitCase->getValue(); |
106 | 106 | $caseTags[] = new MethodTag($case->name, [$enumBackingType], isStatic: true); |
107 | 107 | |
108 | - return array_map(function (Meta $meta) { |
|
108 | + return array_map(function(Meta $meta) { |
|
109 | 109 | $rfm = new ReflectionMethod($meta, 'transform'); |
110 | 110 | $types = []; |
111 | 111 | $rft = $rfm->getReturnType(); |
@@ -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 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public static function values(): array |
27 | 27 | { |
28 | - if (! is_subclass_of(static::class, BackedEnum::class)) { |
|
28 | + if (!is_subclass_of(static::class, BackedEnum::class)) { |
|
29 | 29 | return static::names(); |
30 | 30 | } |
31 | 31 |