Completed
Push — master ( ee6be2...ddf6ae )
by Michał
03:18
created
src/events/traits/Emitter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     {
76 76
         // We'll create a wrapper closure which will remove the listener once it receives the first event
77 77
         // and forward the arguments from the wrapper to the actual listener.
78
-        $wrapper = function (...$payload) use (&$wrapper, $event, $listener) {
78
+        $wrapper = function(...$payload) use (&$wrapper, $event, $listener) {
79 79
             $this->off($event, $wrapper);
80 80
 
81 81
             $listener(...$payload);
Please login to merge, or discard this patch.
src/events/traits/EmitterAware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     /**
25 25
      * @see \nyx\events\interfaces\EmitterAware::getEmitter()
26 26
      */
27
-    public function getEmitter() : ?interfaces\Emitter
27
+    public function getEmitter() : ? interfaces\Emitter
28 28
     {
29 29
         return $this->emitter;
30 30
     }
Please login to merge, or discard this patch.
src/connect/streams/Stream.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@
 block discarded – undo
459 459
 
460 460
         // Those may change, so... besides - fancy syntax, eh chaps?
461 461
         $this->status->{((isset($this->metadata['seekable']) && $this->metadata['seekable']) ? 'set' : 'remove')}(interfaces\Stream::SEEKABLE);
462
-        $this->status->{((isset($this->metadata['blocked'])  && $this->metadata['blocked'])  ? 'set' : 'remove')}(interfaces\Stream::BLOCKED);
462
+        $this->status->{((isset($this->metadata['blocked']) && $this->metadata['blocked']) ? 'set' : 'remove')}(interfaces\Stream::BLOCKED);
463 463
 
464 464
         return true;
465 465
     }
Please login to merge, or discard this patch.
src/utils/Str.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public static function beginWith(string $haystack, string $needle) : string
102 102
     {
103
-        return $needle . preg_replace('/^(?:'.preg_quote($needle, '/').')+/', '', $haystack);
103
+        return $needle.preg_replace('/^(?:'.preg_quote($needle, '/').')+/', '', $haystack);
104 104
     }
105 105
 
106 106
     /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
         // error-inducing combinations of invalid input which all will be caught when we attempt
131 131
         // to actually look for the indices of the needles. Anything else is just way too much overhead.
132 132
         if ($haystack === '' || $startNeedle === '' || $endNeedle === '') {
133
-            $endNeedle   === '' && $arg = '$endNeedle';
133
+            $endNeedle === '' && $arg = '$endNeedle';
134 134
             $startNeedle === '' && $arg = '$startNeedle';
135
-            $haystack    === '' && $arg = '$haystack';
135
+            $haystack === '' && $arg = '$haystack';
136 136
 
137 137
             throw new \InvalidArgumentException($arg.' must not be an empty string.');
138 138
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public static function finishWith(string $haystack, string $needle) : string
359 359
     {
360
-        return preg_replace('/(?:'.preg_quote($needle, '/').')+$/', '', $haystack) . $needle;
360
+        return preg_replace('/(?:'.preg_quote($needle, '/').')+$/', '', $haystack).$needle;
361 361
     }
362 362
 
363 363
     /**
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 
457 457
         // With a negative offset, we'll convert it to a positive one for the initial part (before the inserted
458 458
         // substring), since we'll be using that as a length actually.
459
-        return mb_substr($haystack, 0, $offset < 0 ? $length + $offset : $offset, $encoding) . $needle . mb_substr($haystack, $offset, null, $encoding);
459
+        return mb_substr($haystack, 0, $offset < 0 ? $length + $offset : $offset, $encoding).$needle.mb_substr($haystack, $offset, null, $encoding);
460 460
     }
461 461
 
462 462
     /**
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
         }
604 604
 
605 605
         // Construct the requested padding strings.
606
-        $leftPadding  = 0 === $left  ? '' : mb_substr(str_repeat($with, ceil($left / $padLen)), 0, $left, $encoding);
606
+        $leftPadding  = 0 === $left ? '' : mb_substr(str_repeat($with, ceil($left / $padLen)), 0, $left, $encoding);
607 607
         $rightPadding = 0 === $right ? '' : mb_substr(str_repeat($with, ceil($right / $padLen)), 0, $right, $encoding);
608 608
 
609 609
         // Apply the padding and return the glued string.
610
-        return $leftPadding . $str . $rightPadding;
610
+        return $leftPadding.$str.$rightPadding;
611 611
     }
612 612
 
613 613
     /**
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     {
762 762
         // If multiple values to replace were passed.
763 763
         if (is_array($needles)) {
764
-            $needles = '(' .implode('|', $needles). ')';
764
+            $needles = '('.implode('|', $needles).')';
765 765
         }
766 766
 
767 767
         // Keep track of the internal encoding as we'll change it temporarily and then revert back to it.
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
      */
972 972
     public static function surroundWith(string $haystack, string $needle) : string
973 973
     {
974
-        return static::beginWith($haystack, $needle) . $needle . static::finishWith($haystack, $needle);
974
+        return static::beginWith($haystack, $needle).$needle.static::finishWith($haystack, $needle);
975 975
     }
976 976
 
977 977
     /**
@@ -993,13 +993,13 @@  discard block
 block discarded – undo
993 993
         if (preg_match("/[\x80-\xFF]/", $str)) {
994 994
             // Grab the transliteration table since we'll need it.
995 995
             if (null === static::$ascii) {
996
-                static::$ascii = unserialize(file_get_contents(__DIR__ . '/str/resources/transliteration_table.ser'));
996
+                static::$ascii = unserialize(file_get_contents(__DIR__.'/str/resources/transliteration_table.ser'));
997 997
             }
998 998
 
999 999
             $str = \Normalizer::normalize($str, \Normalizer::NFKD);
1000 1000
             $str = preg_replace('/\p{Mn}+/u', '', $str);
1001 1001
             $str = str_replace(static::$ascii[0], static::$ascii[1], $str);
1002
-            $str = iconv('UTF-8', 'ASCII' . ('glibc' !== ICONV_IMPL ? '//IGNORE' : '') . '//TRANSLIT', $str);
1002
+            $str = iconv('UTF-8', 'ASCII'.('glibc' !== ICONV_IMPL ? '//IGNORE' : '').'//TRANSLIT', $str);
1003 1003
         }
1004 1004
 
1005 1005
         return $str;
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
             $result = mb_substr($result, 0, mb_strrpos($result, ' ', 0, $encoding), $encoding);
1170 1170
         }
1171 1171
 
1172
-        return $result . $end;
1172
+        return $result.$end;
1173 1173
     }
1174 1174
 
1175 1175
     /**
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
         }
1248 1248
 
1249 1249
         $encoding = $encoding ?: static::encoding($haystack);
1250
-        $method   = $first    ? 'indexOf' : 'indexOfLast';
1250
+        $method   = $first ? 'indexOf' : 'indexOfLast';
1251 1251
 
1252 1252
         foreach ((array) $needles as $needle) {
1253 1253
 
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
             // Grab the substrings before and after the needle occurs, insert the replacement in between
1261 1261
             // and glue it together omitting the needle.
1262
-            $haystack = mb_substr($haystack, 0, $offset, $encoding) . $replacement . mb_substr($haystack, $offset + $needleLen, null, $encoding);
1262
+            $haystack = mb_substr($haystack, 0, $offset, $encoding).$replacement.mb_substr($haystack, $offset + $needleLen, null, $encoding);
1263 1263
         }
1264 1264
 
1265 1265
         return $haystack;
Please login to merge, or discard this patch.
src/utils/str/Character.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
     /**
27 27
      * Flags used to combine different characters into a set via self::buildCharacterSet()
28 28
      */
29
-    const CHARS_UPPER       = 1;   // Uppercase letters.
30
-    const CHARS_LOWER       = 2;   // Lowercase letters.
31
-    const CHARS_ALPHA       = 3;   // CHARS_UPPER and CHARS_LOWER.
32
-    const CHARS_NUMERIC     = 4;   // Digits.
33
-    const CHARS_ALNUM       = 7;   // CHARS_ALPHA and CHARS_NUMERIC (Base62)
34
-    const CHARS_HEX_UPPER   = 12;  // Uppercase hexadecimal symbols - CHARS_DIGITS and 8.
35
-    const CHARS_HEX_LOWER   = 20;  // Lowercase hexadecimal symbols - CHARS_DIGITS and 16.
36
-    const CHARS_BASE64      = 39;  // CHARS_ALNUM and 32.
37
-    const CHARS_SYMBOLS     = 64;  // Additional symbols ($%& etc.) accessible on most if not all keyboards.
29
+    const CHARS_UPPER       = 1; // Uppercase letters.
30
+    const CHARS_LOWER       = 2; // Lowercase letters.
31
+    const CHARS_ALPHA       = 3; // CHARS_UPPER and CHARS_LOWER.
32
+    const CHARS_NUMERIC     = 4; // Digits.
33
+    const CHARS_ALNUM       = 7; // CHARS_ALPHA and CHARS_NUMERIC (Base62)
34
+    const CHARS_HEX_UPPER   = 12; // Uppercase hexadecimal symbols - CHARS_DIGITS and 8.
35
+    const CHARS_HEX_LOWER   = 20; // Lowercase hexadecimal symbols - CHARS_DIGITS and 16.
36
+    const CHARS_BASE64      = 39; // CHARS_ALNUM and 32.
37
+    const CHARS_SYMBOLS     = 64; // Additional symbols ($%& etc.) accessible on most if not all keyboards.
38 38
     const CHARS_BRACKETS    = 128; // Brackets.
39 39
     const CHARS_PUNCTUATION = 256; // Punctuation marks.
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @const Special character flag for alphanumeric characters excluding characters which tend
43 43
      *        to be hard to distinguish from each other.
44 44
      */
45
-    const CHARS_LEGIBLE     = 512;
45
+    const CHARS_LEGIBLE = 512;
46 46
 
47 47
     /**
48 48
      * @var array   A map of CHARS_* flags to their actual character lists. @todo Make writable, handle cache?
Please login to merge, or discard this patch.
src/utils/str/Cases.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $encoding = $encoding ?: utils\Str::encoding($str);
104 104
 
105 105
         // Lowercase the first character and append the remainder.
106
-        return mb_strtolower(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, null, $encoding);
106
+        return mb_strtolower(mb_substr($str, 0, 1, $encoding), $encoding).mb_substr($str, 1, null, $encoding);
107 107
     }
108 108
 
109 109
     /**
@@ -180,6 +180,6 @@  discard block
 block discarded – undo
180 180
         $encoding = $encoding ?: utils\Str::encoding($str);
181 181
 
182 182
         // Uppercase the first character and append the remainder.
183
-        return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) . mb_substr($str, 1, null, $encoding);
183
+        return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding).mb_substr($str, 1, null, $encoding);
184 184
     }
185 185
 }
Please login to merge, or discard this patch.
src/utils/Random.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                     /* @var random\interfaces\Source $source */
351 351
                     try {
352 352
                         $source = new $class;
353
-                    } catch(\RuntimeException $exception) {
353
+                    } catch (\RuntimeException $exception) {
354 354
                         $source = false;
355 355
                         continue;
356 356
                     }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                 // by exceptions being thrown by Source::generate() itself and will prevent the return.
361 361
                 try {
362 362
                     return $source->generate($length);
363
-                } catch(\RuntimeException $exception) {
363
+                } catch (\RuntimeException $exception) {
364 364
                     // Ignoring the Exception since we handled it by not returning any valid result.
365 365
                 }
366 366
             }
Please login to merge, or discard this patch.
src/utils/Arr.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
                 return;
749 749
             }
750 750
 
751
-            $array =& $array[$key];
751
+            $array = & $array[$key];
752 752
         }
753 753
 
754 754
         unset($array[array_shift($keys)]);
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                 $array[$key] = [];
843 843
             }
844 844
 
845
-            $array =& $array[$key];
845
+            $array = & $array[$key];
846 846
         }
847 847
 
848 848
         return $array[array_shift($keys)] = $value;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param   array   $array      The array to which the element should be added.
56 56
      * @param   string  $key        The key at which the value should be added.
57
-     * @param   mixed   $value      The value of the element.
57
+     * @param   string   $value      The value of the element.
58 58
      * @param   string  $delimiter  The delimiter to use when exploding the key into parts.
59 59
      */
60 60
     public static function add(array& $array, string $key, $value, string $delimiter = null)
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      * @param   array           $array      The array to search in.
380 380
      * @param   string|array    $key        The string delimited key or a chain (array) of nested keys pointing
381 381
      *                                      to the desired key.
382
-     * @param   mixed           $default    The default value.
382
+     * @param   null|string           $default    The default value.
383 383
      * @param   string          $delimiter  The delimiter to use when exploding the key into parts.
384 384
      * @return  mixed
385 385
      */
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * callback returns a truthy value. If a number is passed, the last n values are excluded from the result.
467 467
      *
468 468
      * @param   array           $array      The array to traverse.
469
-     * @param   callable|int    $callback   The truth test the value should pass or an integer denoting how many
469
+     * @param   boolean    $callback   The truth test the value should pass or an integer denoting how many
470 470
      *                                      of the final elements of the array should be excluded. The count is
471 471
      *                                      1-indexed, ie. if you want to exclude the last 2 elements, pass 2.
472 472
      * @param   mixed           $default    The default value to be returned if none of the elements passes the test.
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
      *  - @see Arr::tail()
773 773
      *
774 774
      * @param   array               $array      The array to traverse.
775
-     * @param   callable|int|bool   $callback   The truth test the value should pass or an integer denoting how many
775
+     * @param   boolean   $callback   The truth test the value should pass or an integer denoting how many
776 776
      *                                          of the initial elements of the array should be excluded. The count
777 777
      *                                          is 1-indexed, ie. if you want to exclude the first 2 elements, pass 2.
778 778
      *                                          When a falsy value is given, the method will return all but the first
Please login to merge, or discard this patch.
src/diagnostics/Debug.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     /**
127 127
      * Returns the Dumper in use.
128 128
      *
129
-     * @return  interfaces\Dumper|callable
129
+     * @return  interfaces\Dumper
130 130
      */
131 131
     public static function getDumper() : interfaces\Dumper
132 132
     {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     /**
180 180
      * Returns a default variable dumper to be used by self::dump() if no other has been set.
181 181
      *
182
-     * @return  interfaces\Dumper|callable  $dumper
182
+     * @return  string  $dumper
183 183
      */
184 184
     protected static function getDefaultDumper()
185 185
     {
Please login to merge, or discard this patch.