1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00
Files
archived-doc-en/reference/spl/iteratoriterator
Andrew Lyons 8230e70922 Clarify usage of Iterator::valid methods (#3292)
This commit updates the documentation for the `valid` method of the
following iterators:

- `EmptyIterator` - add a note that this will always return false
- `FilterIterator` - add a note that the value will be false until the
  pointer is advanced to the first valid element
- `IteratorIterator` - clarify that the method checks if the element is
  valid.

These now match the source.

I have checked other iterators and these seem to be correctly
documented.

It's worth noting that the `ArrayIterator::valid` method behaves
differently - it checks if the next element is valid (confirmed in
source).

The `DirectoryIterator::valid` method may also be incorrectly
documented but I am not 100% sure of this. The documentation states
that the method checks if it is a valid _file_, but I believe that the
method checks if the Iterator element is valid.
2024-03-28 22:57:53 +01:00
..