-
-
Notifications
You must be signed in to change notification settings - Fork 960
Make the CS stricter; fix some bugs / issues #1007
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 |
|---|---|---|
|
|
@@ -6,11 +6,43 @@ $finder = PhpCsFixer\Finder::create() | |
| ; | ||
|
|
||
| return PhpCsFixer\Config::create() | ||
| ->setRiskyAllowed(true) | ||
| ->setRules([ | ||
| '@Symfony' => true, | ||
| '@Symfony:risky' => true, | ||
| 'array_syntax' => [ | ||
| 'syntax' => 'short', | ||
| ], | ||
| 'braces' => [ | ||
| 'allow_single_line_closure' => true, | ||
| ], | ||
| 'declare_strict_types' => true, | ||
| 'modernize_types_casting' => true, | ||
| // 'native_function_invocation' => true, | ||
| 'no_extra_consecutive_blank_lines' => [ | ||
| 'break', | ||
|
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 one may be a bit controversial, but I think it's good that it encourages us to not have complex logic nested inside a switch-case, or even avoid switch-case altogether.
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. I agree with the intent, but it makes the code (even simple statements) less readable (IMO).
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. Yeah, personally I prefer the blank line too, but for the sake of consistency...
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. Consistency with what?
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. We cannot enforce a blank line before/after switch ($str) {
case 'A':
$this->doSomething();
$this->doSomethingElse();
break;
case 'B':
$this->doSomethingAwesome();
break;
}
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. But we can ignore this rule too and check it manually (it's not a big deal after all).
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. Do you need me to revert this? I'll have to do it manually...
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. Don't worry about that, keep it as is. |
||
| 'continue', | ||
| 'curly_brace_block', | ||
| 'extra', | ||
| 'parenthesis_brace_block', | ||
| 'return', | ||
| 'square_brace_block', | ||
| 'throw', | ||
| 'use', | ||
| ], | ||
| 'no_unreachable_default_argument_value' => true, | ||
| 'no_useless_else' => true, | ||
| 'no_useless_return' => true, | ||
| 'ordered_imports' => true, | ||
| // 'phpdoc_add_missing_param_annotation' => [ | ||
| // 'only_untyped' => false, | ||
| // ], | ||
|
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. should we remove those?
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. I plan to get these in next... 😄
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. @dunglas I want to get this in too... But this is gonna require quite a bit of manual work. 😆 |
||
| 'phpdoc_order' => true, | ||
| 'array_syntax' => array('syntax' => 'short'), | ||
| 'psr4' => true, | ||
| 'semicolon_after_instruction' => true, | ||
| 'strict_comparison' => true, | ||
| 'strict_param' => true, | ||
| 'ternary_to_null_coalescing' => true, | ||
| ]) | ||
| ->setFinder($finder) | ||
| ; | ||
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.
What do you guys think about this? I remember @dunglas talking about this before... We'll need to do Blackfire profiling for this to see the performance difference.