Skip to content

Conversation

@braindawg
Copy link

Per the PSR spec (and the code), the methods on MessageTrait currently hinting MessageInterface should be returning static. That return type was not supported until PHP 8.0, so to maintain PHP 7 compatibility, a docblock can be used to clarify the return behavior of these methods.

This should appease static analyzers that throw errors when these methods are used on more specific implementations of MessageInterface.

Closes #617, which should hopefully explain the benefit of this change. Happy to clarify if not.

Per the PSR spec, the methods currently hinting MessageInterface should
be returning `static`. That was not supported until PHP 8.0, so to
maintain PHP 7 compatibility, a docblock can be used to clarify the
return behavior of these methods.

Closes guzzle#617.
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.

Return static for MessageTrait with... methods

1 participant