You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functiontestGenerator() {
for ($i = 0; $i <= 5; ++$i) {
yield = ['id' => $id];
}
}
$entries = testGenerator();
$collectionRepresentation = newCollectionRepresentation($entries);
// Following code will error: An Exception was thrown while handling: Cannot rewind a generator that was already run$entries->rewind();
The text was updated successfully, but these errors were encountered:
This lines: https://github.com/willdurand/Hateoas/blob/master/src/Hateoas/Representation/CollectionRepresentation.php#L64-L66
will resolve a Generator and throws an error in my StreamedResponse:
An Exception was thrown while handling: Cannot rewind a generator that was already run
.The changes seems to come from 1944881#diff-2961d2c1218fee48b9674553eeab647a so I'm not sure why @adrienbrault did add it.
Maybe we could go with:
so that the generator is not resolved.
Code to reproduce:
The text was updated successfully, but these errors were encountered: