Releases: nikic/iter
Releases · nikic/iter
iter 2.4.0
iter 2.3.0
This release adds more precise phpdoc type annotations, using templates and specifying callable signatures (#93).
iter 2.2.0
- Compatibility with PHP 8.1.
iter 2.1.0
iter 2.0
This release makes iter compatible with PHP 7.4 by renaming the iter\fn
namespace to iter\func
.
- PHP >= 7.1 is now required. Functions are annotated with
iterable
types. (#52) - The
iter\fn
namespace has been renamed toiter\func
. This is necessary for PHP 7.4 compatibility. (#79) - Default
$preserveKeys = false
in chunk() and add chunkWithKeys() function. - Avoid advancing by one additional iteration in slice(). (#75)
iter 1.6
iter 1.5
iter 1.4
- Fixed infinite loop when
iter\zip()
is called without arguments. - Added additional error checks for various "length" and "count" parameters (usually disallowing negative numbers).
- The
iter\flatten()
function now preserves keys. - Added an
iter\recurse()
function. Example use isiter\recurse('iter\toArray', $data)
which will recursively convert an iterator to array.
iter 1.3
- Added
Iterator iter\product(...$iterables)
:
Returns the cartesian product iterator of the passed iterators. (#25) - Added
bool iter\isIterable(mixed $value)
:
Returns whether the value is an array or Traversable. - Added
$key
parameter to the callback ofreduce()
andreductions()
. (#28) - Added support for
<=>
tofn\operator()
. It is also supported on PHP versions that do not natively provide a<=>
operator. - All functions now validate that inputs are iterables.
iter 1.2
- Added new
iter
functions:mixed search(callable $predicate, iterable $iterable)
:
Returns the first value from$iterable
which satisfies$predicate
, ornull
if no such element exists.Iterator reductions(callable $function, iterable $iterable, mixed $startValue = null)
:
Returns an iterator which contains the intermediate values produced by applying a reduction function to an iterator. Can for example be used to compute cumulative sums.
- Added support for the power operator (
**
) toiter\fn\operator()
. Support is available also on older PHP versions which do not have an actual**
operator.