Skip to content

Fix Traversable description - #5773

Merged
lacatoire merged 2 commits into
php:masterfrom
mmalferov:patch-4
Aug 19, 2026
Merged

Fix Traversable description#5773
lacatoire merged 2 commits into
php:masterfrom
mmalferov:patch-4

Conversation

@mmalferov

@mmalferovmmalferov commented Aug 18, 2026

Copy link
Copy Markdown
Member

Following by:

https://bugs.php.net/bug.php?id=62609

and

php/php-src@e9ae581

It seems the implements Traversable construct for abstract classes was introduced only as of PHP 8.0.0, not in 7.4.0.

The following example works only as of PHP 8.0.0. Prior to 8.0.0, including [7.4.0, 7.4.33], it generates:

Fatal error: Class AbstractTraversable must implement interface Traversable as part of either Iterator or IteratorAggregate:

<?phpabstractclass AbstractTraversable implements Traversable {}
class NonAbstractTraversable extends AbstractTraversable implements IteratorAggregate
{
publicfunctiongetIterator()
{
yieldfrom ['foo', 'bar',];
}
}
foreach (newNonAbstractTraversable() as$value) {
echo$value, "\n";
}

@lacatoire
lacatoire merged commit 14013fe into php:masterAug 19, 2026
2 checks passed
@mmalferov
mmalferov deleted the patch-4 branch August 19, 2026 11:11
lacatoire added a commit to lacatoire/doc-es that referenced this pull request Aug 19, 2026
julionc pushed a commit to php/doc-es that referenced this pull request Aug 21, 2026
* [Sync EN] Fix grammar in language/predefined (#5755)
* Align xi:include with doc-en and sync traversable.xml with php/doc-en#5773
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mmalferov@lacatoire