minor #4168 add type-hints to the LoopContext constructor (xabbuh)

This PR was merged into the 4.x branch.

Discussion
----------

add type-hints to the LoopContext constructor

see https://github.com/twigphp/Twig/pull/4153#discussion_r1696308898

Commits
-------

27e137a6 add type-hints to the LoopContext constructor
This commit is contained in:
Fabien Potencier
2024-07-31 22:47:52 +02:00
+5 -5
View File
@@ -24,10 +24,10 @@ final class LoopContext
public function __construct(
private LoopIterator $loop,
private $parent,
private $blocks,
private $recurseFunc,
private $depth,
private mixed $parent,
private array $blocks,
private \Closure $recurseFunc,
private int $depth,
) {
}
@@ -103,7 +103,7 @@ final class LoopContext
return $values[$this->getIndex0() % count($values)];
}
public function __invoke($iterator): \Generator
public function __invoke($iterator): iterable
{
if ($this->depth > 50) {
throw new \RuntimeException('Nesting level too deep.');