Embed Instructions

99.66% of the project's source code conforms to the same coding conventions

  • Image URL
    https://squizlabs.github.io/PHP_CodeSniffer/analysis/yiisoft/yii2/grade.svg
  • Markdown
    [![Code consistency](https://squizlabs.github.io/PHP_CodeSniffer/analysis/yiisoft/yii2/grade.svg)](https://squizlabs.github.io/PHP_CodeSniffer/analysis/yiisoft/yii2)
A+consistency

Analysis of Coding Conventions for Yii PHP Framework Version 2

PHP_CodeSniffer, using a custom coding standard and report, was used to record various coding conventions across 197 PHP projects.

Conventions

Analysis of Coding Conventions for Yii PHP Framework Version 2

Back to top

View project specific report

Project
Consistency

Line length

Including whitespace and comments, how many characters are in non-empty code lines?

This project is using the popular method for this convention

Current
Key Method Use
80 or less - Most popular method 80 or less 84.87%
81-120 81-120 12.49%
121-150 121-150 1.72%
151 or more 151 or more 0.92%

Based on 100,626 lines

Historical

Inline comment style

What comment style is used for non docblock comments?

This project is using the popular method for this convention

Current
Key Method Use
/* ... */ /* ... */ 13.64%
// ... - Most popular method // ... 86.36%

Based on 1,364 inline comments

Historical
  • 01 Apr 2015: there was a 10.91% swing away from /* ... */
    • there was a 10.96% swing towards // ...

Lowercase filename

Are PHP filenames lowercase?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 87.4%
yes yes 12.6%

Based on 524 files

Historical
  • 01 Apr 2015: there was a 10.63% swing from yes to no

Array end comma

Does the last item end with a comma in a multi-line array definition?

This project is using the popular method for this convention

Current
Key Method Use
no no 10.91%
yes - Most popular method yes 89.09%

Based on 55 array definitions

Historical
  • 01 Apr 2015: there was a 4.53% swing from yes to no
  • 01 Jan 2016: there was a 4.67% swing from yes to no
  • 01 Apr 2016: there was a 3.93% swing from no to yes
  • 01 Jun 2016: there was a 10% swing from no to yes
  • 01 Jul 2017: there was a 15.67% swing from no to yes
  • 01 Nov 2017: there was a 3.16% swing from yes to no
  • 01 Dec 2017: there was a 3.87% swing from no to yes

Adjacent assignments aligned

For a block of assignments, are the assignment operators (equals, plus-equals etc.) aligned?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 90.83%
yes yes 9.17%

Based on 1,189 assignment blocks

Historical

Spacing after cast statement

How many spaces are there between a cast statement and the variable?

Current
Key Method Use
0 0 8.19%
1 - Most popular method 1 91.81%

Based on 281 cast statements

Historical
  • 01 Jul 2015: there was a 8.43% swing from 0 to 1
  • 01 Sep 2016: there was a 4.09% swing from 1 to 0
  • 01 Jul 2017: there was a 10.37% swing from 0 to 1
  • 01 Mar 2018: there was a 3.17% swing from 1 to 0

Spacing before string concat

How many spaces precede the string concatenation operator?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.35%
1 - Most popular method 1 95.89%
newline newline 3.76%

Based on 2,554 concat operators

Historical

Class defined in namespace

Is each class defined in a namespace of at least 1 level?

This project is using the popular method for this convention

Current
Key Method Use
no no 2.01%
yes - Most popular method yes 97.99%

Based on 447 classes

Historical

PascalCase class name

Are class names defined using PascalCase?

This project is using the popular method for this convention

Current
Key Method Use
no no 1.57%
yes - Most popular method yes 98.43%

Based on 447 classes

Historical

Function has doc comment

Does each function have a docblock comment to describe its purpose?

This project is using the popular method for this convention

Current
Key Method Use
no no 1.38%
yes - Most popular method yes 98.62%

Based on 3,406 functions

Historical

File has doc comment

Does each PHP file have a docblock comment to describe its purpose?

This project is using the popular method for this convention

Current
Key Method Use
no no 1.15%
yes - Most popular method yes 98.85%

Based on 524 files

Historical
  • 01 Apr 2015: there was a 12.65% swing from no to yes

Spacing after string concat

How many spaces follow the string concatenation operator?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.35%
1 - Most popular method 1 98.98%
newline newline 0.67%

Based on 2,554 concat operators

Historical

Spacing before object operator

How many spaces precede the object operator (->)?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99%
newline newline 1%

Based on 17,126 object operators

Historical

CamelCase method name

Are class method names defined using CamelCase?

This project is using the popular method for this convention

Current
Key Method Use
no no 0.85%
yes - Most popular method yes 99.15%

Based on 3,301 methods

Historical

Declarations and side effects mixed

Do files both declare symbols (classes, functions, constants, etc.) and cause side-effects (e.g. generate output, change .ini settings, etc.)?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.24%
yes yes 0.76%

Based on 524 files

Historical

Short array syntax used

Are arrays defined using the PHP 5.4+ short array syntax?

This project is using the popular method for this convention

Current
Key Method Use
no no 0.66%
yes - Most popular method yes 99.34%

Based on 2,569 array definitions

Historical

Space before operator

How many spaces precede comparison, arithmetic and assignment operators?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.04%
1 - Most popular method 1 99.38%
newline newline 0.58%

Based on 4,821 operators

Historical

PHP closing tag at EOF

Is there a PHP closing tag at the end of the file?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.62%
yes yes 0.38%

Based on 524 files

Historical

Spaces after control structure open parenthesis

How many spaces follow the opening parenthesis of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.79%
newline newline 0.21%

Based on 5,783 control structures

Historical

Number of newlines at EOF

How many newline characters appear at the end of the file?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.2%
1 - Most popular method 1 99.8%

Based on 504 files

Historical

Blank lines at start of control structure

How many blank lines precede the body of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.94%
1 1 0.06%

Based on 6,560 control structures

Historical

Space after operator

How many spaces follow comparison, arithmetic and assignment operators?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.01%
1 - Most popular method 1 99.97%
2 2 < 0.01%
newline newline 0.02%

Based on 23,571 operators

Historical

Control structure defined inline

Are control structures defined inline (without braces)?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.97%
yes yes 0.03%

Based on 6,420 control structures

Historical

Blank lines at end of control structure

How many blank lines follow the body of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.98%
1 1 0.02%

Based on 6,560 control structures

Historical

Multiple statements on same line

Are multiple statements defined on the same line of code?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.99%
yes yes 0.01%

Based on 18,369 statements

Historical

Line indent

Are lines indented using spaces or tabs?

This project is using the popular method for this convention

Current
Key Method Use
spaces - Most popular method spaces 100%

Based on 84,844 indented lines

Historical

Class opening brace placement

Is the opening brace of a class on the same line as the class keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
new line - Most popular method new line 100%

Based on 447 classes

Historical

Constant name case

What case are user-defined constants defined in?

This project is using the popular method for this convention

Current
Key Method Use
upper - Most popular method upper 100%

Based on 283 constants

Historical

File extension for class files

For files that contain classes, what extension does the file use?

This project is using the popular method for this convention

Current
Key Method Use
.php - Most popular method .php 100%

Based on 447 class files

Historical

Private method prefixed with underscore

Are private methods prefixed with an underscore?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 177 private methods

Historical

PHP keyword case

What case are PHP keywords (function, echo, foreach etc.) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 100%

Based on 28,248 keywords

Historical

File extension for non-class files

For files that do not contain classes, what extension does the file use?

This project is using the popular method for this convention

Current
Key Method Use
.php - Most popular method .php 100%

Based on 77 non-class files

Historical

PHP constant case

What case are PHP constants (true, false, null) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 100%

Based on 3,905 PHP constants

Historical

Function opening brace placement

Is the opening brace of a function on the same line as the function keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
new line - Most popular method new line 100%

Based on 3,190 functions

Historical

Class has doc comment

Does each class have a docblock comment to describe its purpose?

This project is using the popular method for this convention

Current
Key Method Use
yes - Most popular method yes 100%

Based on 447 classes

Historical

Array keyword case

When defining an array, how is the array keyword written?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 100%

Based on 17 array definitions

Historical

Spaces before control structure close parenthesis

How many spaces precede the closing parenthesis of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 100%

Based on 5,783 control structures

Historical

Use of ELSE IF or ELSEIF

Are elseif statements defined using elseif or else if?

This project is using the popular method for this convention

Current
Key Method Use
else if else if 0%
elseif - Most popular method elseif 100%

Based on 481 elseif statements

Historical

Brackets around echoed strings

Are parenthesis placed around echo'd strings?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 115 echo statements

Historical

Closure opening brace placement

Is the opening brace of a closure on the same line as the function keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
same line - Most popular method same line 100%

Based on 64 closures

Historical

PHP type case

What case are PHP types (int, bool, string) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 100%

Based on 383 PHP types

Historical

PHP short open tag used

Is the PHP short open tag syntax used?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 1,834 open tags

Historical

Spacing after object operator

How many spaces follow the object operator (->)?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 100%

Based on 17,126 object operators

Historical

EOL char

What character is used for line breaks?

This project is using the popular method for this convention

Current
Key Method Use
\n - Most popular method \n 100%

Based on 524 files

Historical

One class per file

Is each class defined in a file by itself?

This project is using the popular method for this convention

Current
Key Method Use
yes - Most popular method yes 100%

Based on 447 classes

Historical