@@ -33,7 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @return string The human representation for a given value |
35 | 35 | */ |
36 | - public static function readableForValue(string|int $value): string; |
|
36 | + public static function readableForValue(string | int $value): string; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Gets the human representation for a given name. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * @param class-string<FlagEnumInterface>|FlagEnumInterface $enumOrType |
58 | 58 | */ |
59 | - public static function from(string|FlagEnumInterface $enumOrType, FlagEnumInterface ...$flags): static |
|
59 | + public static function from(string | FlagEnumInterface $enumOrType, FlagEnumInterface ...$flags): static |
|
60 | 60 | { |
61 | 61 | if ($enumOrType instanceof FlagEnumInterface) { |
62 | 62 | $type = $enumOrType::class; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $type = $enumOrType; |
70 | 70 | } |
71 | 71 | |
72 | - return new static($type, static::encodeBits(array_map(static fn (FlagEnumInterface $flag) => $flag->value, $flags))); |
|
72 | + return new static($type, static::encodeBits(array_map(static fn(FlagEnumInterface $flag) => $flag->value, $flags))); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public static function accepts(string $enumType, int $value): bool |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return array_values( |
95 | 95 | array_filter( |
96 | 96 | array_map( |
97 | - static fn ($k, $v) => $v === '1' ? (1 << $k) : null, |
|
97 | + static fn($k, $v) => $v === '1' ? (1 << $k) : null, |
|
98 | 98 | array_keys($bits), |
99 | 99 | array_values($bits), |
100 | 100 | ) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getFlags(): array |
155 | 155 | { |
156 | - return array_map(fn (int $bit) => $this->type::from($bit), $this->bits); |
|
156 | + return array_map(fn(int $bit) => $this->type::from($bit), $this->bits); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function hasFlags(FlagEnumInterface ...$flags): bool |
175 | 175 | { |
176 | - $bits = static::encodeBits(array_map(static fn (FlagEnumInterface $flag) => $flag->value, $flags)); |
|
176 | + $bits = static::encodeBits(array_map(static fn(FlagEnumInterface $flag) => $flag->value, $flags)); |
|
177 | 177 | |
178 | 178 | if ($flags >= 1) { |
179 | 179 | return $bits === ($bits & self::encodeBits($this->bits)); |
@@ -224,6 +224,6 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function flagsToBits(FlagEnumInterface ...$flags): array |
226 | 226 | { |
227 | - return array_map(static fn (FlagEnumInterface $flag) => $flag->value, $flags); |
|
227 | + return array_map(static fn(FlagEnumInterface $flag) => $flag->value, $flags); |
|
228 | 228 | } |
229 | 229 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * {@inheritdoc} |
21 | 21 | */ |
22 | - public static function readableForValue(string|int $value): string |
|
22 | + public static function readableForValue(string | int $value): string |
|
23 | 23 | { |
24 | 24 | /** @var \UnitEnum $case */ |
25 | 25 | $case = static::from($value); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | static $map; |
52 | 52 | |
53 | 53 | if (null === $map) { |
54 | - $map = array_combine(array_map(fn (\UnitEnum $e) => $e->name, static::cases()), static::cases()); |
|
54 | + $map = array_combine(array_map(fn(\UnitEnum $e) => $e->name, static::cases()), static::cases()); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if (!isset($map[$name])) { |