Polish annotations following the covariance work - #85
Merged
Conversation
GrahamCampbell
force-pushed
the
polish-annotations
branch
from
August 24, 2026 00:41
92ffac8 to
f364632
Compare
GrahamCampbell
force-pushed
the
polish-annotations
branch
from
August 24, 2026 00:48
f364632 to
71cacc5
Compare
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.
This follows up #84 with the docblock-only refinements found while auditing the covariance work.
None::getOrElse()andNone::getOrCall()now declare their own return types, exactly as #84 already did for the fold methods, which repairs the twoMoreSpecificReturnTypeerrors Psalm started reporting againstNonewhen it becameOption<never>, andSome's equivalents now returnTinstead of a union with a default that is never used.fromArraysValue()gains a key template so thatArrayAccessimplementations with keys narrower thanint|stringare no longer falsely rejected,fromReturn()types its arguments array and asserts its callback's return, andlift()loses a template parameter that was never referenced in favour of an honest callable return type, which also makes the lifted function's result chainable. Together these remove three entries from the PHPStan baseline, taking it from eight to five, and every consumer-visible inference either stays identical or becomes more precise on both PHPStan and Psalm. The final commit fixes some broken prose in the factory summaries and adds the missing@throwstags ongetOrThrow()and theLazyOptionconstructor. These are annotation and comment changes only, with no runtime code changes, and this should be merged before 1.10.0 is tagged, so that the release ships the covariance work and this polish together.