-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Upgrade PHP CS Fixer to v2 #8822
Changes from all commits
e79e488
00d531c
384af79
bbc5f4e
212f375
6f7c4a0
bd1a8cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do this file has to be in the root? No other options like Then please do changes similar to https://github.com/magento/magento2/blame/develop/.htaccess#L225 in both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't change the way where you keep the file. If you want to move it to non-default location and point the location every time you run the PHP CS Fixer from CLI - it's possible, it's up to you. Also, I doubt that this file should be used only on Travis env. I updated `.htaccess, thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I'm asking whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @keradus please clarify this item and we are done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How config path is determined:
to work the best when one may want to run tool providing only subfolders, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok :) Too many details, what I needed is if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no (except when manually passing the config file as parameter) |
||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
/** | ||
* Pre-commit hook installation: | ||
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit | ||
*/ | ||
$finder = PhpCsFixer\Finder::create() | ||
->name('*.phtml') | ||
->exclude('dev/tests/functional/generated') | ||
->exclude('dev/tests/functional/var') | ||
->exclude('dev/tests/functional/vendor') | ||
->exclude('dev/tests/integration/tmp') | ||
->exclude('dev/tests/integration/var') | ||
->exclude('lib/internal/Cm') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please exclude Some of these paths are irrelevant already but it will not spoil anything and better to be addressed in separate PR or within this PR processing by Magento folks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got confused is it supposed to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one: https://github.com/magento/magento2/tree/develop/generated Ok, no objections from my side, could be updated with any other paths later. |
||
->exclude('lib/internal/Credis') | ||
->exclude('lib/internal/Less') | ||
->exclude('lib/internal/LinLibertineFont') | ||
->exclude('pub/media') | ||
->exclude('pub/static') | ||
->exclude('setup/vendor') | ||
->exclude('var'); | ||
|
||
return PhpCsFixer\Config::create() | ||
->setFinder($finder) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'concat_space' => ['spacing' => 'one'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has wider scope There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything undesired/unexpected? It's not an issue if now it fixes more cases than before :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some thinks it change too much operators. eg in this repo i noticed you like to have space around There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok :) Here we like consistency, not "zero spaces for concat, one space otherwise". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good for you ;) |
||
'include' => true, | ||
'new_with_braces' => true, | ||
'no_empty_statement' => true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha, I see, and it is not configurable, ok. |
||
'no_extra_consecutive_blank_lines' => true, | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'no_multiline_whitespace_before_semicolons' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_unused_imports' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'object_operator_without_whitespace' => true, | ||
'ordered_imports' => true, | ||
'standardize_not_equals' => true, | ||
'ternary_operator_spaces' => true, | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Except mentioned ruleset is identical 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the same line in composer's
gitignore
... No way to specify other path, likevar/.php_cs.cache
or something, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deafult location of
.php_cs.cache
is where.php_cs.dist
is.