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

Enhancement: Enable no_alias_function and trailing_comma_in_multiline_array fixer #491

Closed

Conversation

localheinz
Copy link
Contributor

@localheinz localheinz commented Dec 31, 2017

This PR

  • enables the no_alias_function as well as the trailing_comma_in_multiline_array fixer
  • runs composer style-fix

πŸ’β€β™‚οΈ For reference, see https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/2.9#usage:

no_alias_functions [@Symfony:risky]

Master functions shall be used instead of aliases.

Risky rule: risky when any of the alias functions are overridden.

.php_cs.dist Outdated
))
->setRiskyAllowed(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this concerning - there have been a number of times in the past when php-cs-fixer has shipped changes that resulted in it altering the execution logic of the project code, rather than making purely cosmetic changes. Thankfully, this caused the testsuite to fail, so nothing broken made it through review, but still. Anything that php-cs-fixer labels risky, or has the potential to change execution logic, worries me.

Copy link
Contributor

Choose a reason for hiding this comment

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

To clarify - php-cs-fixer has altered logic with no warning, and no changes in configuration. This behaviour is IMO unacceptable. I don't have an issue with the join -> implode changes it's made this time, but if we're going to commit this, I'd like some certainty it won't make changes in the future that break things (e.g. by replacing deprecated function names that are required for PHP 5.3 compatibility).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's why I would suggest to pin friendsofphp/php-cs-fixer to at least a specific minor version, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think pinning is a very good idea. It doesn't entirely solve the issue, but it will help.

@mathroc - php-cs-fixer is yours, how do you feel about this?

.php_cs.dist Outdated
'simplified_null_return' => false,
'trailing_comma_in_multiline_array' => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

While we're moving it, can we please turn this rule on? A trailing comma is desirable, as it makes git blame more obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, can do!

@localheinz localheinz force-pushed the feature/no-alias-function branch 2 times, most recently from ead8c8a to 531ff9f Compare January 1, 2018 00:55
@localheinz localheinz changed the title Enhancement: Enable no_alias_function fixer Enhancement: Enable no_alias_function and trailing_comma_in_multiline_array fixer Jan 1, 2018
@localheinz localheinz force-pushed the feature/no-alias-function branch 2 times, most recently from 3ad766b to c4c6bcd Compare January 1, 2018 17:24
@localheinz localheinz force-pushed the feature/no-alias-function branch 2 times, most recently from 2cb0bef to 7662df2 Compare June 22, 2018 18:28
@localheinz
Copy link
Contributor Author

@bighappyface

Rebased! Apologies for the delay.

@bighappyface
Copy link
Collaborator

@mathroc please see the conversation on the initial commit of this PR - 4740600#r159148409

@mathroc
Copy link
Contributor

mathroc commented Oct 16, 2018

@erayd @bighappyface I think there's been a misunderstanding, why do you think php-cs-fixer is mine ?

@erayd
Copy link
Contributor

erayd commented Oct 16, 2018

@mathroc @bighappyface This is my error sorry - looks like I tagged the wrong person. The person who was supposed to have been tagged was @alcohol.

@localheinz
Copy link
Contributor Author

@erayd

Can I help in any way?

@alcohol
Copy link
Contributor

alcohol commented Oct 16, 2018

Uhm, mine? What?

@erayd
Copy link
Contributor

erayd commented Oct 16, 2018

@alcohol Yours, because you added it to this project in the first place. I was wanting to know what your thoughts are on whether pinning it is an acceptable solution to the problem of php-cs-fixer making unexpected and unannounced changes to the execution logic, as I assume you had reasons for setting it up the way you did originally.

@localheinz Testing this PR against the latest version [of php-cs-fixer] would be helpful. It's been close to a year since this PR was initially opened, and I don't have time to do that at present (plus I'm not terribly familiar with php-cs-fixer anyway).

@alcohol
Copy link
Contributor

alcohol commented Oct 17, 2018

Oh, I see.

Having read up on the discussion (including the hidden comments), I can add the following: pinning is fine.

Though it would be a good idea to occasionally check for updates using composer outdated --direct and determining what changes have been made and whether or not they warrant an update (and if yes, what would have to be configured additionally etc).

@localheinz localheinz force-pushed the feature/no-alias-function branch from 7662df2 to 8de75c1 Compare October 17, 2018 07:07
@localheinz
Copy link
Contributor Author

@erayd

Just rebased and pushed, let me know what I can do!

@alcohol
Copy link
Contributor

alcohol commented Oct 17, 2018

You did not actually pin php-cs-fixer to a minor version yet though?

I would suggest changing

"friendsofphp/php-cs-fixer": "^2.1",

to

"friendsofphp/php-cs-fixer": "~2.2.20",

@localheinz
Copy link
Contributor Author

@alcohol

No, that was never my intention with this PR, but can do in a separate PR.

@bighappyface
Copy link
Collaborator

@alcohol @localheinz PHP-CS-Fixer has been pinned per #537

@localheinz localheinz force-pushed the feature/no-alias-function branch 3 times, most recently from b908726 to 3171d9a Compare October 19, 2018 17:21
@localheinz
Copy link
Contributor Author

@bighappyface

Rebased!

@bighappyface
Copy link
Collaborator

@localheinz please rebase once more. I merged #535.

@localheinz localheinz force-pushed the feature/no-alias-function branch from 6b0e068 to 53a519e Compare October 19, 2018 17:47
@localheinz
Copy link
Contributor Author

@bighappyface

Done! πŸ€“

Copy link
Collaborator

@bighappyface bighappyface left a comment

Choose a reason for hiding this comment

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

+1 for 53a519e
+1 for ecf1ce6

@bighappyface
Copy link
Collaborator

@erayd @shmax any objections to merging?

@localheinz localheinz force-pushed the feature/no-alias-function branch from ecf1ce6 to 3a565fa Compare June 18, 2019 05:53
@localheinz localheinz force-pushed the feature/no-alias-function branch from 3a565fa to 7898741 Compare November 13, 2019 09:40
@localheinz localheinz closed this Nov 13, 2019
@localheinz localheinz deleted the feature/no-alias-function branch November 13, 2019 10:13
@localheinz
Copy link
Contributor Author

Closing in favour of sorting out other issues with the php-cs-fixer requirements and configuration first.

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.

5 participants