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

Update and review usage of the PSR-2-R PHP coding standard #245

Open
6 tasks
tfrommen opened this issue Feb 10, 2021 · 0 comments
Open
6 tasks

Update and review usage of the PSR-2-R PHP coding standard #245

tfrommen opened this issue Feb 10, 2021 · 0 comments
Assignees

Comments

@tfrommen
Copy link
Contributor

The HM Coding Standards make use of the external PSR-2-R standard. There are some issues with this.

Currently, we are using the following three rules as part of the HM standard:

  • PSR2R.ControlStructures.NoInlineAssignment
  • PSR2R.Namespaces.UnusedUseStatement
  • PSR2R.Namespaces.UseInAlphabeticalOrder

Our current version constraint for this standard is ^0.5.0. Since this is a non-stable version (i.e., below 1.0.0), the caret notation will be treated differently, and actually only allow for patch-level updates. This means anything up to, but not including 0.6.0.

Now, there have been quite a few updates—to be precise: 7—that we will never see with our current constraint. Some of these releases include breaking changes, and the current version is (stable) 1.0.1.

One of these breaking changes was to remove the PSR2R.Namespaces.UseInAlphabeticalOrder rule as it was conflicting with other tooling such as IDE (as it was technically incorrectly implemented). We should remove this rule from our standard.

Then, I was wondering why we are currently only using these three select rules. Overall, the PSR-2-R standard looks pretty solid to me, and should be very much in line with everything we already do or want to do.

I see the following items to discuss and action:

  • Remove the PSR2R.Namespaces.UseInAlphabeticalOrder rule from the HM standard.
  • Review the PSR-2-R standard for any breaking changes in the rules we use.
  • Update the PSR-2-R standard by specifying the ^1.0 version constraint.
  • Address or document all breaking changes, if any.
  • Consider adding more/all of the PSR-2-R standard to the HM standard.
  • Consider adding select PSR-2-R rules to HM-Minimum, where this makes sense and is in line with what this standard is about (e.g., security, performance, error prevention, but no formatting etc.).

Any thoughts on any of the above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant