@@ -53,14 +53,14 @@ |
||
| 53 | 53 | $name = \array_search($value, $constants, true); |
| 54 | 54 | if ($name === false) { |
| 55 | 55 | $message = \is_scalar($value) |
| 56 | - ? 'Unknown value ' . \var_export($value, true) |
|
| 57 | - : 'Invalid value of type ' . (\is_object($value) ? \get_class($value) : \gettype($value)); |
|
| 56 | + ? 'Unknown value '.\var_export($value, true) |
|
| 57 | + : 'Invalid value of type '.(\is_object($value) ? \get_class($value) : \gettype($value)); |
|
| 58 | 58 | throw new RuntimeException($message); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $class = static::class; |
| 62 | 62 | $enumerator = $this; |
| 63 | - $closure = function () use ($class, $name, $value, $enumerator) { |
|
| 63 | + $closure = function() use ($class, $name, $value, $enumerator) { |
|
| 64 | 64 | if ($value !== null && $this->value !== null) { |
| 65 | 65 | throw new LogicException('Do not call this directly - please use unserialize($enum) instead'); |
| 66 | 66 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | 'Unknown value %s for enumeration %s', |
| 199 | 199 | \is_scalar($value) |
| 200 | 200 | ? \var_export($value, true) |
| 201 | - : 'of type ' . (\is_object($value) ? \get_class($value) : \gettype($value)), |
|
| 201 | + : 'of type '.(\is_object($value) ? \get_class($value) : \gettype($value)), |
|
| 202 | 202 | static::class |
| 203 | 203 | )); |
| 204 | 204 | } |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | return self::$instances[static::class][$name]; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - $const = static::class . "::{$name}"; |
|
| 224 | + $const = static::class."::{$name}"; |
|
| 225 | 225 | if (!\defined($const)) { |
| 226 | 226 | throw new InvalidArgumentException("{$const} not defined"); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | assert( |
| 230 | 230 | self::noAmbiguousValues(static::getConstants()), |
| 231 | - 'Ambiguous enumerator values detected for ' . static::class |
|
| 231 | + 'Ambiguous enumerator values detected for '.static::class |
|
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | 234 | return self::$instances[static::class][$name] = new static(\constant($const)); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | // Enumerators must be defined as public class constants |
| 327 | 327 | foreach ($reflection->getReflectionConstants() as $reflConstant) { |
| 328 | 328 | if ($reflConstant->isPublic()) { |
| 329 | - $scopeConstants[ $reflConstant->getName() ] = $reflConstant->getValue(); |
|
| 329 | + $scopeConstants[$reflConstant->getName()] = $reflConstant->getValue(); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | assert( |
| 337 | 337 | self::noAmbiguousValues($constants), |
| 338 | - 'Ambiguous enumerator values detected for ' . static::class |
|
| 338 | + 'Ambiguous enumerator values detected for '.static::class |
|
| 339 | 339 | ); |
| 340 | 340 | |
| 341 | 341 | self::$names[static::class] = \array_keys($constants); |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | * @return array<string, mixed> |
| 64 | 64 | */ |
| 65 | 65 | public function __debugInfo(): array { |
| 66 | - $dbg = (array)$this; |
|
| 67 | - $dbg["\0" . self::class . "\0__pairs"] = array_map(function ($k, $v) { |
|
| 66 | + $dbg = (array) $this; |
|
| 67 | + $dbg["\0".self::class."\0__pairs"] = array_map(function($k, $v) { |
|
| 68 | 68 | return [$k, $v]; |
| 69 | 69 | }, $this->getKeys(), $this->getValues()); |
| 70 | 70 | return $dbg; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | // we will switch this into a binary bitset |
| 87 | 87 | if ($this->enumerationCount > \PHP_INT_SIZE * 8) { |
| 88 | 88 | // init binary bitset with zeros |
| 89 | - $this->bitset = $this->emptyBitset = \str_repeat("\0", (int)\ceil($this->enumerationCount / 8)); |
|
| 89 | + $this->bitset = $this->emptyBitset = \str_repeat("\0", (int) \ceil($this->enumerationCount / 8)); |
|
| 90 | 90 | |
| 91 | 91 | // switch internal binary bitset functions |
| 92 | 92 | $this->fnDoGetIterator = 'doGetIteratorBin'; |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * @return array<string, mixed> |
| 117 | 117 | */ |
| 118 | 118 | public function __debugInfo() { |
| 119 | - $dbg = (array)$this; |
|
| 120 | - $dbg["\0" . self::class . "\0__enumerators"] = $this->getValues(); |
|
| 119 | + $dbg = (array) $this; |
|
| 120 | + $dbg["\0".self::class."\0__enumerators"] = $this->getValues(); |
|
| 121 | 121 | return $dbg; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | throw new InvalidArgumentException('out-of-range bits detected'); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - $this->bitset = \substr($bitset, 0, -1) . $lastByteExpected; |
|
| 350 | + $this->bitset = \substr($bitset, 0, -1).$lastByteExpected; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $this->bitset = $bitset; |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | private function doGetBinaryBitsetLeInt() |
| 1070 | 1070 | { |
| 1071 | 1071 | $bin = \pack(\PHP_INT_SIZE === 8 ? 'P' : 'V', $this->bitset); |
| 1072 | - return \substr($bin, 0, (int)\ceil($this->enumerationCount / 8)); |
|
| 1072 | + return \substr($bin, 0, (int) \ceil($this->enumerationCount / 8)); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
@@ -1127,6 +1127,6 @@ discard block |
||
| 1127 | 1127 | */ |
| 1128 | 1128 | private function doGetBitInt($ordinal) |
| 1129 | 1129 | { |
| 1130 | - return (bool)($this->bitset & (1 << $ordinal)); |
|
| 1130 | + return (bool) ($this->bitset & (1 << $ordinal)); |
|
| 1131 | 1131 | } |
| 1132 | 1132 | } |