AST
9 months ago
Exec
9 months ago
Expr
9 months ago
Filter
9 months ago
Expr.php
9 months ago
FilterCollection.php
9 months ago
Lexer.php
9 months ago
OutputWalker.php
9 months ago
Parameter.php
9 months ago
ParameterTypeInferer.php
9 months ago
Parser.php
9 months ago
ParserResult.php
9 months ago
Printer.php
9 months ago
QueryException.php
9 months ago
QueryExpressionVisitor.php
9 months ago
ResultSetMapping.php
9 months ago
ResultSetMappingBuilder.php
9 months ago
SqlOutputWalker.php
9 months ago
SqlWalker.php
9 months ago
TokenType.php
9 months ago
TreeWalker.php
9 months ago
TreeWalkerAdapter.php
9 months ago
TreeWalkerChain.php
9 months ago
TreeWalkerChainIterator.php
9 months ago
index.php
9 months ago
TreeWalkerChainIterator.php
82 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Query; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use ArrayAccess; |
| 6 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 7 | use MailPoetVendor\Doctrine\ORM\AbstractQuery; |
| 8 | use Iterator; |
| 9 | use ReturnTypeWillChange; |
| 10 | use function key; |
| 11 | use function next; |
| 12 | use function reset; |
| 13 | class TreeWalkerChainIterator implements Iterator, ArrayAccess |
| 14 | { |
| 15 | private $walkers = []; |
| 16 | private $treeWalkerChain; |
| 17 | private $query; |
| 18 | private $parserResult; |
| 19 | public function __construct(TreeWalkerChain $treeWalkerChain, $query, $parserResult) |
| 20 | { |
| 21 | Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/pull/9511', '%s is deprecated and will be removed without replacement.', self::class); |
| 22 | $this->treeWalkerChain = $treeWalkerChain; |
| 23 | $this->query = $query; |
| 24 | $this->parserResult = $parserResult; |
| 25 | } |
| 26 | #[\ReturnTypeWillChange] |
| 27 | public function rewind() |
| 28 | { |
| 29 | return reset($this->walkers); |
| 30 | } |
| 31 | #[\ReturnTypeWillChange] |
| 32 | public function current() |
| 33 | { |
| 34 | return $this->offsetGet(key($this->walkers)); |
| 35 | } |
| 36 | #[\ReturnTypeWillChange] |
| 37 | public function key() |
| 38 | { |
| 39 | return key($this->walkers); |
| 40 | } |
| 41 | #[\ReturnTypeWillChange] |
| 42 | public function next() |
| 43 | { |
| 44 | next($this->walkers); |
| 45 | return $this->offsetGet(key($this->walkers)); |
| 46 | } |
| 47 | #[\ReturnTypeWillChange] |
| 48 | public function valid() |
| 49 | { |
| 50 | return key($this->walkers) !== null; |
| 51 | } |
| 52 | #[\ReturnTypeWillChange] |
| 53 | public function offsetExists($offset) |
| 54 | { |
| 55 | return isset($this->walkers[$offset ?? '']); |
| 56 | } |
| 57 | #[\ReturnTypeWillChange] |
| 58 | public function offsetGet($offset) |
| 59 | { |
| 60 | if ($this->offsetExists($offset)) { |
| 61 | return new $this->walkers[$offset]($this->query, $this->parserResult, $this->treeWalkerChain->getQueryComponents()); |
| 62 | } |
| 63 | return null; |
| 64 | } |
| 65 | #[\ReturnTypeWillChange] |
| 66 | public function offsetSet($offset, $value) |
| 67 | { |
| 68 | if ($offset === null) { |
| 69 | $this->walkers[] = $value; |
| 70 | } else { |
| 71 | $this->walkers[$offset] = $value; |
| 72 | } |
| 73 | } |
| 74 | #[\ReturnTypeWillChange] |
| 75 | public function offsetUnset($offset) |
| 76 | { |
| 77 | if ($this->offsetExists($offset)) { |
| 78 | unset($this->walkers[$offset ?? '']); |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 |