bigbank/phpcs

There is no license information available for the latest version (2.1.0) of this package.

Bigbank rules for phpcs

2.1.0 2016-01-29 10:15 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:08:24 UTC


README

Latest Stable Version on Packagist Software License Total Downloads

PHP_CodeSniffer is a PHP script that tokenizes PHP files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

This is a custom PHP_CodeSniffer standard for Bigbank, based on and compatible with PSR-2.

Installing

Standalone

Usage by IDE-s or manually from the CLI.

  • Clone the repository
  • Install Composer dependencies: composer install

You should now be able to run phpcs from the command line:

$ vendor/bin/phpcs --standard=src/CodeSniffer/Standards/Bigbank <target-file>

PhpStorm Integration

  • Set the path to the phpcs executable: File -> Settings -> PHP -> Code Sniffer. Set it to <this-repo>/vendor/bin/phpcs
  • Activate the phpcs inspection (per project): File -> Settings -> Inspections -> PHP -> PHP Code Sniffer validation. Tick the checkbox to activate the inspection. Set the coding standard as Custom and select the standard directory: <this-repo>/src/CodeSniffer/Standards/Bigbank.

PhpStorm will now automatically inspect your code and highlight the lines where errors are found. You can also run inspections on custom scopes by using Code -> Inspect Code.

CI Server

Usage by automated tools such as Travis or Bamboo.

  • Require bigbank/phpcs in your composer.json require-dev section
  • Configure the CI server to run phpcs as part of its static analysis

Suppressing Warnings

You can manually mark parts of the code as ignored by phpcs with annotations.

  • @codingStandardsIgnoreStart
  • @codingStandardsIgnoreEnd
  • @codingStandardsIgnoreFile - marks the entire file as ignored

Fixing Errors Automatically

It is possible to fix some errors (for example, no empty line at the end of the file) automatically, in bulk (for dozens of files). For more, read Fixing Errors Automatically.

Links

Change log

Please see CHANGELOG for more information what has changed recently.

License

PHP_CodeSniffer is developed and owned by Squiz Labs. This custom standard is licensed under the Apache 2.0 License (Apache-2.0). Please see License File for more information.