donatj / mock-webserver

Simple mock web server in PHP for unit testing.
MIT License
131 stars 21 forks source link

Add #[ReturnTypeWillChange] for PHP 8.1 support #35

Closed brotkrueml closed 2 years ago

brotkrueml commented 2 years ago

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 commented 2 years ago

Want to go ahead and add 8.1 to https://github.com/donatj/mock-webserver/blob/356203db6d8e2fccca679701ce45e113c65d3af2/.github/workflows/ci.yml#L14

donatj commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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