Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Rymera-Web-Co/wc-vendors-phpcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WC Vendors PHPCS Configuration

Composer library to provide drop in installation and configuration of WPCS and PHPCompatibilityWP, setting reasonable defaults for WordPress development with nearly zero configuration.

Installation

You must add the repository to composer.json:

{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/wcvendors/wc-vendors-phpcs.git"
        }
    ]
}

Install the library via Composer:

$ composer require --dev wcvendors/wc-vendors-phpcs:dev-main

Usage

Lint your PHP files with the following command:

$ ./vendor/bin/phpcs

If relying on Composer, edit the composer.json file by adding the following:

"scripts": {
    "lint": [
        "phpcs"
    ],
}

Then lint via:

$ composer run lint

Continuous Integration

PHPCS Configuration plays nicely with Continuous Integration solutions. Out of the box, the library loads the WCVendors-WordPress-Default ruleset, and checks for syntax errors for PHP 8.0 or higher.

To override the default PHP version check, set the --runtime-set testVersion 7.0- configuration option. Example for PHP version 7.2 and above:

$ ./vendor/bin/phpcs --runtime-set testVersion 7.2-

See more information about specifying PHP version.

Note that you can only overrule PHP version check from the command-line.

IDE Integration

Some IDE integrations of PHPCS fail to register the WCVendors-WordPress-Default ruleset. In order to rectify this, place .phpcs.xml.dist at your project root:

<?xml version="1.0"?>
<ruleset name="Project Rules">
    <rule ref="WCVendors-WordPress-Default" />
</ruleset>

About

WC Vendors PHPCS standards.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published