Skip to content

fix wrong type send to withHeader PSR response method - #79

Merged
clue merged 2 commits into
ratchetphp:masterfrom
Triplkrypl:master
Jul 28, 2026
Merged

fix wrong type send to withHeader PSR response method#79
clue merged 2 commits into
ratchetphp:masterfrom
Triplkrypl:master

Conversation

@Triplkrypl

Copy link
Copy Markdown
Contributor

Type int from getVersionNumber is not compatible with PSR interface method parameter with type string|array<string>.

Guzzle PSR-7 implementation start triggering deprecated error: https://github.com/guzzle/psr7/blob/640e2897bbee822dbc8af761d49e1a29b1f2a6b1/src/MessageTrait.php#L93.

I highly recommend you start using https://phpstan.org/ or https://psalm.dev/ dev tool to automatically detect errors like this.

@shehi

This comment was marked as spam.

@jonnywilliamson

Copy link
Copy Markdown

Yes this is polluting my logs at the moment! Would love to see it merged.

@clue clue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Triplkrypl Thanks for the fix, PSR-7 documents string|string[] for header values, so passing the string is the right call.

The same applies to ClientNegotiator, which hands getVersion() to withHeader() the same way. Mind covering that one too so this is complete?

Note this only shows up with guzzle, other PSR-7 implementations coerce it silently. Not a fan of how this is handled, but guzzle 3.0 now throws outright and it is common enough that we should pass a string.

@clue clue added the bug label Jul 27, 2026
@clue clue added this to the 0.4.2 milestone Jul 27, 2026
@Triplkrypl
Triplkrypl requested a review from clue July 27, 2026 14:38

@clue clue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Triplkrypl Thanks for the update, changes LGTM! :shipit:

@clue
clue merged commit 29fb6a3 into ratchetphp:master Jul 28, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants