psr7
psr7 copied to clipboard
Clarify static return type of MessageTrait methods
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.