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

[php-symfony] Symfony6 support #11339

Closed
wants to merge 3 commits into from

Conversation

sensorario
Copy link

@sensorario sensorario commented Jan 17, 2022

Update php-symfony's generator template to work with Symfony6 and php8. fix #11322

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    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.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Hi @jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @ybelenko, @renepardon! I've made this PR because I needed to generate php code from a swagger file. I am using Symfony8 and php8. Hope this Pull request is good enough or a starting point to improve the symfony support of this project.

@wing328
Copy link
Member

wing328 commented Jan 17, 2022

@sensorario thanks for the PR. Is it correct to say that this is a breaking change? If that's case, should this PR target 6.0.x branch (breaking changes without fallback)?

@sensorario sensorario changed the base branch from master to 6.0.x January 17, 2022 16:07
@sensorario sensorario changed the base branch from 6.0.x to master January 17, 2022 16:13
@sensorario
Copy link
Author

@wing328 yes. May I rebase into 6.0.x, ...

@sensorario sensorario changed the base branch from master to 6.0.x January 17, 2022 16:24
@sensorario sensorario marked this pull request as draft January 17, 2022 16:25
@sensorario sensorario marked this pull request as ready for review January 17, 2022 16:53
@sensorario
Copy link
Author

@wing328 I think something went wrong. I checked out branch 6.0.x. I moved all my changes here. Recreated symfony6-support branch from here and then followed the steps

./mvnw clean package 
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh

But now I see all samples generated.

@sensorario
Copy link
Author

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 this PR is goot just php-symfony or may I add all other updated examples?

@ybelenko ybelenko self-requested a review January 18, 2022 09:05
@ybelenko
Copy link
Contributor

Cool, finally someone ready to share modern Symfony build. Let me review, I want to test it locally before merge. Thanks @sensorario

@ybelenko ybelenko changed the title Symfony6 support [php-symfony] Symfony6 support Jan 18, 2022
@ybelenko
Copy link
Contributor

Hmm, Symfony 6 requires php: >=8.0.2 and we should provide something for php 7.4(still supported until Nov 28, 2022). @wing328 what do you think, maybe keep the old version with creating new generator like php-symfony-6?

@wing328
Copy link
Member

wing328 commented Jan 18, 2022

maybe keep the old version with creating new generator like php-symfony-6?

Sounds good to me.

@sensorario
Copy link
Author

I guess something is not clear for me. I checked out 6.0.x to, started new branch from here. [...] Then, ... the command ./bin/generate-samples.sh fails. May I open new issue? Should the sequence

./mvnw clean package 
./bin/generate-samples.sh
./bin/utils/export_docs_generators.sh

must works in 6.0.x branch?

@wing328 wing328 changed the base branch from 6.0.x to master February 8, 2022 05:35
@wing328
Copy link
Member

wing328 commented Feb 8, 2022

@sensorario I've changed the PR target branch to "master" (which is the upcoming v6.0.0 release). Can you please resolve the merge conflicts when you've time?

"jms/serializer-bundle": "^2.0",
"symfony/framework-bundle": "^4.4.8"
"symfony/validator": "6.0.*",
"jms/serializer-bundle": "6.0.*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest available version is 4.0.2
https://packagist.org/packages/jms/serializer-bundle

@BenjaminHae
Copy link
Contributor

BenjaminHae commented Feb 14, 2022

When requiring the package created using this PR with composer, the following error is returned:

PHP Fatal error:  Declaration of OpenAPI\Server\DependencyInjection\OpenAPIServerExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias(): string in DependencyInjection/OpenAPIServerExtension.php

I think the return value of getAlias must be string.

Additionally the version of jms/serializer-bundle required in composer.json is 6.0.x. The latest available version however is 4.0.2

@BenjaminHae
Copy link
Contributor

Additionally, I think some work needs to be done for compatibility with the new JMS/Serializer version.
As a first step the changes introduced by this PR #10763 can be taken.
However this targets version 3.5. for version 4.0 some more work is needed.

@BenjaminHae BenjaminHae mentioned this pull request Mar 5, 2022
5 tasks
@ybelenko
Copy link
Contributor

Additionally, I think some work needs to be done for compatibility with the new JMS/Serializer version.
As a first step the changes introduced by this PR #10763 can be taken.
However this targets version 3.5. for version 4.0 some more work is needed.

Well, I thought this PR contains significant changes(when I noticed updated files list 😅), but it's just bump of the Symfony and PHP number. I'm afraid that we have to start Symfony 6 generator from scratch. I'm not even sure that current codegen builds and works.

@sensorario did you compare generator output with basic Symfony 6 skeleton(fresh installation)? I think they completely different.

@BenjaminHae
Copy link
Contributor

@ybelenko I did the required changes to make it really work with symfony6 in #11810

@ybelenko
Copy link
Contributor

@sensorario thanks for the effort. I'm closing PR without merge in favour of #11810 let's focus in the one thread.

@ybelenko ybelenko closed this Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQ][PHP][SYMFONY] Upgrade php-symfony code generation to work witH Symfony6
5 participants