mediebruket/wp-coding-standards

Internal WordPress coding standards

Installs: 103

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

1.2.0 2021-03-21 09:39 UTC

This package is auto-updated.

Last update: 2024-11-21 18:07:52 UTC


README

We've transitioned to use PSR-12 coding style for our own Wordpress projects.

Installation

composer require mediebruket/wp-coding-standards --dev

Copy and modify the sample configuration file.

cp vendor/mediebruket/wp-coding-standards/phpcs.xml.dist.sample phpcs.xml.dist

Usage

Check manually by running PHPCS from command line and specify the coding standard:

vendor/bin/phpcs --standard="Mediebruket" <path>

PHPStorm Setup

Alternatively, the coding standard can be enabled in Phpstorm.

Phpstorm needs to know where PHP_CodeSniffer is located. Navigate to Languages & Frameworks > PHP > Quality tools > PHP_CodeSniffer and specify the path the phpcs executable in your vendor directory by clicking . Additionally, you can add the path to phpcbf as well.

Then you'll have to specify the coding standard. Navigate to Editor > Inspections > PHP > Quality tools > PHP_CodeSniffer validation > Options > Coding standard. Chose the preferred coding standard from the options section.