for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Doctrine\ORM\Query;
use ArrayAccess;
use Doctrine\ORM\Query;
use Iterator;
use function key;
use function next;
use function reset;
class TreeWalkerChainIterator implements Iterator, ArrayAccess
{
/** @var TreeWalker[] */
private $walkers = [];
/** @var TreeWalkerChain */
private $treeWalkerChain;
/** @var Query */
private $query;
/** @var ParserResult */
private $parserResult;
public function __construct(TreeWalkerChain $treeWalkerChain, $query, $parserResult)
$this->treeWalkerChain = $treeWalkerChain;
$this->query = $query;
$this->parserResult = $parserResult;
}
/**
* {@inheritdoc}
*/
public function rewind()
return reset($this->walkers);
public function current()
return $this->offsetGet(key($this->walkers));
public function key()
return key($this->walkers);
public function next()
next($this->walkers);
return $this->offsetGet(key($this->walkers))
object
Iterator::next()
void
public function valid()
return key($this->walkers) !== null;
public function offsetExists($offset)
return isset($this->walkers[$offset]);
public function offsetGet($offset)
if ($this->offsetExists($offset)) {
return new $this->walkers[$offset](
$this->query,
$this->parserResult,
$this->treeWalkerChain->getQueryComponents()
);
return null;
public function offsetSet($offset, $value)
if ($offset === null) {
$this->walkers[] = $value;
} else {
$this->walkers[$offset] = $value;
public function offsetUnset($offset)
unset($this->walkers[$offset]);