Initial Commit
This commit is contained in:
41
dependencies/amphp/amp/lib/Internal/PrivateIterator.php
vendored
Normal file
41
dependencies/amphp/amp/lib/Internal/PrivateIterator.php
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Ultimo\Dependencies\Amp\Internal;
|
||||
|
||||
use WP_Ultimo\Dependencies\Amp\Iterator;
|
||||
use WP_Ultimo\Dependencies\Amp\Promise;
|
||||
/**
|
||||
* Wraps an Iterator instance that has public methods to emit, complete, and fail into an object that only allows
|
||||
* access to the public API methods.
|
||||
*
|
||||
* @template-covariant TValue
|
||||
* @template-implements Iterator<TValue>
|
||||
*/
|
||||
final class PrivateIterator implements Iterator
|
||||
{
|
||||
/** @var Iterator<TValue> */
|
||||
private $iterator;
|
||||
/**
|
||||
* @param Iterator $iterator
|
||||
*
|
||||
* @psalm-param Iterator<TValue> $iterator
|
||||
*/
|
||||
public function __construct(Iterator $iterator)
|
||||
{
|
||||
$this->iterator = $iterator;
|
||||
}
|
||||
/**
|
||||
* @return Promise<bool>
|
||||
*/
|
||||
public function advance() : Promise
|
||||
{
|
||||
return $this->iterator->advance();
|
||||
}
|
||||
/**
|
||||
* @psalm-return TValue
|
||||
*/
|
||||
public function getCurrent()
|
||||
{
|
||||
return $this->iterator->getCurrent();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user