2017 © Pedro Peláez
 

library yii2-coding-standards

Mito Yii 2 coding standards

image

mito/yii2-coding-standards

Mito Yii 2 coding standards

  • Monday, November 20, 2017
  • by mito
  • Repository
  • 7 Watchers
  • 3 Stars
  • 8,197 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 18 % Grown

The README.md

Mito Yii 2 Coding Standards

This repository contains Mito's coding standards for Yii 2 based applications., (*1)

Build Status Coverage Status, (*2)

Getting the code

You can get code style definition using one of the following methods., (*3)

  • Clone hellowearemito/yii2-coding-standards repository:
$ git clone git://github.com/hellowearemito/yii2-coding-standards.git
$ composer require mito/yii2-coding-standards:"~2.0.0@beta"

PHP_Codesniffer

This repository contains five phpcs standards:, (*4)

  • Application: for normal class files.
  • Views: for view files, requires using curly braces for control structures.
  • ViewsAlternate: for view files, requires using alternate syntax for control structures.
  • ViewsMixed: for view files, allows both curly braces and alternate syntax.
  • Others: for other files, such as configuration files and migration classes.

These standards are based on PSR2 and Yii 2's coding standard, with some additions and improvements., (*5)

The Views standards disable some rules that cause problems when mixing php with html, and therefore cannot fully check view files and cannot fix all problems in them, so be careful when using phpcbf with view files., (*6)

For a full description of the rules, see docs/rules.md., (*7)

Using the standards

After CodeSniffer is installed, you can launch it with a custom standard using the following syntax:, (*8)

$ ./vendor/bin/phpcs --extensions=php --standard=vendor/mito/yii2-coding-standards/Application .

To automatically fix most issues, use phpcbf:, (*9)

$ ./vendor/bin/phpcbf --extensions=php --standard=vendor/mito/yii2-coding-standards/Application .

Warning: always check phpcbf's output and keep backups. If it breaks your code, you get to keep both pieces., (*10)

You should also run a syntax check using php -l before running phpcbf, because some sniffs assume the code is syntactically valid, and may mangle it if it is not., (*11)

If you're using PhpStorm you can configure it to use CodeSniffer using Settings → PHP → Code Sniffer. The standard can be specified at Inspections → PHP → PHP Code Sniffer validation., (*12)

Note that this will check all your files with a single standard, but you should use different standards for different types of files. These standards were designed for use with gulp-phpcs and gulp-phpcbf, so instead of using exclusion patterns in the ruleset.xml, they rely on the gulp task selecting the appropriate standard for a file., (*13)

You can write your own ruleset.xml that extends from the Application standard and contains appropriate exclusion patterns (check the Others and Views ruleset.xml files for what rules to exclude)., (*14)

Contributing

See CONTRIBUTING.md for information., (*15)

The Versions

20/11 2017

dev-master

9999999-dev https://mito.hu/

Mito Yii 2 coding standards

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov
by Nikola Kovacs

framework codesniffer yii

20/11 2017

2.0.0-beta16

2.0.0.0-beta16 https://mito.hu/

Mito Yii 2 coding standards

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov
by Nikola Kovacs

framework codesniffer yii

28/10 2016

2.0.0-beta15

2.0.0.0-beta15 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

22/09 2016

2.0.0-beta14

2.0.0.0-beta14 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

12/09 2016

2.0.0-beta13

2.0.0.0-beta13 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

12/09 2016

2.0.0-beta12

2.0.0.0-beta12 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

09/09 2016

2.0.0-beta11

2.0.0.0-beta11 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

02/09 2016

2.0.0-beta10

2.0.0.0-beta10 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

01/09 2016

2.0.0-beta9

2.0.0.0-beta9 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

23/08 2016

2.0.0-beta8

2.0.0.0-beta8 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

25/07 2016

2.0.0-beta7

2.0.0.0-beta7 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

13/06 2016

2.0.0-beta6

2.0.0.0-beta6 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

30/05 2016

2.0.0-beta5

2.0.0.0-beta5 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

30/05 2016

2.0.0-beta4

2.0.0.0-beta4 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

27/05 2016

2.0.0-beta3

2.0.0.0-beta3 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

27/05 2016

1.0.2

1.0.2.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

27/05 2016

2.0.0-beta2

2.0.0.0-beta2 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Paul Klimov

framework codesniffer yii

23/05 2016

2.0.0-beta1

2.0.0.0-beta1 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

29/01 2016

0.9.0

0.9.0.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

29/01 2016

1.0.1

1.0.1.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii

04/08 2014

1.0.0

1.0.0.0 http://www.yiiframework.com/

Yii PHP Framework Version 2 - Coding standard tools

  Sources   Download

BSD-3-Clause

The Requires

 

by Paul Klimov

framework codesniffer yii