Description
Repost from squizlabs/PHP_CodeSniffer#3793:
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:
@kenguest asked:
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 :-)
I replied:
@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 replied:
@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.
My current line of thinking on this is as follows:
- I agree with @kenguest that each PER version should have its own ruleset, like
PER-200
, to prevent it from becoming a moving target failing builds at random.
Each ruleset can include the previous version and build on top of that. - For those repos who always want to use the latest version, there should also be a
PER-latest
, which would include the ruleset for the current version and would need to be updated each time a new version is added. - As there could be a lot of PER versions, adding these rulesets to the main PHPCS repo may be a bit unwieldy, so I'm thinking a separate repo in this organisation called
PSR-PER
. - Sniffs needed in the PER rulesets should still be pulled to the main PHPCS repo. The
PSR-PER
repo would only contain rulesets, not sniffs.