for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* event (https://github.com/phpgears/event).
* Event handling.
*
* @license MIT
* @link https://github.com/phpgears/event
* @author Julián Gutiérrez <[email protected]>
*/
declare(strict_types=1);
namespace Gears\Event;
use Gears\Event\Exception\InvalidEventException;
final class EventIteratorCollection implements EventCollection
{
/**
* @var \Iterator
private $iterator;
* EventIteratorCollection constructor.
* @param \Iterator $iterator
public function __construct(\Iterator $iterator)
$this->iterator = $iterator;
}
* {@inheritdoc}
* @return Event
public function current(): Event
$event = $this->iterator->current();
if (!$event instanceof Event) {
throw new InvalidEventException(\sprintf(
'Event collection only accepts %s, %s given',
Event::class,
\is_object($event) ? \get_class($event) : \gettype($event)
));
return $event;
public function next(): void
$this->iterator->next();
* @return string|int|null
integer|double|string|boolean
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function key()
return $this->iterator->key();
public function valid(): bool
return $this->iterator->valid();
public function rewind(): void
$this->iterator->rewind();
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.