Skip to content

Polish annotations following the covariance work - #85

Merged
GrahamCampbell merged 6 commits into
masterfrom
polish-annotations
Aug 24, 2026
Merged

Polish annotations following the covariance work#85
GrahamCampbell merged 6 commits into
masterfrom
polish-annotations

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Collaborator

This follows up #84 with the docblock-only refinements found while auditing the covariance work. None::getOrElse() and None::getOrCall() now declare their own return types, exactly as #84 already did for the fold methods, which repairs the two MoreSpecificReturnType errors Psalm started reporting against None when it became Option<never>, and Some's equivalents now return T instead of a union with a default that is never used. fromArraysValue() gains a key template so that ArrayAccess implementations with keys narrower than int|string are no longer falsely rejected, fromReturn() types its arguments array and asserts its callback's return, and lift() 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 @throws tags on getOrThrow() and the LazyOption constructor. 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.

@GrahamCampbell
GrahamCampbell merged commit 1d8abbe into master Aug 24, 2026
22 of 23 checks passed
@GrahamCampbell
GrahamCampbell deleted the polish-annotations branch August 24, 2026 00:49
Sign up for free to 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.

1 participant