-
Notifications
You must be signed in to change notification settings - Fork 307
Add Php cs fixer #154
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
Merged
Merged
Add Php cs fixer #154
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c6c8ef9
add friendsofphp/php-cs-fixer
lachlan-00 c3e6b83
Add ordered_class_elements to cs-fixer
lachlan-00 dc12142
normalize line endings
lachlan-00 3d81ee2
static ordering missing
lachlan-00 1897e71
Update .gitattributes
lachlan-00 1ddd4ed
dupe rule names
lachlan-00 bbdf276
Add @PER-CS3x0
lachlan-00 0e16869
add and sort to .gitattributes
lachlan-00 4d32141
treat . as a char
lachlan-00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| /.idea/ | ||
| /.php-cs-fixer.cache | ||
| /.phpunit.result.cache | ||
| /composer.lock | ||
| /demo/*.jpg | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| <?php | ||
|
|
||
| $finder = PhpCsFixer\Finder::create() | ||
| ->in('src/') | ||
| ->in('tests/') | ||
| ; | ||
|
|
||
| return (new PhpCsFixer\Config()) | ||
| ->setRules([ | ||
| '@PSR12' => true, | ||
| 'no_useless_else' => true, | ||
| 'no_useless_return' => true, | ||
| 'simplified_if_return' => true, | ||
| 'no_superfluous_phpdoc_tags' => true, | ||
| 'single_class_element_per_statement' => true, | ||
| 'class_attributes_separation' => ['elements' => ['method' => 'one']], | ||
| 'no_superfluous_phpdoc_tags' => true, | ||
| 'single_class_element_per_statement' => true, | ||
|
lachlan-00 marked this conversation as resolved.
Outdated
|
||
| 'array_syntax' => [ | ||
| 'syntax' => 'short' | ||
| ], | ||
| 'blank_line_after_namespace' => true, | ||
| 'blank_line_before_statement' => [ | ||
| 'statements' => ['declare', 'return'] | ||
| ], | ||
| 'blank_line_between_import_groups' => true, | ||
| 'concat_space' => [ | ||
| 'spacing' => 'one' | ||
| ], | ||
| 'constant_case' => true, | ||
| 'braces_position' => [ | ||
| 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', | ||
| 'allow_single_line_empty_anonymous_classes' => true, | ||
| 'allow_single_line_anonymous_functions' => true | ||
| ], | ||
| 'declare_equal_normalize' => [ | ||
| 'space' => 'none' | ||
| ], | ||
| 'elseif' => true, | ||
| 'encoding' => true, | ||
| 'full_opening_tag' => true, | ||
| 'line_ending' => true, | ||
| 'lowercase_cast' => true, | ||
| 'method_argument_space' => [ | ||
| 'on_multiline' => 'ensure_fully_multiline', | ||
| 'keep_multiple_spaces_after_comma' => false, | ||
| ], | ||
| 'trailing_comma_in_multiline' => [ | ||
| 'elements' => ['parameters'], | ||
| ], | ||
| 'multiline_comment_opening_closing' => true, | ||
| 'no_break_comment' => false, | ||
| 'no_trailing_whitespace' => true, | ||
| 'no_trailing_whitespace_in_comment' => true, | ||
| 'no_whitespace_in_blank_line' => true, | ||
| 'return_type_declaration' => [ | ||
| 'space_before' => 'none', | ||
| ], | ||
| 'single_blank_line_at_eof' => true, | ||
| 'strict_param' => false, | ||
| 'modifier_keywords' => [ | ||
| 'elements' => ['const', 'method', 'property'] | ||
| ], | ||
| 'no_unused_imports' => true, | ||
| 'ordered_imports' => [ | ||
| 'sort_algorithm' => 'alpha' | ||
| ], | ||
| 'ordered_class_elements' => [ | ||
| 'order' => [ | ||
| 'use_trait', | ||
| 'case', | ||
| 'constant_public', | ||
| 'constant_protected', | ||
| 'constant_private', | ||
| 'property_public_static', | ||
| 'property_protected_static', | ||
| 'property_private_static', | ||
| 'property_public', | ||
| 'property_protected', | ||
| 'property_private', | ||
| 'construct', | ||
| 'method_public_static', | ||
| 'method_protected_static', | ||
| 'method_private_static', | ||
| 'method_public', | ||
| 'method_protected', | ||
| 'method_private', | ||
| 'magic', | ||
| ], | ||
| 'sort_algorithm' => 'alpha', | ||
| ] | ||
| ]) | ||
| ->setIndent(" ") | ||
| ->setFinder($finder) | ||
| ->setLineEnding("\n") | ||
| ->setUsingCache(true) | ||
| ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) | ||
| ; | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.