squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.67k stars 1.48k forks source link

PSR-PER 2.0.0 has been released #3793

Closed jrfnl closed 11 months ago

jrfnl commented 1 year ago

PSR-PER is an evolving standard which builds onto PSR-12.

The first "release" (= updated standards publication) since the fork of PSR-12 has just been published.

I'm opening this ticket to allow for a discussion on if and if so, how to handle these evolving standards in PHPCS.

Refs:

viktorprogger commented 1 year ago

Are there any plans on implementing this?

jrfnl commented 1 year ago

@viktorprogger Still up for discussion, but I'd deem it likely (once we've worked through most of the backlog).

kenguest commented 1 year ago

Is there anything that can be done to help nudge this along?

Also, can I just note that the PER for Coding Standards shouldn't be referred to as a PSR - it is PER CS 2.0 :-)

jrfnl commented 1 year ago

@kenguest Well, aside from the decision which still needs to be taken about this, it might be good to create an action list of the differences between PSR-12 and PSR-PER ?

For each difference, it will need to be determined whether there is an existing sniff which could handle this (possibly with a public property setting) or whether a new sniff is needed.

Another thing to have a good think about would be how to handle versioning, as without some form of versioning, a PSR-PER ruleset would be a moving target which could randomly start failing CI builds due to new rules being introduced (and being sniffed for).

kenguest commented 1 year ago

@jrfnl I'm working on a list of changes between the two standards, then an action list. PER-CS is at version 2 at the moment, and there will be distinct version numbers so it should just be a case of having one set of sniffs called PERCS200 (for v2.0.0) and so on.

lombervid commented 1 year ago

As far as I've seen, PER 2.0 only adds some rules on top of PSR-12 for the new language features.

Here the differences can be better appreciated: https://github.com/php-fig/per-coding-style/compare/8201676d799ca5d03bec8ee702df1dd3fda8d2b0..2.0.0

kenguest commented 11 months ago

@jrfnl We've (php fig) got a migration document now, it's at https://github.com/php-fig/per-coding-style/blob/master/migration-2.0.md

jrfnl commented 11 months ago

Closing as replaced by PHPCSStandards/PHP_CodeSniffer#29