Skip to content
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 #130

Merged
merged 6 commits into from
Jun 10, 2022
Merged

Upgrade php cs fixer #130

merged 6 commits into from
Jun 10, 2022

Conversation

SamuelWei
Copy link

@SamuelWei SamuelWei commented Mar 17, 2022

Upgrade php-cs-fixer #129

@@ -30,7 +30,7 @@ public function testHooksCreateParameters()

// Test setters that are ignored by the constructor
$hooksCreateParameters->setMeetingId($meetingId = $this->faker->uuid);
$hooksCreateParameters->setGetRaw($getRaw = $this->faker->boolean);
$hooksCreateParameters->setGetRaw($getRaw = $this->faker->boolean);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this style.
@sualko @FelixJacobi Any ideas how to keep the old formatting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably related to https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/operator/binary_operator_spaces.rst, but I think we can not disable it inside method calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, maybe we should move to PSR-12 as a well defined and accepted code style and stop using the space intention at all. I personally really don't like it, as it is a waste of bytes and produces big diffs when adding a new parameter is added and so on, because the whole list must be reformatted:

-$fooBar = 'foo',
-$barBaz = 'bar',
+$fooBar            = 'foo',
+$barBaz            = 'bar',
+$veryLongParameter = null

To illustrate what I mean. This code style enforces such reformats and this is bad in my opinion on reading of diffs. I would stop using that.

Copy link
Author

@SamuelWei SamuelWei Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reformats in diffs are indeed very annoying, but at the moment I still prefer it for better readability.

However I'm open for a debate on a change in the coding style.
eg. https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/ruleSets/Symfony.rst or just https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/ruleSets/PSR12.rst
We can always customise them if there would be something we dislike.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sualko @FelixJacobi I updated this branch to the new tooling solution and changed to symfony style.
To prevent the yoda style and allowing multi line throws I added two custom rules.
What do you think about the new code style?

@SamuelWei SamuelWei mentioned this pull request Apr 8, 2022
6 tasks
Copy link
Member

@FelixJacobi FelixJacobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replied to the question and found one point which must be changed. Otherwise, I really like the new code style. Thank you for working on this!

tools/.php-cs-fixer/composer.json Outdated Show resolved Hide resolved
Copy link
Member

@FelixJacobi FelixJacobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @sualko Could you take another look?

@FelixJacobi
Copy link
Member

Merged as it got the required peer approvals already.

I think if any changes are wished, they can be easily implemented in a follow-up PR.

@FelixJacobi FelixJacobi merged commit ea8c6fa into master Jun 10, 2022
@sualko sualko deleted the upgrade-php-cs-fixer branch July 24, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants