for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* event-sourcing (https://github.com/phpgears/event-sourcing).
* Event Sourcing base.
*
* @license MIT
* @link https://github.com/phpgears/event-sourcing
* @author Julián Gutiérrez <[email protected]>
*/
declare(strict_types=1);
namespace Gears\EventSourcing\Event;
use Gears\EventSourcing\Event\Exception\InvalidAggregateEventException;
final class AggregateEventIteratorCollection implements AggregateEventCollection
{
/**
* @var \Iterator
private $iterator;
* AggregateEventIteratorCollection constructor.
* @param \Iterator $iterator
public function __construct(\Iterator $iterator)
$this->iterator = $iterator;
}
* {@inheritdoc}
* @return AggregateEvent
public function current(): AggregateEvent
$event = $this->iterator->current();
if (!$event instanceof AggregateEvent) {
throw new InvalidAggregateEventException(\sprintf(
'Aggregate event collection only accepts %s, %s given',
AggregateEvent::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.