[php] Add PSR-12 rule set#12302
Merged
wing328 merged 7 commits intoOpenAPITools:masterfrom May 9, 2022
Merged
Conversation
This version requires PHP 7.4 or 8.0 which perfectly meets our supported PHP right now.
This way it can be overwritten with local file(same name without "dist" part). Also it's recommended filename from the package doc.
I've changed config file a bit to look like example from the doc. Ref: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've added PSR-12 rule set to Php-CS-Fixer config since it's officially supported now.
The config file has been renamed to
.php-cs-fixer.dist.phpto be able to overwrite it with local config file withoutdistpart.I don't know why we have so many rules since we agreed to follow PSR-12 only at the first place.
New config:
If somebody knows why we have disabled:
Also added rule
no_leading_import_slash => falsebecause there are model classes with leadings slashes in imports. No clue why, but still.Fixer run output:
I would remove the old
.php_csfile from samples right in current PR, but the CI workflow will be failed instantly...Related #4726
cc @jebentier @dkarlovi @mandrean @jfastnacht @renepardon
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.