2017 © Pedro Peláez
 

phpcodesniffer-standard phpcs-neutron-standard

A set of phpcs sniffs for modern php development.

image

automattic/phpcs-neutron-standard

A set of phpcs sniffs for modern php development.

  • Monday, July 23, 2018
  • by sirbrillig
  • Repository
  • 6 Watchers
  • 41 Stars
  • 6,989 Installations
  • PHP
  • 9 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 23 Versions
  • 58 % Grown

The README.md

Neutron PHP Standard Build status

Warning, (*1)

IMPORTANT NOTE: This project is no longer actively developed. At Automattic we've switched to using the WordPress Coding Standards., (*2)


These are a set of modern (PHP >7) linting guidelines meant to be applied in addition to the the WordPress coding standards for WordPress development. Because of the newer PHP version, it is not suitable for work on Core WordPress, but may be useful for those who are not bound by PHP 5.2., (*3)

These guidelines are being developed primarily for a team within Automattic, but anyone is free to use them, suggest changes, or report bugs., (*4)

This project is a phpcs "standard" (a collection of rules or "sniffs") that can be included in any project., (*5)

Installation

To use these rules in a project which is set up using composer, we recommend using the phpcodesniffer-composer-installer library which will automatically use all installed standards in the current project with the composer type phpcodesniffer-standard when you run phpcs., (*6)

composer require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer
composer require --dev automattic/phpcs-neutron-standard

If you want this standard, the WordPress standard, the VariableAnalysis standard, and other customizations, you can install the meta-standard NeutronRuleset instead., (*7)

composer require --dev squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer
composer require --dev automattic/phpcs-neutron-ruleset

Configuration

When installing sniff standards in a project, you edit a phpcs.xml file with the rule tag inside the ruleset tag. The ref attribute of that tag should specify a standard, category, sniff, or error code to enable. It’s also possible to use these tags to disable or modify certain rules. The official annotated file explains how to do this., (*8)

<?xml version="1.0"?>
<ruleset name="MyStandard">
 <description>My library.</description>
 <rule ref="NeutronStandard"/>
</ruleset>

Usage

Most editors have a phpcs plugin available, but you can also run phpcs manually. To run phpcs on a file in your project, just use the command-line as follows (the -s causes the sniff code to be shown, which is very important for learning about an error)., (*9)

vendor/bin/phpcs -s src/MyProject/MyClass.php 

Guidelines

View the Guidelines here., (*10)

The Versions

23/07 2018

dev-master

9999999-dev

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Payton Swick

23/07 2018

dev-update/require-php-7

dev-update/require-php-7

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Payton Swick

23/07 2018

dev-add/autoload

dev-add/autoload

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Payton Swick

22/06 2018

dev-add/warn-unimported-symbol

dev-add/warn-unimported-symbol

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Development Requires

by Payton Swick

17/04 2018
16/03 2018
16/03 2018

dev-add/paren-spacing

dev-add/paren-spacing

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Development Requires

by Payton Swick

03/03 2018

dev-add/newline-between-funcs

dev-add/newline-between-funcs

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Development Requires

by Payton Swick

20/12 2017

dev-add/meta-standard-docs

dev-add/meta-standard-docs

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Development Requires

by Payton Swick

15/12 2017
08/12 2017

dev-add/no-unused-imports

dev-add/no-unused-imports

A set of phpcs sniffs for modern php development.

  Sources   Download

MIT

The Development Requires

by Payton Swick

04/12 2017
15/11 2017

dev-add/tests

dev-add/tests

A set of phpcs sniffs for Neutron.

  Sources   Download

MIT

The Development Requires

by Payton Swick