2017 © Pedro Peláez
 

library coding-standards

PHP_CodeSniffer rules for the Kohana Framework coding style

image

kohana/coding-standards

PHP_CodeSniffer rules for the Kohana Framework coding style

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 21 Forks
  • 6 Open issues
  • 3 Versions
  • 10 % Grown

The README.md

PHP Codesniffer standard for the Kohana Framework

This package contains a set of coding standard tests for the kohana PHP framework.
The original tests were written by Matthew Turland, see his github repo for more info., (*1)

These tests are meant to be a guide and may not be 100% accurate. If you find a bug please report it on the kohana issue tracker., (*2)

Requirements

These tests are built for usage with PHP Codesniffer., (*3)

Installation - Composer

Add the package to the development dependencies in your project's composer.json, (*4)

{
    "require-dev": {
        "kohana/coding-standards": "*",
    }
}

Run composer --dev update to update your composer.lock file and install the package. The sniffs will be installed in vendor/kohana/coding-standards in your project root directory and the phpcs command will be installed to bin/phpcs., (*5)

Installation - Manually or with PEAR

If you want the standard to be available system wide you can symlink them into the code sniffer dir like so:, (*6)

git clone https://github.com/kohana/coding-standards.git kohana-coding-standards
cd kohana-coding-standards
sudo ln -sfn `pwd`/Kohana `pear config-get php_dir`/PHP/CodeSniffer/Standards/Kohana 
sudo ln -sfn `pwd`/test/PHP_CodeSniffer/CodeSniffer/Standards/Kohana `pear config-get test_dir`/PHP_CodeSniffer/CodeSniffer/Standards/Kohana

Running

If you installed with composer, reference the standard from your vendor directory:, (*7)

bin/phpcs --standard=vendor/kohana/coding-standards/Kohana modules/

Or, from a raw clone, you can simply reference the local copy:, (*8)

phpcs --standard=path/to/coding-standards/Kohana kohana/core

If installed globally (symlinked into PEAR), you can reference the standard like so:, (*9)

phpcs --standard=Kohana application/

Customising your project standard

It is also possible to extend the rules in use for your project, or to include some but not all of the Kohana standards (for example, if you are working on something that is not intended as a kohana module). You do this by adding a coding_standard.xml to your project root which specifies which rules to include and customises any variables. See the PHP_CodeSniffer docs for more details., (*10)

Testing

Like all things code related, sniffs need to be tested! To run the tests they need to be in the codesniffer dir (i.e. you should run the above commands to symlink the sniffs / tests in) and you need to patch phpcs' AllSniffs.php, (*11)

Then just run the tests like so:, (*12)

phpunit --bootstrap=`pear config-get php_dir`/PHP/CodeSniffer.php `pear config-get test_dir`/PHP_CodeSniffer/CodeSniffer/Standards/AllSniffs.php

Known issues

  • There are some problems with expressions in ternary operators

Please report any new issues to the K3 bug tracker and file it under "PHPCS Coding Standards", (*13)

The Versions

27/05 2014

dev-master

9999999-dev https://github.com/kohana/coding-standards

PHP_CodeSniffer rules for the Kohana Framework coding style

  Sources   Download

BSD-3-Clause

The Requires

 

phpcs standards kohana code style code standard coding stanards

27/05 2014

v0.2.0

0.2.0.0 https://github.com/kohana/coding-standards

PHP_CodeSniffer rules for the Kohana Framework coding style

  Sources   Download

BSD-3-Clause

The Requires

 

phpcs standards kohana code style code standard coding stanards

27/05 2014

dev-develop

dev-develop https://github.com/kohana/coding-standards

PHP_CodeSniffer rules for the Kohana Framework coding style

  Sources   Download

BSD-3-Clause

The Requires

 

phpcs standards kohana code style code standard coding stanards