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 #[ReturnTypeWillChange] for PHP 8.1 support #35

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

brotkrueml
Copy link
Contributor

In PHP 8.1 the return type of JsonSerializable::jsonSerialize() was added.
To maintain compatibility with older PHP versions the attribute
#[ReturnTypeWillChange] was introduced.

Deprecation warning: Return type of donatj\MockWebServer\RequestInfo::jsonSerialize()
should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the
#[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

See also: https://wiki.php.net/rfc/internal_method_return_types

@donatj
Copy link
Owner

donatj commented Sep 1, 2021

Want to go ahead and add 8.1 to

php-versions: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']

In PHP 8.1 the return type of JsonSerializable::jsonSerialize() was added.
To maintain compatibility with older PHP versions the attribute
#[ReturnTypeWillChange] was introduced.

Deprecation warning: Return type of donatj\MockWebServer\RequestInfo::jsonSerialize()
should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the
#[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

See also: https://wiki.php.net/rfc/internal_method_return_types

As the package phpspec/prophecy (a dependency from phpunit) has not released yet a
new version with PHP 8.1 compatibility I added a switch for composer install for
the time being.
@donatj
Copy link
Owner

donatj commented Sep 2, 2021

Awesome! I honestly wasn't sure how to resolve the prophecy issue but this works pretty elegantly. I would imagine when they tag a new release that works on 8.1, we can remove that!

@donatj donatj merged commit 95fb14c into donatj:master Sep 2, 2021
@donatj
Copy link
Owner

donatj commented Sep 2, 2021

Do you have any need for me to tag a release? Otherwise I might wait until I get some other things I'm working on done, which could be a couple months if nothing comes up in the meantime.

@brotkrueml
Copy link
Contributor Author

For me it is okay, can work with master. Thank you.

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