webimpress70 / coding-standard
PHP 7.0 support for Webimpress Coding Standard
Installs: 44
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 2
Type:phpcodesniffer-standard
Requires
- php: ^7.0 || ^8.0
- squizlabs/php_codesniffer: ^3.6.2
Requires (Dev)
- phpunit/phpunit: ^5.7.27 | ^9.5.20
Replaces
- webimpress/code-standard: *
This package is auto-updated.
Last update: 2024-10-24 14:36:21 UTC
README
[] (https://github.com/webimpress70/coding-standard/actions/workflows/phpunit.yml) [] (https://github.com/webimpress70/coding-standard/actions/workflows/phpcs.yml) [] (https://coveralls.io/github/webimpress70/coding-standard?branch=master)
Installation
-
Install the module via composer by running:
$ composer require --dev webimpress70/coding-standard
-
Add composer scripts into your
composer.json
:"scripts": { "cs-check": "phpcs", "cs-fix": "phpcbf" }
-
Create file
phpcs.xml
in base path of your repository with content:<?xml version="1.0"?> <ruleset name="Webimpress Coding Standard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="./vendor/webimpress70/coding-standard/ruleset.xml"/> <!-- Paths to check --> <file>config</file> <file>src</file> <file>test</file> </ruleset>
As shown above you must define locations or files you want to be checked and fixed by code sniffer. For a reference please see: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset
Usage
-
To run checks only:
$ composer cs-check
-
To automatically fix many CS issues:
$ composer cs-fix