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] Better code format #5277

Open
1 task
wing328 opened this issue Apr 1, 2017 · 5 comments
Open
1 task

[PHP] Better code format #5277

wing328 opened this issue Apr 1, 2017 · 5 comments

Comments

@wing328
Copy link
Contributor

wing328 commented Apr 1, 2017

Description

When using PHP CodeSniffer, we found potential enhancemnets for auto-generated PHP code.

Swagger-codegen version
  • Current master
Steps to reproduce
composer install
./vendor/bin/phpcs --extensions=php ./lib
Related issues

#5190 (comment)

Suggest a Fix

If anyone wants to work on the enhancement, please reply to let us know.

@dkarlovi
Copy link
Contributor

dkarlovi commented Apr 3, 2017

This was actually being worked on in #3898, I never got around to resubmitting the changes. Would need to take into account changes from #5190, though.

@wing328
Copy link
Contributor Author

wing328 commented Apr 3, 2017

@dkarlovi right. I remember your PRs.

#5190 is submitted against 2.3.0 so your work on the master version of PHP API client is still valid.

After merging #5190 into 2.3.0, I'll publish a report by PHP CodeSniffer so that everyone knows what needs to be enhanced.

@dkarlovi
Copy link
Contributor

dkarlovi commented Apr 3, 2017

In #3863 I've added support for PHP CS Fixer which seems to becoming PHP CS style tool of choice, not only can it find CS violations, it can fix them.

Would need to update the config file for a new version. Also, I'm using full code inspection from PHPStorm which also catches typos and such (some of which are also fixed in the PR linked).

@wing328
Copy link
Contributor Author

wing328 commented Apr 3, 2017

For the time being, we can leverage PHP-CS-Fixer to update the code in terms of style and format.

Ideally I want to update the templates for PHP API client without the need to run php-cs-fixer manually.

@dkarlovi
Copy link
Contributor

dkarlovi commented Apr 3, 2017

That was the original idea, but you get to also run php-cs-fixer from CI, it can also be run in "find only" mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants