mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 02:46:29 +00:00
@@ -93,7 +93,7 @@ class ForNode extends Node
|
||||
$compiler->write("\$context = array_intersect_key(\$context, \$$parentVar) + \$$parentVar;\n");
|
||||
|
||||
$compiler
|
||||
->write("return; yield;\n")
|
||||
->write("yield from [];\n")
|
||||
->outdent()
|
||||
->write("};\n")
|
||||
->write("\Closure::bind(\$$functionVar, \$this, self::class);\n")
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
--DATA--
|
||||
return [
|
||||
'empty_it' => new \EmptyIterator(),
|
||||
'yielding_it' => (function (): \Generator { return; yield; })(),
|
||||
'yielding_it' => (function (): \Generator { yield from []; })(),
|
||||
]
|
||||
--EXPECT--
|
||||
OK
|
||||
|
||||
@@ -76,7 +76,7 @@ class ForTest extends NodeTestCase
|
||||
}
|
||||
unset(\$context['key'], \$context['item']);
|
||||
\$context = array_intersect_key(\$context, \$__internal_compile_2) + \$__internal_compile_2;
|
||||
return; yield;
|
||||
yield from [];
|
||||
};
|
||||
\Closure::bind(\$__internal_compile_1, \$this, self::class);
|
||||
yield from \$__internal_compile_1(\$__internal_compile_0, \$context, \$blocks, \$__internal_compile_1, 0);
|
||||
@@ -103,7 +103,7 @@ EOF
|
||||
}
|
||||
unset(\$context['k'], \$context['v'], \$context['loop']);
|
||||
\$context = array_intersect_key(\$context, \$__internal_compile_2) + \$__internal_compile_2;
|
||||
return; yield;
|
||||
yield from [];
|
||||
};
|
||||
\Closure::bind(\$__internal_compile_1, \$this, self::class);
|
||||
yield from \$__internal_compile_1(\$__internal_compile_0, \$context, \$blocks, \$__internal_compile_1, 0);
|
||||
@@ -130,7 +130,7 @@ EOF
|
||||
}
|
||||
unset(\$context['k'], \$context['v'], \$context['loop']);
|
||||
\$context = array_intersect_key(\$context, \$__internal_compile_2) + \$__internal_compile_2;
|
||||
return; yield;
|
||||
yield from [];
|
||||
};
|
||||
\Closure::bind(\$__internal_compile_1, \$this, self::class);
|
||||
yield from \$__internal_compile_1(\$__internal_compile_0, \$context, \$blocks, \$__internal_compile_1, 0);
|
||||
@@ -163,7 +163,7 @@ EOF
|
||||
}
|
||||
unset(\$context['k'], \$context['v'], \$context['loop']);
|
||||
\$context = array_intersect_key(\$context, \$__internal_compile_2) + \$__internal_compile_2;
|
||||
return; yield;
|
||||
yield from [];
|
||||
};
|
||||
\Closure::bind(\$__internal_compile_1, \$this, self::class);
|
||||
yield from \$__internal_compile_1(\$__internal_compile_0, \$context, \$blocks, \$__internal_compile_1, 0);
|
||||
@@ -186,7 +186,7 @@ EOF
|
||||
}
|
||||
unset(\$context['_key'], \$context['item'], \$context['loop']);
|
||||
\$context = array_intersect_key(\$context, \$__internal_compile_2) + \$__internal_compile_2;
|
||||
return; yield;
|
||||
yield from [];
|
||||
};
|
||||
\Closure::bind(\$__internal_compile_1, \$this, self::class);
|
||||
yield from \$__internal_compile_1(\$__internal_compile_0, \$context, \$blocks, \$__internal_compile_1, 0);
|
||||
|
||||
Reference in New Issue
Block a user