Skip to content

RCAT-759: Setting PHP version shouldn't be done in base rulesets #85

@b-sharpe

Description

@b-sharpe

Describe the bug
Since #76 phpcompatibility now loads top-down versions of php using the last one as it's ruleset. Since this change and the set version in the main ruleset (see #37 ) it is now impossible to set a php version outside of that if using the ruleset.

To Reproduce
Set your testVersion to anything other than 7.4- in your phpcs.xml (I was using 8.3), and then run a phpcs with a rule like would break in 7.4 or below, you will see it break, i.e.

--------------------------------------------------------------------------------
 37 | ERROR | Trailing commas are not allowed in function declaration parameter
    |       | lists in PHP 7.4 or earlier
    |       | (PHPCompatibility.FunctionDeclarations.NewTrailingComma.InParameterList)
--------------------------------------------------------------------------------

Expected behavior
PHPCompatibility should use the set php version in phpcs.xml

Proposed Fix
Remove the set testversion in src/Standards/AcquiaDrupalMinimal/ruleset.xml and instead set this in example/phpcs.xml.dist so that the user is in control of the testVersion

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions