-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[PHP] Fix deprecations in PHP 8.1 #11743
Conversation
Hi Everyone |
6e15a6b
to
0dd25d5
Compare
Hi Everyone |
Gonna take care of it tomorrow. Sorry, too much daytime work. I want to pay maximum attention to all php based generators in the March. Next major release with breaking changes scheduled to the end of the month, I will have to wait for a year to add significant changes if I miss that deadline. Crazy. Thanks for patience. |
modules/openapi-generator/src/main/resources/php/model_generic.mustache
Outdated
Show resolved
Hide resolved
@@ -424,6 +425,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par | |||
* @return mixed Returns data which can be serialized by json_encode(), which is a value | |||
* of any type other than a resource. | |||
*/ | |||
#[\ReturnTypeWillChange] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't use mixed
type(accepted in PHP 8) to make it compatible with PHP 7.4, am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. PHP 7.4 is in the security support period, so I thought we shouldn't make breaking changes until it goes EOL.
@satackey You didn't test your own PR? Should at least mention that, we don't always check PRs locally. It's a luck that I noticed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked locally under PHP 7.4, 8.0 and 8.1. Works without notices or errors across versions.
Without this our client will issue deprecation warnings. This has been fixed in 6.x but we go for the latest version of 7.x to keep things updated. See OpenAPITools/openapi-generator#11743 Note that this may cause the current situation to be invalid as the client depends on Guzzle 7 while Drupaæ 9 still depends on Guzzle 6. This should be resolved shortly with the update to Drupal 10.
Fixed the following deprecations in PHP 8.1. This pull request resolves #11742.
Added the
#[\ReturnTypeWillChange]
attribute or the same type hint as the internal interface to the return value of methods that implement PHP's internal interfaceArrayAccess
.PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0)@jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ackintosh (2017/09) ❤️, @ybelenko (2018/07), @renepardon (2018/12)