@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | public function passes(string $attribute, mixed $value): bool |
17 | 17 | { |
18 | - if (! enum_exists($this->enum)) { |
|
18 | + if (!enum_exists($this->enum)) { |
|
19 | 19 | return false; |
20 | 20 | } |
21 | 21 | |
22 | - if (! in_array(EnumTraits::class, trait_uses_recursive($this->enum))) { |
|
22 | + if (!in_array(EnumTraits::class, trait_uses_recursive($this->enum))) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | return true; |
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.enumerate')->translate(); |
37 | 37 | } |
38 | 38 | } |
@@ -16,11 +16,11 @@ 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 | |
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 |
||
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 | |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | $attribute = null; |
38 | 38 | } |
39 | 39 | |
40 | - return ! is_null($this->enum::tryFromMeta($value, $attribute)); |
|
40 | + return !is_null($this->enum::tryFromMeta($value, $attribute)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function validate(string $attribute, mixed $value, Closure $fail): void |
44 | 44 | { |
45 | - if (! $this->passes($attribute, $value)) { |
|
45 | + if (!$this->passes($attribute, $value)) { |
|
46 | 46 | $fail(EnumServiceProvider::LANG_NAMESPACE.'::validation.enum_meta')->translate(); |
47 | 47 | } |
48 | 48 | } |
@@ -25,7 +25,7 @@ discard block |
||
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 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ->all(); |
52 | 52 | |
53 | 53 | return collect(static::cases()) |
54 | - ->map(function (UnitEnum $case) use ($allMetaMethods) { |
|
54 | + ->map(function(UnitEnum $case) use ($allMetaMethods) { |
|
55 | 55 | /** @var static $case */ |
56 | 56 | $map = collect($case->metas()) |
57 | 57 | ->flatMap(fn (Meta $meta) => [$meta::method() => $meta->value]) |
@@ -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(); |
@@ -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 Enumerate(...$parameters))->passes($attribute, $value); |
33 | 33 | }, trans(static::LANG_NAMESPACE.'::validation.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.'::validation.enum_meta')); |
38 | 38 | } |