FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve option and result type precision by GrahamCampbell · Pull Request #613 · vlucas/phpdotenv · GitHub

Improve option and result type precision - #613

Merged
GrahamCampbell merged 1 commit into
masterfrom
types/option-result-precision
Aug 24, 2026
Merged

Improve option and result type precision#613
GrahamCampbell merged 1 commit into
masterfrom
types/option-result-precision

Conversation

GrahamCampbell commented Aug 24, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

With the covariant option and result types in place, several annotations can now say precisely
what the code does. The five concrete adapters declare create() as returning an option of the
adapter itself rather than of the interface, which removes the widening casts inside them and
gives callers the concrete type. The repository builder's reader, writer and adapter parameters
now document the actual acceptance, an instance of the respective interface or a class-string of
an adapter, which matches the runtime guards exactly and lets the builder closures type-check
without laundering. The string and regex helpers declare the non-negative integer ranges they
actually produce, correcting a wrong-shaped cast in Str::pos. None of this changes behaviour, and
code typed against the old signatures only ever sees narrower types. The phpstan baseline shrinks
from sixteen entries to five as a byproduct.

Base automatically changed from deps/covariant-result-types to master August 24, 2026 17:16
GrahamCampbell force-pushed the types/option-result-precision branch from 165bc5d to 8b76297 Compare August 24, 2026 17:17
GrahamCampbell force-pushed the types/option-result-precision branch from 8b76297 to 46e982e Compare August 24, 2026 17:28
GrahamCampbell merged commit 979ef26 into master Aug 24, 2026
42 checks passed
GrahamCampbell deleted the types/option-result-precision branch August 24, 2026 17:42
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL