-
-
Notifications
You must be signed in to change notification settings - Fork 931
Various quality fixes #2630
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
Various quality fixes #2630
Conversation
meyerbaptiste
commented
Mar 20, 2019
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | n/a |
use BooleanFilterTrait; | ||
|
||
const DOCTRINE_BOOLEAN_TYPES = [ | ||
public const DOCTRINE_BOOLEAN_TYPES = [ |
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'm -1 on this public const
thing it's just noise IMO. Symfony is not using it for now?
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.
We should now pay attention to the visibility of our constants and define them explicitly. It's by default in the PHP-CS-Fixer ruleset @PHP71Migration
.
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.
It's by default in the PHP-CS-Fixer ruleset @PHP71Migration.
But we are already using both @PHP71Migration
and @PHP71Migration:risky
rulesets?
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.
visibility_required [@PSR2, @Symfony, @PhpCsFixer, @PHP71Migration]
Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility.
Configuration options:
- elements (a subset of ['property', 'method', 'const']): the structural elements to fix (PHP >= 7.1 required for const); defaults to ['property', 'method']
So it's not enabled by default. If we're going to make this change, we must change that option.
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.
By default constants are public and it won't change, we should define them if they're not public IMO.
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.
But we are already using both @PHP71Migration and @PHP71Migration:risky rulesets?
Yep but because of the alphabetical order in our configuration, the @Symfony
ruleset, that uses the @PSR2
ruleset, has the advantage and uses the default configuration: method
+ property
vs. method
+ property
+ const
for the @PHP71Migration
ruleset.
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.
By default constants are public and it won't change
By default methods are public but you define a visibility explicitly even if it is public.
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.
Okay, let's add the correct configuration for this rule then.
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.
Yep but because of the alphabetical order in our configuration, the
@Symfony
ruleset has the advantage
That is indeed unexpected, but might as well since I don't think we would ever find a "correct" order. 😆
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 just updated the .php_cs.dist
file.
Anyway, I suspect this PR should target |
db09a60
to
c59b84a
Compare
c59b84a
to
b8174fe
Compare
Base branch changed. |
b8174fe
to
97fa954
Compare
Thanks @meyerbaptiste |
Remove a BC break introduced in api-platform#2630