Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return types to MimePart so it works on PHP 8 with the newer version of psr/http-message #42

Merged
merged 2 commits into from
Sep 9, 2023

Conversation

mattdinthehouse
Copy link
Contributor

@mattdinthehouse mattdinthehouse commented Sep 7, 2023

The MimePart class implements Psr\Http\Message\MessageInterface via guzzlehttp/guzzle which was recently updated with added return types that cause a "method is not compatible" type error in MimePart

This PR adds those return types to MimePart so it'll work on PHP 8

All the calling code expects MimePart::getBody() to return a string but now it returns a StreamInterface so I've updated the calling code in this library to use a new MimePart::getBodyString() method - if downstream users depend on strings then use this newer method to get them

… of psr/http-message that has return types which causes a Fatal Error on PHP 8; Add a MimePart::getBodyString() helper method that converts MimePart::getBody()'s StreamInterface into a string and update all the calling code for MimePart::getBody() over to MimePart::getBodyString()
@tiamo
Copy link
Owner

tiamo commented Sep 9, 2023

@mattdinthehouse Thanks! Looks good 👍

@tiamo tiamo merged commit c1cbd2c into tiamo:master Sep 9, 2023
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.

2 participants