-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[PHP CS Fixer] Update the config #1611
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * This file is part of the Symfony package. | ||
| * | ||
| * (c) Fabien Potencier <fabien@symfony.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| $fileHeaderComment = <<<COMMENT | ||
| This file is part of the Symfony package. | ||
|
|
@@ -9,35 +18,20 @@ | |
| file that was distributed with this source code. | ||
| COMMENT; | ||
|
|
||
| $finder = PhpCsFixer\Finder::create() | ||
| ->in(__DIR__) | ||
| ->exclude('config') | ||
| ->exclude('var') | ||
| ->exclude('public/bundles') | ||
| ->exclude('public/build') | ||
| // exclude files generated by Symfony Flex recipes | ||
| ->notPath('public/index.php') | ||
| ->notPath('importmap.php') | ||
| ; | ||
|
|
||
| return (new PhpCsFixer\Config()) | ||
| ->setFinder( | ||
| PhpCsFixer\Finder::create()->in(['src', 'tests'])->append([__FILE__]) | ||
| ) | ||
| ->setRiskyAllowed(true) | ||
| ->setRules([ | ||
| '@Symfony' => true, | ||
| '@Symfony:risky' => true, | ||
| 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], | ||
| 'linebreak_after_opening_tag' => true, | ||
| 'mb_str_functions' => true, | ||
| 'no_php4_constructor' => true, | ||
| 'no_unreachable_default_argument_value' => true, | ||
| 'no_useless_else' => true, | ||
| 'no_useless_return' => true, | ||
| 'php_unit_strict' => true, | ||
| 'phpdoc_order' => true, | ||
|
Contributor
Author
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 rule is also part of the Symfony ruleset but with a different order. To me it makes more sense for the Symfony Demo Application to use the same order as the Symfony project. |
||
| 'strict_comparison' => true, | ||
| 'strict_param' => true, | ||
| 'blank_line_between_import_groups' => false, | ||
|
Contributor
Author
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 rule is set to the opposite of the rule that is part of the Symfony ruleset. Again I think it makes more sense to follow the Symfony project.
Member
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. The result is pretty ugly in my opinion ... but you are completely right. Following the Symfony practices strictly should be the goal of this repository. Thanks. |
||
| ]) | ||
| ->setFinder($finder) | ||
| ->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache') | ||
| ; | ||
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.
The current Finder config first includes the whole project dir and then basically excludes everything but 'src' and 'tests'. This can be simplified to include just 'src' and 'tests'.