Repository navigation
Conversation
Several 5.0 changes need an entry in the update guide; adding the empty guide first keeps their pull requests from conflicting over its creation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Iterator and Countable methods relied on #[\ReturnTypeWillChange], which only defers PHP's tentative return type errors. They now declare the interface return types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
DatabaseIteratorimplementsIteratorandCountable, but its six methods only carried#[\ReturnTypeWillChange], which suppresses PHP's tentative-return-type deprecation instead of fixing it. They now declare the interface return types:count(): int,current(): mixed,key(): mixed,next(): void,rewind(): voidandvalid(): bool. The attribute is removed. Subclasses that override these methods must add the same return types, hence 5.x.This is the self-contained part of the review item "native types for
DatabaseInterface,QueryInterface,StatementInterfaceandDatabaseIterator". Typing the three interfaces (about 150 methods, implemented by every driver, query and statement class and by third-party subclasses) needs agreement on the exact types first; see the report.Testing Instructions
vendor/bin/phpunitandvendor/bin/phpunit -c phpunit.sqlite.xml.distpass (DatabaseIteratorTestand the drivergetIterator()tests), as do PHPStan and phpcs.Documentation Changes Required
Entry "
DatabaseIteratorhas native return types" indocs/v4-to-v5-update.md.Depends on #410 (creates
docs/v4-to-v5-update.md; this branch is based on it). Expect a trivial conflict in that file with the other 5.x PRs that append to it.🤖 Generated with Claude Code