class EventCollectionIterator
@template-implements Iterator<int, Event>
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Hierarchy
- class \PHPUnit\Event\EventCollectionIterator implements \Iterator
Expanded class hierarchy of EventCollectionIterator
File
-
vendor/
phpunit/ phpunit/ src/ Event/ Events/ EventCollectionIterator.php, line 20
Namespace
PHPUnit\EventView source
final class EventCollectionIterator implements Iterator {
/**
* @psalm-var list<Event>
*/
private readonly array $events;
private int $position = 0;
public function __construct(EventCollection $events) {
$this->events = $events->asArray();
}
public function rewind() : void {
$this->position = 0;
}
public function valid() : bool {
return $this->position < count($this->events);
}
public function key() : int {
return $this->position;
}
public function current() : Event {
return $this->events[$this->position];
}
public function next() : void {
$this->position++;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
EventCollectionIterator::$events | private | property | @psalm-var list<Event> |
EventCollectionIterator::$position | private | property | |
EventCollectionIterator::current | public | function | |
EventCollectionIterator::key | public | function | |
EventCollectionIterator::next | public | function | |
EventCollectionIterator::rewind | public | function | |
EventCollectionIterator::valid | public | function | |
EventCollectionIterator::__construct | public | function |