@@ -43,7 +43,7 @@ |
||
43 | 43 | if (!\is_subclass_of($enumeration, Enum::class)) { |
44 | 44 | throw new InvalidArgumentException(\sprintf( |
45 | 45 | '%s can handle subclasses of %s only', |
46 | - __CLASS__, |
|
46 | + __CLASS__, |
|
47 | 47 | Enum::class |
48 | 48 | )); |
49 | 49 | } |
@@ -804,14 +804,30 @@ discard block |
||
804 | 804 | } |
805 | 805 | |
806 | 806 | $ord = \ord($bitset[$bytePos]); |
807 | - if ($ord & 0b00000001) ++$count; |
|
808 | - if ($ord & 0b00000010) ++$count; |
|
809 | - if ($ord & 0b00000100) ++$count; |
|
810 | - if ($ord & 0b00001000) ++$count; |
|
811 | - if ($ord & 0b00010000) ++$count; |
|
812 | - if ($ord & 0b00100000) ++$count; |
|
813 | - if ($ord & 0b01000000) ++$count; |
|
814 | - if ($ord & 0b10000000) ++$count; |
|
807 | + if ($ord & 0b00000001) { |
|
808 | + ++$count; |
|
809 | + } |
|
810 | + if ($ord & 0b00000010) { |
|
811 | + ++$count; |
|
812 | + } |
|
813 | + if ($ord & 0b00000100) { |
|
814 | + ++$count; |
|
815 | + } |
|
816 | + if ($ord & 0b00001000) { |
|
817 | + ++$count; |
|
818 | + } |
|
819 | + if ($ord & 0b00010000) { |
|
820 | + ++$count; |
|
821 | + } |
|
822 | + if ($ord & 0b00100000) { |
|
823 | + ++$count; |
|
824 | + } |
|
825 | + if ($ord & 0b01000000) { |
|
826 | + ++$count; |
|
827 | + } |
|
828 | + if ($ord & 0b10000000) { |
|
829 | + ++$count; |
|
830 | + } |
|
815 | 831 | } |
816 | 832 | return $count; |
817 | 833 | } |
@@ -843,14 +859,30 @@ discard block |
||
843 | 859 | $byte = $bitset & $bitChk; |
844 | 860 | if ($byte) { |
845 | 861 | $byte = $byte >> $bitPos; |
846 | - if ($byte & 0b00000001) ++$count; |
|
847 | - if ($byte & 0b00000010) ++$count; |
|
848 | - if ($byte & 0b00000100) ++$count; |
|
849 | - if ($byte & 0b00001000) ++$count; |
|
850 | - if ($byte & 0b00010000) ++$count; |
|
851 | - if ($byte & 0b00100000) ++$count; |
|
852 | - if ($byte & 0b01000000) ++$count; |
|
853 | - if ($byte & 0b10000000) ++$count; |
|
862 | + if ($byte & 0b00000001) { |
|
863 | + ++$count; |
|
864 | + } |
|
865 | + if ($byte & 0b00000010) { |
|
866 | + ++$count; |
|
867 | + } |
|
868 | + if ($byte & 0b00000100) { |
|
869 | + ++$count; |
|
870 | + } |
|
871 | + if ($byte & 0b00001000) { |
|
872 | + ++$count; |
|
873 | + } |
|
874 | + if ($byte & 0b00010000) { |
|
875 | + ++$count; |
|
876 | + } |
|
877 | + if ($byte & 0b00100000) { |
|
878 | + ++$count; |
|
879 | + } |
|
880 | + if ($byte & 0b01000000) { |
|
881 | + ++$count; |
|
882 | + } |
|
883 | + if ($byte & 0b10000000) { |
|
884 | + ++$count; |
|
885 | + } |
|
854 | 886 | } |
855 | 887 | |
856 | 888 | if ($bitset <= $bitChk) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // we will switch this into a binary bitset |
105 | 105 | if ($this->enumerationCount > \PHP_INT_SIZE * 8) { |
106 | 106 | // init binary bitset with zeros |
107 | - $this->bitset = $this->emptyBitset = \str_repeat("\0", (int)\ceil($this->enumerationCount / 8)); |
|
107 | + $this->bitset = $this->emptyBitset = \str_repeat("\0", (int) \ceil($this->enumerationCount / 8)); |
|
108 | 108 | |
109 | 109 | // switch internal binary bitset functions |
110 | 110 | $this->fnDoGetIterator = 'doGetIteratorBin'; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | throw new InvalidArgumentException('out-of-range bits detected'); |
354 | 354 | } |
355 | 355 | |
356 | - $this->bitset = \substr($bitset, 0, -1) . $lastByteExpected; |
|
356 | + $this->bitset = \substr($bitset, 0, -1).$lastByteExpected; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | $this->bitset = $bitset; |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | private function doGetBinaryBitsetLeInt() |
1096 | 1096 | { |
1097 | 1097 | $bin = \pack(\PHP_INT_SIZE === 8 ? 'P' : 'V', $this->bitset); |
1098 | - return \substr($bin, 0, (int)\ceil($this->enumerationCount / 8)); |
|
1098 | + return \substr($bin, 0, (int) \ceil($this->enumerationCount / 8)); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | /** |
@@ -1159,6 +1159,6 @@ discard block |
||
1159 | 1159 | /** @var int $bitset */ |
1160 | 1160 | $bitset = $this->bitset; |
1161 | 1161 | |
1162 | - return (bool)($bitset & (1 << $ordinal)); |
|
1162 | + return (bool) ($bitset & (1 << $ordinal)); |
|
1163 | 1163 | } |
1164 | 1164 | } |
@@ -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 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | 'Unknown value %s for enumeration %s', |
209 | 209 | \is_scalar($value) |
210 | 210 | ? \var_export($value, true) |
211 | - : 'of type ' . (\is_object($value) ? \get_class($value) : \gettype($value)), |
|
211 | + : 'of type '.(\is_object($value) ? \get_class($value) : \gettype($value)), |
|
212 | 212 | static::class |
213 | 213 | )); |
214 | 214 | } |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | return $instance; |
237 | 237 | } |
238 | 238 | |
239 | - $const = static::class . "::{$name}"; |
|
239 | + $const = static::class."::{$name}"; |
|
240 | 240 | if (!\defined($const)) { |
241 | 241 | throw new InvalidArgumentException("{$const} not defined"); |
242 | 242 | } |
243 | 243 | |
244 | 244 | assert( |
245 | 245 | self::noAmbiguousValues(static::getConstants()), |
246 | - 'Ambiguous enumerator values detected for ' . static::class |
|
246 | + 'Ambiguous enumerator values detected for '.static::class |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | return self::$instances[static::class][$name] = new static(\constant($const)); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // Enumerators must be defined as public class constants |
350 | 350 | foreach ($reflection->getReflectionConstants() as $reflConstant) { |
351 | 351 | if ($reflConstant->isPublic()) { |
352 | - $scopeConstants[ $reflConstant->getName() ] = $reflConstant->getValue(); |
|
352 | + $scopeConstants[$reflConstant->getName()] = $reflConstant->getValue(); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | assert( |
360 | 360 | self::noAmbiguousValues($constants), |
361 | - 'Ambiguous enumerator values detected for ' . static::class |
|
361 | + 'Ambiguous enumerator values detected for '.static::class |
|
362 | 362 | ); |
363 | 363 | |
364 | 364 | self::$names[static::class] = \array_keys($constants); |