Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

PHPCS not using version number specified by testVersion #1541

@mikes000

Description

@mikes000

I am running into an issue where running composer lint:wpc is returning errors for PHP version 5.2 and earlier.

Error I recieve:

$ composer lint:wpc
> @php ./vendor/squizlabs/php_codesniffer/bin/phpcs
....E.. 7 / 7 (100%)
FOUND 5 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------
  8 | ERROR | "namespace" keyword is not present in PHP version 5.2 or earlier
    |       | (PHPCompatibility.Keywords.NewKeywords.t_namespaceFound)

Searching for testVersion in previous issues I found this issue #1393.

I have tried adding the specified testVersion number back in as a command argument in the composer.json file and running the command does not return any errors.

$ composer lint:wpc
> @php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 5.6-
....... 7 / 7 (100%)

Any ideas why setting the version number with testVersion in phpcs.xml.dist is not working?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions