Repository navigation
Improve PHPDoc return type for synchronous HTTP Client methods - #58090
Merged
Merged
Conversation
3 tasks done
Contributor
|
Nice! Thanks @khaled-sadek && @canvural |
Contributor
|
The facade automated commit for this looks odd - a void now. Does it understand the if or am I out of my league understanding this? |
akyrey
pushed a commit
to akyrey/framework
that referenced
this pull request
Dec 29, 2025
…el#58090) * Improve PHPDoc return type for synchronous HTTP Client methods * fix style
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 is changed?
This PR updates the PHPDoc return type annotations for the synchronous methods on the
Illuminate\Http\Client\PendingRequestclass.Methods affected include:
get(),post(),put(),patch(),delete(),head(), andsend().Why is this necessary?
When using the Laravel HTTP Client for synchronous requests, static analysis tools (like PHPStan/Larastan) may incorrectly infer the return type as potentially including a
GuzzleHttp\Promise\PromiseInterfaceobject (which is the actual return type for the asynchronous/concurrent methods).For synchronous calls (which is the default usage pattern), the method will always return an
Illuminate\Http\Client\Responseobject.By explicitly setting the return type to
\Illuminate\Http\Client\Response, we prevent false-positive errors in static analysis, resulting in a cleaner development experience for users relying on type-checking.This change aligns the documentation with the actual runtime behavior of the synchronous client calls.