Skip to content

Tags: nikic/iter

Tags

v2.4.1

Toggle v2.4.1's commit message
fix: improve typehint for toArray

v2.4.0

Toggle v2.4.0's commit message
Add PHP 8.2 and PHP 8.3 to CI

v2.3.0

Toggle v2.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Make phpdoc types more precise (#93)

Improve type annotations by making use of templates, callable signatures
and other type system features supported by psalm and phpstan.

Additionally, this makes the following changes:
 * Fix CI to work on PHP 7.1 again.
 * Add psalm and phpstan to require-dev for validation.
 * Handle IteratorAggregate returning a non-Iterator in isEmpty().
 * In functions that take a `$levels = INF` parameter or similar, changed
  `INF` to `PHP_INT_MAX` as `INF` is a float type and not int as declared.
  In these cases, `$levels` can never exceed the `PHP_INT_MAX` anyhow.
* Split off RewindableGenerator from RewindableIterator.
* Psalm does not have support for recursive types. Functions which use
 recursive types have had a note added to the docblock to explain this.
* I've not added docblocks to the functions in the `\iter\rewindable`
  namespace, as that would necessarily mean that any changes to the
  regular function would also need to be reflected in the docblocks for
  these methods. This does mean that these functions do not benefit from
  the Psalm type annotations currently.

Co-authored-by: Andrew Moyes <andrew.moyes@futurenet.com>

v2.2.0

Toggle v2.2.0's commit message

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
PHP 8.1: fix deprecation notices

A run on PHP 8.1 currently shows:
```
PHP Deprecated:  Return type of iter\rewindable\_RewindableGenerator::current() should either be compatible with Iterator::current(): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/src/iter.rewindable.php on line 123
PHP Deprecated:  Return type of iter\rewindable\_RewindableGenerator::next() should either be compatible with Iterator::next(): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/src/iter.rewindable.php on line 108
PHP Deprecated:  Return type of iter\rewindable\_RewindableGenerator::key() should either be compatible with Iterator::key(): mixed, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/src/iter.rewindable.php on line 118
PHP Deprecated:  Return type of iter\rewindable\_RewindableGenerator::valid() should either be compatible with Iterator::valid(): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/src/iter.rewindable.php on line 113
PHP Deprecated:  Return type of iter\rewindable\_RewindableGenerator::rewind() should either be compatible with Iterator::rewind(): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/src/iter.rewindable.php on line 103
PHP Deprecated:  Return type of iter\_CountableTestDummy::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/iter/iter/test/iterTest.php on line 625
```

These deprecation notices relate to the [Return types for internal methods RFC](https://wiki.php.net/rfc/internal_method_return_types) in PHP 8.1.

Using the attribute will silence the deprecation notices for now for those methods for which it cannot be added yet (PHP 8.0 `mixed`).
For all other methods, the return type has now been added.

v2.1.0

Toggle v2.1.0's commit message
Add slice() and mapWithKeys() to README

v2.0.0

Toggle v2.0.0's commit message
Add chunkWithKeys()

For symmetry with toArray/WithKeys add an explicit
chunkWithKeys() function, which is more obvious than a magic
boolean parameter.

v1.6.0

Toggle v1.6.0's commit message
Add isEmpty() function

v1.5.0

Toggle v1.5.0's commit message
Also allow PHPUnit 4.0

The 1.x branch supports PHP 5.5, which is not supported by
PHPUnit 5.0.

v1.4.0

Toggle v1.4.0's commit message
Add iter\recurse()

v1.3.0

Toggle v1.3.0's commit message
Added $key parameter to reduction callbacks