Skip to content

Make generic model compatible with PHP 8.1#11846

Merged
frantuma merged 2 commits into
swagger-api:masterfrom
BafS:patch-1
Oct 13, 2022
Merged

Make generic model compatible with PHP 8.1#11846
frantuma merged 2 commits into
swagger-api:masterfrom
BafS:patch-1

Conversation

@BafS

@BafS BafS commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Add #[\ReturnTypeWillChange] (https://php.watch/versions/8.1/ReturnTypeWillChange) to avoid deprecation notices.

Fixes #11820

cc. @dkarlovi and @mandrean

Add #[\ReturnTypeWillChange] (https://php.watch/versions/8.1/ReturnTypeWillChange) to avoid deprecation notices.
@EgorBurykin

Copy link
Copy Markdown

Hello, is there any way we can have it merged? It seems to be a valid workaround.

@mbouwer

mbouwer commented Sep 2, 2022

Copy link
Copy Markdown

This would certainly help us. The PR seems valid, could this be merged into the codebase please?

@BafS

BafS commented Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

@dkarlovi and @mandrean, would it be possible to merge this PR?

@BafS

BafS commented Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

or @gracekarina maybe

@deguif

deguif commented Oct 3, 2022

Copy link
Copy Markdown

Any news on this one, many projects are waiting to support PHP 8.1 as without this, it triggers deprecations.

@BafS

BafS commented Oct 3, 2022

Copy link
Copy Markdown
Contributor Author

@HugoMario maybe you could help me to merge the PR? The PHP maintainers do not seems to reply. Thanks in advance!

@deguif

deguif commented Oct 4, 2022

Copy link
Copy Markdown

ping @frantuma maybe

@BafS

BafS commented Oct 5, 2022

Copy link
Copy Markdown
Contributor Author

@char0n @gracekarina @ponelat @frantuma could anyone help us to merge this PR?

@deguif

deguif commented Oct 7, 2022

Copy link
Copy Markdown

@BafS in the meantime you can rebase the branch so that This branch is out-of-date with the base branch message disappears.

Let's hope that a core contributor will be able to have a look and merge this one soon as it's a real pain currently for PHP >= 8.1 and will become more and more annoying as PHP 8.2 is near to be released.

@ponelat

ponelat commented Oct 10, 2022

Copy link
Copy Markdown
Contributor

Thanks for your patience folks, from my limited knowledge of PHP, ReturnTypeWillChange is backwards compatible with older versions of PHP? If so, I think it should be good to merge. @HugoMario if you're happy, I think lets get this merged.
And yes please, could you rebase @BafS

@deguif

deguif commented Oct 11, 2022

Copy link
Copy Markdown

@ponelat thanks for your feedback.
You're right, #[\ReturnTypeWillChange] is backward compatible as attributes are not interpreted on PHP versions lower than 8.x.

@BafS

BafS commented Oct 12, 2022

Copy link
Copy Markdown
Contributor Author

@ponelat Thanks for your answer! PR synced (not sure why this is necessary as there is no conflicts), and yes as @deguif says, it is fully backward compatible.

@ponelat ponelat requested a review from HugoMario October 12, 2022 11:40
@frantuma frantuma merged commit 621a733 into swagger-api:master Oct 13, 2022
@frantuma

Copy link
Copy Markdown
Contributor

Thanks!

@BafS

BafS commented Oct 14, 2022

Copy link
Copy Markdown
Contributor Author

Thank you! Do you know when the next release will be tagged?

@BafS

BafS commented Nov 2, 2022

Copy link
Copy Markdown
Contributor Author

@frantuma any chance to create a new tag to have the release available to the world?

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.

[PHP] ArrayAccess methods in Models missing return types

6 participants