-
Notifications
You must be signed in to change notification settings - Fork 56
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 slevomat/coding-standard to v6 #144
Conversation
Disable TypeHintDeclaration Enable - ParameterTypeHint - PropertyTypeHint - ReturnTypeHint - UselessFunctionDocComment
As I mentioned to @simPod I'll be taking a look at this to ensure we enforce typed properties on PHP 7.4+ |
Can you elaborate? Will this enforce typed properties if phpcs is run on PHP 7.4, or if the library supports PHP ^7.4? |
@@ -122,6 +122,7 @@ public function throwWhenInvalid() : void | |||
public function trySwitchSpace() : void | |||
{ | |||
try { | |||
$var = 1; |
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.
This kinda snuck in: not a problem for me as long as it doesn't remove newlines before control structures, but seems unrelated
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 ensured the settings for space before block control structures is not modified from current behaviour. The test for it was missing.
That's the default value but it can be changed in configuration: 9578c54#diff-1d794c8c2cf3bf4d562ddaea8be99bb0R349 |
Thanks @kukulich! Just wanted to make sure it remains optional. |
Let's wait to merge this one, we want to perform some functional tests across our repos to see if everything is okay 👍 |
@carusogabriel here's ODM: https://gist.github.com/alcaeus/29f2c69ca1444260ea2b976221942c5c I haven't gone through them, but there are probably some more changes we'll have to take care of. I just made sure that phpcs runs. |
@alcaeus you should probably upgrade also these excludes https://github.com/doctrine/mongodb-odm/blob/3ac6f4596efce4fb4ff2feb85267d34ddb403c35/phpcs.xml.dist#L28-L29 |
07d785f
@lcobucci can we please split out the patch for PHP 7.4? I have my doubts about the methodology and would rather not have it block this PR. Thanks! |
@simPod thanks for the hint, totally missed those. Gist is updated - most are BlockControlSpacing with a few missing parameter type hints where we either need to add documentation or update the exclude list. At first glance, it looks good 👍 |
What are your doubts? Could we look at them and discuss before that? |
I think that false for native type hints for properties is current state before Slevomat CS 6.0 |
Okay, I'm back from my meeting and will try to clarify why having The fact we don't have projects requiring PHP 7.4 is a different story (which is sad to me but I understand the reasons) but despite that this is a library used by other folks and it shouts to everybody (trend setting as @Ocramius keeps saying): ALWAYS DECLARE THE FREAKING TYPES. The whole Makefile + |
@lcobucci please document the process of maintaining the patch file for contributors and maintainers and I'm good with it. As is, a contributor would have to try and figure out how to fix the build, and I as maintainer would have to guess if I wanted to help them: this isn't how this stuff should be built. As previously stated, I can live with the setting being enabled depending on the PHP versions (especially since this is consistent with other settings) as long as the proper documentation is in place. |
@alcaeus that's completely fair to ask, I'll handle that 👍 |
@lcobucci I think this PR is about upgrading Slevomat CS and false is compatible with previous behaviour. So it may be better to change the option in different PR |
All 7.4 builds will be red for PRs targetting our maintained branches (PHP >= 7.2 support), this is why it's bad. But like I said, let's talk about this on different place |
They won't because it would be a new major release and adjusting code/config to the new version is part of the upgrade. |
To add on to what Luis said, most of our maintained branches run phpcs on the minimum required PHP version (as they should), not on PHP 7.4. |
Ensuring that CI also uses the same commands.
Incorporating changes to our tests.
Simplifying what's required from contributors to help us in this project.
@alcaeus documentation added and make targets are now a bit more resilient. |
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.
LGTM. The compatibility patch tooling is neat, thank you for that!
Handled by @lcobucci's additions
This aggregates:
Things to note:
traversableTypehints
listed for type hints related sniffs. Originally, there was only Doctrine Collection.BlockControlStructureSpacing
sniff if desired.