@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public static function lstrip($chars = " \t\n\r\0\x0B") |
| 18 | 18 | { |
| 19 | - return function ($value) use ($chars) { |
|
| 19 | + return function($value) use ($chars) { |
|
| 20 | 20 | return ltrim($value, $chars); |
| 21 | 21 | }; |
| 22 | 22 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public static function rstrip($chars = " \t\n\r\0\x0B") |
| 28 | 28 | { |
| 29 | - return function ($value) use ($chars) { |
|
| 29 | + return function($value) use ($chars) { |
|
| 30 | 30 | return rtrim($value, $chars); |
| 31 | 31 | }; |
| 32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function strip($chars = " \t\n\r\0\x0B") |
| 38 | 38 | { |
| 39 | - return function ($value) use ($chars) { |
|
| 39 | + return function($value) use ($chars) { |
|
| 40 | 40 | return trim($value, $chars); |
| 41 | 41 | }; |
| 42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public static function length() |
| 48 | 48 | { |
| 49 | - return function ($value) { |
|
| 49 | + return function($value) { |
|
| 50 | 50 | return sizeof($value); |
| 51 | 51 | }; |
| 52 | 52 | } |
@@ -73,13 +73,13 @@ |
||
| 73 | 73 | public function __construct(\Closure $func, \Iterator $iterable, $reverse = false) |
| 74 | 74 | { |
| 75 | 75 | if ($reverse) { |
| 76 | - $cmp = function ($a, $b) use ($func) { |
|
| 76 | + $cmp = function($a, $b) use ($func) { |
|
| 77 | 77 | $orderA = $a['order']; |
| 78 | 78 | $orderB = $b['order']; |
| 79 | 79 | return $orderA == $orderB ? 0 : ($orderA < $orderB ? 1 : -1); |
| 80 | 80 | }; |
| 81 | 81 | } else { |
| 82 | - $cmp = function ($a, $b) use ($func) { |
|
| 82 | + $cmp = function($a, $b) use ($func) { |
|
| 83 | 83 | $orderA = $a['order']; |
| 84 | 84 | $orderB = $b['order']; |
| 85 | 85 | return $orderA == $orderB ? 0 : ($orderA < $orderB ? -1 : 1); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function __construct(\Closure $valueFunc /* [\Closure $keyFunc], \Iterator $iterable1, [\Iterator $iterable2, [...]] */) |
| 80 | 80 | { |
| 81 | - parent::__construct(\MultipleIterator::MIT_NEED_ALL | \MultipleIterator::MIT_KEYS_NUMERIC); |
|
| 81 | + parent::__construct(\MultipleIterator::MIT_NEED_ALL|\MultipleIterator::MIT_KEYS_NUMERIC); |
|
| 82 | 82 | $args = func_get_args(); |
| 83 | 83 | $argsContainsKeyFunc = $args[1] instanceof \Closure; |
| 84 | 84 | $this->valueFunc = $args[0]; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if ($argsContainsKeyFunc) { |
| 87 | 87 | $this->keyFunc = $args[1]; |
| 88 | 88 | } else { |
| 89 | - $this->keyFunc = function () { |
|
| 89 | + $this->keyFunc = function() { |
|
| 90 | 90 | return $this->genericKeysToKey(func_get_args()); |
| 91 | 91 | }; |
| 92 | 92 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | return join( |
| 125 | 125 | ':', |
| 126 | 126 | array_map( |
| 127 | - function ($key) { |
|
| 127 | + function($key) { |
|
| 128 | 128 | return (string)$key; |
| 129 | 129 | }, |
| 130 | 130 | $keys |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | function mixed_to_closure($closure) |
| 70 | 70 | { |
| 71 | 71 | if (is_null($closure)) { |
| 72 | - return function ($value) { |
|
| 72 | + return function($value) { |
|
| 73 | 73 | return $value; |
| 74 | 74 | }; |
| 75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // A \Closure is always callable, but a callable is not always a \Closure. |
| 80 | 80 | // Checking within this if statement is a slight optimization, preventing an unnecessary function wrap |
| 81 | 81 | if (is_callable($closure)) { |
| 82 | - $closure = function () use ($closure) { |
|
| 82 | + $closure = function() use ($closure) { |
|
| 83 | 83 | return call_user_func_array($closure, func_get_args()); |
| 84 | 84 | }; |
| 85 | 85 | } else { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | if (is_string($strategy)) { |
| 113 | 113 | $keyParts = explode('.', $strategy); |
| 114 | - $strategy = function ($value) use ($keyParts) { |
|
| 114 | + $strategy = function($value) use ($keyParts) { |
|
| 115 | 115 | foreach ($keyParts as $keyPart) { |
| 116 | 116 | if (is_array($value) && array_key_exists($keyPart, $value)) { |
| 117 | 117 | $value = $value[$keyPart]; |
@@ -203,8 +203,8 @@ |
||
| 203 | 203 | * > count(2.5, 0.5) |
| 204 | 204 | * 2.5 3.0 3.5 4.0 ... |
| 205 | 205 | * |
| 206 | - * @param int|float $start |
|
| 207 | - * @param int|float $step |
|
| 206 | + * @param integer $start |
|
| 207 | + * @param integer $step |
|
| 208 | 208 | * @return CountIterator |
| 209 | 209 | */ |
| 210 | 210 | function count($start = 0, $step = 1) |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | switch (sizeof($args)) { |
| 573 | 573 | case 2: |
| 574 | 574 | $strategy = conversions\mixed_to_value_getter($args[0]); |
| 575 | - $closure = function ($value, $key) use ($strategy) { |
|
| 575 | + $closure = function($value, $key) use ($strategy) { |
|
| 576 | 576 | $tempVarPhp54 = call_user_func($strategy, $value, $key); |
| 577 | 577 | return !empty($tempVarPhp54); |
| 578 | 578 | }; |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | case 3: |
| 583 | 583 | $strategy = conversions\mixed_to_value_getter($args[0]); |
| 584 | 584 | $userClosure = $args[1]; |
| 585 | - $closure = function ($value, $key) use ($strategy, $userClosure) { |
|
| 585 | + $closure = function($value, $key) use ($strategy, $userClosure) { |
|
| 586 | 586 | return call_user_func($userClosure, call_user_func($strategy, $value, $key)); |
| 587 | 587 | }; |
| 588 | 588 | $iterable = conversions\mixed_to_iterator($args[2]); |
@@ -21,8 +21,6 @@ |
||
| 21 | 21 | * until it is exhausted, then proceeds to the next iterable, until |
| 22 | 22 | * all the iterables are exhausted. |
| 23 | 23 | * |
| 24 | - * @param array|string|\Iterator $iterable |
|
| 25 | - * @param array|string|\Iterator $iterable2 |
|
| 26 | 24 | * @return Itertools\lib\ChainIterator |
| 27 | 25 | * |
| 28 | 26 | * @see Itertools\lib\Traits\ChainTrait::chain |
@@ -26,8 +26,6 @@ |
||
| 26 | 26 | * > iter\iterable('ABC', 'DEF')->chain() |
| 27 | 27 | * A B C D E F |
| 28 | 28 | * |
| 29 | - * @param array|string|\Iterator $iterable |
|
| 30 | - * @param array|string|\Iterator $iterable2 |
|
| 31 | 29 | * @return null|ChainIterator |
| 32 | 30 | */ |
| 33 | 31 | public function chain(/* $iterable, $iterable2, ... */) |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | if ($this instanceof \Iterator) { |
| 24 | 24 | $strategy = conversions\mixed_to_value_getter($strategy); |
| 25 | - $isValid = function ($value, $key) use ($strategy) { |
|
| 25 | + $isValid = function($value, $key) use ($strategy) { |
|
| 26 | 26 | $tempVarPhp54 = $strategy($value, $key); |
| 27 | 27 | return !empty($tempVarPhp54); |
| 28 | 28 | }; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function add() |
| 17 | 17 | { |
| 18 | - return function ($a, $b) { |
|
| 18 | + return function($a, $b) { |
|
| 19 | 19 | if (!is_numeric($a)) { |
| 20 | 20 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform addition, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 21 | 21 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function sub() |
| 35 | 35 | { |
| 36 | - return function ($a, $b) { |
|
| 36 | + return function($a, $b) { |
|
| 37 | 37 | if (!is_numeric($a)) { |
| 38 | 38 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform subtraction, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function mul() |
| 53 | 53 | { |
| 54 | - return function ($a, $b) { |
|
| 54 | + return function($a, $b) { |
|
| 55 | 55 | if (!is_numeric($a)) { |
| 56 | 56 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform multiplication, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function min() |
| 71 | 71 | { |
| 72 | - return function ($a, $b) { |
|
| 72 | + return function($a, $b) { |
|
| 73 | 73 | if (!(is_numeric($a) || $a instanceof \DateTime)) { |
| 74 | 74 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine minimum, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | function max() |
| 89 | 89 | { |
| 90 | - return function ($a, $b) { |
|
| 90 | + return function($a, $b) { |
|
| 91 | 91 | if (!(is_numeric($a) || $a instanceof \DateTime)) { |
| 92 | 92 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine maximum, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 93 | 93 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if (!is_string($glue)) { |
| 110 | 110 | throw new \InvalidArgumentException(sprintf('Argument $GLUE must be a string to join, not %s', is_object($glue) ? get_class($glue) : gettype($glue))); |
| 111 | 111 | } |
| 112 | - return function ($a, $b) use ($glue) { |
|
| 112 | + return function($a, $b) use ($glue) { |
|
| 113 | 113 | if (!is_string($a)) { |
| 114 | 114 | throw new \InvalidArgumentException(sprintf('Argument $A must be a string to join, not %s', is_object($a) ? get_class($a) : gettype($a))); |
| 115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function chain() |
| 133 | 133 | { |
| 134 | - return function ($chainIterator, $b) { |
|
| 134 | + return function($chainIterator, $b) { |
|
| 135 | 135 | if (!($chainIterator instanceof ChainIterator)) { |
| 136 | 136 | throw new \InvalidArgumentException('Argument $A must be a ChainIterator. Did your call "reduce" with "new ChainIterator()" as the initial parameter?'); |
| 137 | 137 | } |