Test Failed
Pull Request — 3.x (#151)
by Petr
62:53
created
src/EnumSet.php 2 patches
Braces   +48 added lines, -16 removed lines patch added patch discarded remove patch
@@ -804,14 +804,30 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         // we will switch this into a binary bitset
82 82
         if ($this->ordinalMax > \PHP_INT_SIZE * 8) {
83 83
             // init binary bitset with zeros
84
-            $this->bitset = \str_repeat("\0", (int)\ceil($this->ordinalMax / 8));
84
+            $this->bitset = \str_repeat("\0", (int) \ceil($this->ordinalMax / 8));
85 85
 
86 86
             // switch internal binary bitset functions
87 87
             $this->fnDoRewind            = 'doRewindBin';
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
     private function doGetBinaryBitsetLeInt()
599 599
     {
600 600
         $bin = \pack(\PHP_INT_SIZE === 8 ? 'P' : 'V', $this->bitset);
601
-        return \substr($bin, 0, (int)\ceil($this->ordinalMax / 8));
601
+        return \substr($bin, 0, (int) \ceil($this->ordinalMax / 8));
602 602
     }
603 603
 
604 604
     /**
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
                 throw new InvalidArgumentException('out-of-range bits detected');
661 661
             }
662 662
 
663
-            $this->bitset = \substr($bitset, 0, -1) . $lastByteExpected;
663
+            $this->bitset = \substr($bitset, 0, -1).$lastByteExpected;
664 664
         }
665 665
 
666 666
         $this->bitset = $bitset;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
      */
772 772
     private function doGetBitInt($ordinal)
773 773
     {
774
-        return (bool)($this->bitset & (1 << $ordinal));
774
+        return (bool) ($this->bitset & (1 << $ordinal));
775 775
     }
776 776
 
777 777
     /**
Please login to merge, or discard this patch.
src/EnumSerializableTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Enum.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
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
         }
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             return self::$instances[static::class][$name];
226 226
         }
227 227
 
228
-        $const = static::class . '::' . $name;
228
+        $const = static::class.'::'.$name;
229 229
         if (!\defined($const)) {
230
-            throw new InvalidArgumentException($const . ' not defined');
230
+            throw new InvalidArgumentException($const.' not defined');
231 231
         }
232 232
 
233 233
         return self::$instances[static::class][$name] = new static(\constant($const));
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     {
371 371
         if (!isset(self::$constants[$class])) {
372 372
             $reflection = new ReflectionClass($class);
373
-            $publicConstants  = [];
373
+            $publicConstants = [];
374 374
 
375 375
             do {
376 376
                 $scopeConstants = [];
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                     //       It allows the visibility keyword but ignores it.
382 382
                     foreach ($reflection->getReflectionConstants() as $reflConstant) {
383 383
                         if ($reflConstant->isPublic()) {
384
-                            $scopeConstants[ $reflConstant->getName() ] = $reflConstant->getValue();
384
+                            $scopeConstants[$reflConstant->getName()] = $reflConstant->getValue();
385 385
                         }
386 386
                     }
387 387
                 } else {
Please login to merge, or discard this patch.
src/EnumMap.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         try {
114 114
             $enumeration = $this->enumeration;
115
-            $ord  = $enumeration::get($enumerator)->getOrdinal();
115
+            $ord = $enumeration::get($enumerator)->getOrdinal();
116 116
             return array_key_exists($ord, $this->map);
117 117
         } catch (InvalidArgumentException $e) {
118 118
             // An invalid enumerator can't be contained in this map
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         try {
132 132
             $enumeration = $this->enumeration;
133
-            $ord  = $enumeration::get($enumerator)->getOrdinal();
133
+            $ord = $enumeration::get($enumerator)->getOrdinal();
134 134
             return isset($this->map[$ord]);
135 135
         } catch (InvalidArgumentException $e) {
136 136
             // An invalid enumerator can't be an offset of this map
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function seek($pos)
206 206
     {
207
-        $pos = (int)$pos;
207
+        $pos = (int) $pos;
208 208
         if (!isset($this->ordinals[$pos])) {
209 209
             throw new OutOfBoundsException("Position {$pos} not found");
210 210
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
206 206
     {
207 207
         $pos = (int)$pos;
208 208
         if (!isset($this->ordinals[$pos])) {
209
-            throw new OutOfBoundsException("Position {$pos} not found");
209
+            throw new OutOfBoundsException("position {$pos} not found");
210 210
         }
211 211
 
212 212
         $this->pos = $pos;
Please login to merge, or discard this patch.