Improve return types to prevent deprecation warnings#450
Merged
Conversation
26de958 to
ea792e8
Compare
ea792e8 to
9bcce9a
Compare
Author
|
@basz Can you have look? |
basz
approved these changes
Apr 8, 2026
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.
What changed
UpcastingIterator::key()gets a nativemixedreturn type, replacing the#[\ReturnTypeWillChange]attribute and@return mixeddocblock.MergedStreamIterator::current()andUpcastingIterator::current()retain their existing signatures - see below for why.prooph/bookdown-templateis removed fromrequire-devas it requiresleague/commonmark ~0.7which only resolves to0.19.x-dev, incompatible with PHP 8+. This was breaking the entire CI pipeline.UpcastingIterator::key()is safe becauseUpcastingIteratorisfinal- no subclasses can exist, so adding a return type cannot break anyone.The other two cannot use native types without a BC break:
MergedStreamIterator::current()-MergedStreamIteratoris notfinal. Adding any return type to a previously untyped method forces subclasses to declare a compatible type or receive a deprecation warning.UpcastingIterator::current()- already has?Message. Widening it tomixedis flagged as non-covariant by the BC checker, as callers may rely on the narrower type. Since?Messagealready satisfiesIterator::current(): mixedcovariantly, no deprecation warning is generated and no change is needed.