Embed Instructions

Across all 196 projects, 88.69% of the source code conforms to the same coding conventions

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

Analysis of Coding Conventions

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

Conventions

Analysis of Coding Conventions

Back to top

View project specific report

Project
Consistency

Array end comma

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

Current
Key Method Use
no - Most popular method no 51.34%
preferred by 27.27% of projects
yes yes 48.66%
preferred by 49.65% of projects
undecided 23.08% of projects are undecided

Based on 14,576 array definitions in 143 projects

71 projects prefer yes

Historical
  • 01 Dec 2015: there was a 0.79% swing from no to yes
    • Anchor CMS saw a 19.05% swing from no to yes
    • Chamilo saw a 4.97% swing from no to yes
    • Monolog saw a 12.5% swing from no to yes
    • Chamilo added 77 array definitions using yes
  • 01 Nov 2016: there was a 1.1% swing from no to yes
  • 01 May 2017: there was a 2.14% swing from no to yes
    • OpenEMR removed 783 array definitions using no
  • 01 Sep 2017: there was a 1.02% swing from no to yes
    • PHPMailer saw a 27.97% swing from no to yes
    • TYPO3 CMS saw a 20.09% swing from no to yes
    • Moodle removed 80 array definitions using no
    • TYPO3 CMS added 230 array definitions using yes

Short array syntax used

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

Current
Key Method Use
no no 47.15%
preferred by 39.69% of projects
yes - Most popular method yes 52.85%
preferred by 58.76% of projects
undecided 1.55% of projects are undecided

Based on 511,132 array definitions in 194 projects

114 projects prefer yes

3 projects are undecided

Historical

Spacing after string concat

How many spaces follow the string concatenation operator?

Current
Key Method Use
0 0 38.49%
preferred by 11.35% of projects
1 - Most popular method 1 53.74%
preferred by 74.59% of projects
newline newline 7.59%
preferred by 1.62% of projects
Other other 0.18%
undecided 12.43% of projects are undecided

Based on 418,782 concat operators in 185 projects

138 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.65% swing away from 0
    • Zikula saw a 3.52% swing away from 0
    • Chamilo removed 7404 concat operators using 0
  • 01 Dec 2015: there was a 0.63% swing from 1 to 0
  • 01 Oct 2016: there was a 1.18% swing away from newline
    • OpenEMR saw a 6.94% swing away from newline
    • OpenEMR removed 5793 concat operators using newline
    • there was a 1.1% swing towards 0
    • OpenEMR saw a 5.79% swing towards 0
    • OpenEMR added 1577 concat operators using 0
  • 01 Nov 2016: there was a 0.62% swing away from 0
  • 01 May 2017: there was a 0.92% swing towards 0
    • OpenEMR saw a 7.14% swing towards 0
    • concrete5 added 361 concat operators using 0
    • there was a 1.11% swing away from 1
    • OpenEMR saw a 12.65% swing away from 1
    • OpenEMR removed 16775 concat operators using 1

Spacing before string concat

How many spaces precede the string concatenation operator?

Current
Key Method Use
0 0 39.17%
preferred by 11.35% of projects
1 - Most popular method 1 56.28%
preferred by 63.78% of projects
newline newline 3.94%
preferred by 1.62% of projects
Other other 0.61%
undecided 23.24% of projects are undecided

Based on 418,781 concat operators in 185 projects

118 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.63% swing away from 0
    • Chamilo removed 7448 concat operators using 0
  • 01 Dec 2015: there was a 0.62% swing from 1 to 0
  • 01 Oct 2016: there was a 1.11% swing from 1 to 0
    • OpenEMR saw a 6.86% swing away from 1
    • OpenEMR saw a 5.95% swing towards 0
    • OpenEMR removed 9057 concat operators using 1 and added 1593 concat operators using 0
  • 01 Nov 2016: there was a 0.62% swing away from 0
  • 01 May 2017: there was a 0.96% swing towards 0
    • OpenEMR saw a 7.67% swing towards 0
    • concrete5 added 410 concat operators using 0
    • there was a 1.46% swing away from newline
    • OpenEMR saw a 10.88% swing away from newline
    • OpenEMR removed 6988 concat operators using newline

Spacing after cast statement

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

Current
Key Method Use
0 - Most popular method 0 58.73%
preferred by 14.29% of projects
1 1 41.27%
preferred by 79.12% of projects
2 2 < 0.01%
preferred by 0% of projects
8 8 < 0.01%
preferred by 0% of projects
undecided 6.59% of projects are undecided

Based on 37,204 cast statements in 182 projects

144 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.65% swing from 1 to 0
  • 01 Apr 2015: there was a 0.57% swing from 1 to 0
    • Chamilo saw a 5.86% swing away from 1
    • TYPO3 CMS saw a 3.17% swing from 1 to 0
    • Chamilo saw a 5.83% swing towards 0
    • Chamilo removed 188 cast statements using 1
  • 01 Oct 2016: there was a 1.81% swing from 1 to 0
    • OpenEMR saw a 38.5% swing from 1 to 0
    • OpenEMR removed 1132 cast statements using 1
  • 01 Nov 2016: there was a 2.14% swing away from 0
    • Moodle saw a 3.14% swing away from 0
    • TYPO3 CMS removed 330 cast statements using 0
    • there was a 2.15% swing towards 1
    • Moodle saw a 3.14% swing towards 1
    • TYPO3 CMS added 6 cast statements using 1

Class defined in namespace

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

Current
Key Method Use
no no 36.67%
preferred by 13.27% of projects
yes - Most popular method yes 63.33%
preferred by 84.18% of projects
undecided 2.55% of projects are undecided

Based on 52,130 classes in 196 projects

165 projects prefer yes

Historical
  • 01 Jun 2015: there was a 0.67% swing from yes to no
  • 01 Sep 2015: there was a 3.79% swing from yes to no
  • 01 Nov 2015: there was a 0.59% swing from no to yes
    • Chamilo saw a 4.45% swing from no to yes
    • phpMyAdmin saw a 70.26% swing from no to yes
  • 01 Dec 2015: there was a 1.96% swing from no to yes
    • Chamilo saw a 12.09% swing from no to yes
    • TYPO3 CMS saw a 39.86% swing from no to yes
    • Chamilo added 270 classes using yes
    • TYPO3 CMS removed 1318 classes using no
  • 01 Feb 2016: there was a 0.68% swing from no to yes
    • pimcore saw a 4.55% swing from no to yes
    • pimcore added 576 classes using yes
  • 01 Oct 2016: there was a 1.84% swing from yes to no
    • OpenEMR saw a 54.95% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 2.21% swing from no to yes
  • 01 Jan 2017: there was a 0.8% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes
  • 01 Jul 2017: there was a 1.2% swing from no to yes

Lowercase filename

Are PHP filenames lowercase?

Current
Key Method Use
no - Most popular method no 66.74%
preferred by 87.24% of projects
yes yes 33.26%
preferred by 6.12% of projects
undecided 6.63% of projects are undecided

Based on 58,620 files in 196 projects

171 projects prefer no

Historical
  • 01 Mar 2015: there was a 0.56% swing from yes to no
    • Chamilo removed 1377 files using yes
  • 01 Apr 2015: there was a 2.77% swing from yes to no
  • 01 May 2016: there was a 0.57% swing from yes to no
    • ownCloud saw a 32.66% swing from yes to no
  • 01 Jun 2016: there was a 1.22% swing from yes to no
  • 01 Oct 2016: there was a 1.59% swing from no to yes
    • OpenEMR saw a 32.13% swing from no to yes
    • OpenEMR removed 2425 files using no and added 9 files using yes
  • 01 Nov 2016: there was a 1.79% swing from yes to no
  • 01 May 2017: there was a 1.34% swing from no to yes
  • 01 Jul 2017: there was a 1.44% swing from yes to no

Class has doc comment

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

Current
Key Method Use
no no 33.17%
preferred by 17.35% of projects
yes - Most popular method yes 66.83%
preferred by 64.29% of projects
undecided 18.37% of projects are undecided

Based on 52,130 classes in 196 projects

126 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.64% swing from yes to no
    • Chamilo removed 1599 classes using yes
  • 01 Apr 2015: there was a 0.62% swing from yes to no
  • 01 Sep 2015: there was a 3.24% swing from yes to no
  • 01 Dec 2015: there was a 0.89% swing from yes to no
  • 01 Oct 2016: there was a 1.11% swing from no to yes
  • 01 Nov 2016: there was a 2.48% swing from no to yes
    • pimcore saw a 27.86% swing from no to yes
  • 01 Jan 2017: there was a 0.77% swing from yes to no
  • 01 May 2017: there was a 1.7% swing from yes to no
  • 01 Jul 2017: there was a 0.83% swing from no to yes

Function has doc comment

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

Current
Key Method Use
no no 28.93%
preferred by 5.61% of projects
yes - Most popular method yes 71.07%
preferred by 78.57% of projects
undecided 15.82% of projects are undecided

Based on 343,683 functions in 196 projects

154 projects prefer yes

Historical
  • 01 Sep 2015: there was a 5.03% swing from yes to no
  • 01 Oct 2016: there was a 1.06% swing from yes to no
    • OpenEMR saw a 22.54% swing from yes to no
    • OpenEMR removed 11790 functions using yes
  • 01 Nov 2016: there was a 1.65% swing from no to yes
    • RoboTask saw a 50.37% swing from no to yes
  • 01 May 2017: there was a 0.8% swing from yes to no

CamelCase class name

Are class names defined using CamelCase?

Current
Key Method Use
no no 25.95%
preferred by 7.14% of projects
yes - Most popular method yes 74.05%
preferred by 89.8% of projects
undecided 3.06% of projects are undecided

Based on 52,130 classes in 196 projects

176 projects prefer yes

Historical
  • 01 Sep 2015: there was a 4.65% swing from yes to no
  • 01 Dec 2015: there was a 2.23% swing from no to yes
    • Chamilo saw a 4.68% swing from no to yes
    • TYPO3 CMS saw a 39.71% swing from no to yes
    • Chamilo added 271 classes using yes
    • TYPO3 CMS removed 1312 classes using no
  • 01 Feb 2016: there was a 0.7% swing from yes to no
    • pimcore saw a 47.63% swing from yes to no
    • pimcore added 558 classes using no
  • 01 Oct 2016: there was a 1.35% swing from yes to no
    • OpenEMR saw a 37.65% swing from yes to no
    • OpenEMR removed 2178 classes using yes
  • 01 Nov 2016: there was a 1.19% swing from no to yes
  • 01 Jan 2017: there was a 0.69% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes
  • 01 Apr 2017: there was a 0.87% swing from no to yes
    • OpenEMR saw a 6.62% swing from no to yes
    • pimcore saw a 53.67% swing from no to yes
    • pimcore removed 600 classes using no

Use of ELSE IF or ELSEIF

Are elseif statements defined using elseif or else if?

Current
Key Method Use
else if else if 23.26%
preferred by 5.2% of projects
elseif - Most popular method elseif 76.74%
preferred by 87.28% of projects
undecided 7.51% of projects are undecided

Based on 28,050 elseif statements in 173 projects

151 projects prefer elseif

Historical
  • 01 Mar 2015: there was a 1.35% swing from else if to elseif
    • Chamilo saw a 14.7% swing from else if to elseif
    • Chamilo removed 922 elseif statements using else if
  • 01 Aug 2015: there was a 1.07% swing from else if to elseif
  • 01 Mar 2016: there was a 1.58% swing from else if to elseif
    • Anchor CMS saw a 53.33% swing from else if to elseif
    • pimcore saw a 95.6% swing from else if to elseif
    • phpMyAdmin removed 1 elseif statements using else if
  • 01 Jun 2016: there was a 0.67% swing from else if to elseif
    • Chamilo saw a 4.76% swing from else if to elseif
    • Joomla! CMS removed 15 elseif statements using else if and added 197 elseif statements using elseif
  • 01 Oct 2016: there was a 0.63% swing from elseif to else if
    • OpenEMR saw a 7.33% swing from elseif to else if
    • OpenEMR removed 757 elseif statements using elseif and added 36 elseif statements using else if
  • 01 Nov 2016: there was a 0.88% swing from else if to elseif
    • PHP Parser saw a 9.82% swing from else if to elseif
  • 01 May 2017: there was a 1.52% swing from elseif to else if
    • concrete5 saw a 31.3% swing from elseif to else if
    • OpenEMR saw a 11.38% swing from elseif to else if
    • React.http saw a 25% swing from elseif to else if
    • concrete5 added 330 elseif statements using else if
    • OpenEMR removed 977 elseif statements using elseif
  • 01 Jul 2017: there was a 0.81% swing from else if to elseif
    • concrete5 saw a 31.3% swing from else if to elseif
    • concrete5 removed 330 elseif statements using else if
  • 01 Sep 2017: there was a 1.24% swing from else if to elseif
    • Moodle removed 497 elseif statements using else if

File has doc comment

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

Current
Key Method Use
no no 23.07%
preferred by 18.37% of projects
yes - Most popular method yes 76.93%
preferred by 79.59% of projects
undecided 2.04% of projects are undecided

Based on 58,619 files in 196 projects

156 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.94% swing from no to yes
    • Chamilo saw a 12.53% swing from no to yes
    • ownCloud saw a 3.44% swing from no to yes
    • Chamilo removed 1018 files using no
  • 01 Apr 2015: there was a 0.75% swing from yes to no
  • 01 Jun 2015: there was a 0.58% swing from yes to no
  • 01 Jan 2016: there was a 0.59% swing from yes to no
  • 01 Oct 2016: there was a 0.98% swing from yes to no
    • OpenEMR saw a 11.1% swing from yes to no
    • OpenEMR removed 2413 files using yes
  • 01 Nov 2016: there was a 1.42% swing from no to yes
  • 01 Jan 2017: there was a 1.02% swing from yes to no
  • 01 Feb 2017: there was a 1.21% swing from yes to no
    • Imagine saw a 18.87% swing from yes to no
    • Phing saw a 5.5% swing from yes to no
  • 01 May 2017: there was a 1.49% swing from yes to no
    • OpenEMR saw a 5.8% swing from yes to no
    • Fractal saw a 4.55% swing from yes to no
    • concrete5 added 1112 files using no
    • OpenEMR removed 580 files using yes
  • 01 Jul 2017: there was a 1.52% swing from no to yes

Function opening brace placement

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

Current
Key Method Use
new line - Most popular method new line 76.94%
preferred by 90.82% of projects
same line same line 23.06%
preferred by 7.14% of projects
undecided 2.04% of projects are undecided

Based on 326,746 functions in 196 projects

178 projects prefer new line

Historical
  • 01 Sep 2015: there was a 2.21% swing from same line to new line
    • Pux saw a 48.99% swing from same line to new line
    • SugarCRM CE saw a 27.79% swing from same line to new line
    • SugarCRM CE added 23601 functions using new line
  • 01 Nov 2015: there was a 4% swing from same line to new line
    • TYPO3 CMS saw a 94.97% swing from same line to new line
  • 01 Mar 2016: there was a 1.41% swing from same line to new line
    • Anchor CMS saw a 88.8% swing from same line to new line
    • Faveo Help-desk saw a 75.09% swing from same line to new line
    • pimcore saw a 69.15% swing from same line to new line
  • 01 Oct 2016: there was a 0.79% swing from new line to same line
    • OpenEMR saw a 26.4% swing from new line to same line
    • OpenEMR removed 11266 functions using new line
  • 01 Nov 2016: there was a 2.54% swing from new line to same line
  • 01 May 2017: there was a 0.84% swing from new line to same line
    • OpenEMR saw a 12.33% swing from new line to same line
    • concrete5 added 3292 functions using same line
    • OpenEMR removed 2746 functions using new line
  • 01 Jul 2017: there was a 0.76% swing from same line to new line
    • concrete5 removed 3292 functions using same line
  • 01 Aug 2017: there was a 2.34% swing from same line to new line
    • Agora Invoicing saw a 73.89% swing from same line to new line
    • OpenEMR saw a 71.03% swing from same line to new line
  • 01 Sep 2017: there was a 0.8% swing from same line to new line
    • Moodle removed 3564 functions using same line

Space before operator

How many spaces precede comparison, arithmetic and assignment operators?

Current
Key Method Use
0 0 20.62%
preferred by 1.04% of projects
1 - Most popular method 1 78%
preferred by 93.75% of projects
newline newline 1.21%
preferred by 0% of projects
Other other 0.17%
undecided 5.21% of projects are undecided

Based on 436,313 operators in 192 projects

180 projects prefer 1

0 projects prefer newline

Historical

Line indent

Are lines indented using spaces or tabs?

Current
Key Method Use
mixed mixed 0.34%
preferred by 0% of projects
spaces - Most popular method spaces 78.35%
preferred by 83.16% of projects
tabs tabs 21.31%
preferred by 16.84% of projects

Based on 7,661,254 indented lines in 196 projects

163 projects prefer spaces

Historical
  • 01 Aug 2015: there was a 1.79% swing from tabs to spaces
    • PrestaShop saw a 81.97% swing from tabs to spaces
  • 01 Sep 2015: there was a 0.78% swing from tabs to spaces
  • 01 Nov 2015: there was a 4.6% swing from tabs to spaces
    • TYPO3 CMS saw a 96.62% swing from tabs to spaces
  • 01 Oct 2016: there was a 0.66% swing from spaces to tabs
    • OpenEMR saw a 9.14% swing from spaces to tabs
    • OpenEMR removed 218759 indented lines using spaces and added 1274 indented lines using tabs
  • 01 Nov 2016: there was a 1.34% swing from tabs to spaces
  • 01 May 2017: there was a 0.95% swing away from spaces
    • OpenEMR saw a 7.02% swing away from spaces
    • OpenEMR removed 134629 indented lines using spaces
    • there was a 0.6% swing towards tabs
    • OpenEMR saw a 5.3% swing towards tabs
    • concrete5 added 59752 indented lines using tabs
  • 01 Jul 2017: there was a 0.64% swing from tabs to spaces
    • concrete5 removed 59832 indented lines using tabs
  • 01 Aug 2017: there was a 1.51% swing from tabs to spaces

Class opening brace placement

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

Current
Key Method Use
new line - Most popular method new line 79.09%
preferred by 91.33% of projects
same line same line 20.91%
preferred by 6.63% of projects
undecided 2.04% of projects are undecided

Based on 52,130 classes in 196 projects

179 projects prefer new line

Historical
  • 01 Feb 2015: there was a 0.75% swing from same line to new line
    • RoboTask saw a 55.44% swing from same line to new line
    • PHPMailer saw a 12.5% swing from same line to new line
    • QuickAppsCMS saw a 100% swing from same line to new line
  • 01 Mar 2015: there was a 0.8% swing from new line to same line
    • Chamilo saw a 11.47% swing from new line to same line
    • Chamilo removed 1662 classes using new line
  • 01 Jun 2015: there was a 0.76% swing from same line to new line
  • 01 Sep 2015: there was a 1.52% swing from same line to new line
    • Pux saw a 12.5% swing from same line to new line
    • SugarCRM CE saw a 24.7% swing from same line to new line
    • Stash saw a 5.56% swing from same line to new line
    • SugarCRM CE added 2998 classes using new line
  • 01 Nov 2015: there was a 6.74% swing from same line to new line
    • TYPO3 CMS saw a 96.78% swing from same line to new line
  • 01 Feb 2016: there was a 1.07% swing from new line to same line
    • pimcore saw a 3.7% swing from new line to same line
    • pimcore added 575 classes using same line
  • 01 Mar 2016: there was a 2.91% swing from same line to new line
    • Anchor CMS saw a 98.31% swing from same line to new line
    • Faveo Help-desk saw a 94.32% swing from same line to new line
    • pimcore saw a 96.46% swing from same line to new line
    • OpenEMR removed 13 classes using same line and added 293 classes using new line
  • 01 Oct 2016: there was a 0.8% swing from new line to same line
    • OpenEMR saw a 13.23% swing from new line to same line
    • OpenEMR removed 2179 classes using new line
  • 01 Nov 2016: there was a 3.71% swing from new line to same line
  • 01 May 2017: there was a 1.64% swing from new line to same line
    • OpenEMR saw a 10.85% swing from new line to same line
    • concrete5 added 880 classes using same line
    • OpenEMR removed 340 classes using new line
  • 01 Jul 2017: there was a 1.31% swing from same line to new line
    • concrete5 removed 880 classes using same line
  • 01 Aug 2017: there was a 0.92% swing from same line to new line
    • Agora Invoicing saw a 50.14% swing from same line to new line
    • OpenEMR saw a 44.62% swing from same line to new line

Adjacent assignments aligned

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

Current
Key Method Use
no - Most popular method no 81.29%
preferred by 61.66% of projects
yes yes 18.71%
preferred by 10.88% of projects
undecided 27.46% of projects are undecided

Based on 187,299 assignment blocks in 193 projects

119 projects prefer no

Historical
  • 01 Sep 2015: there was a 0.71% swing from no to yes
  • 01 Oct 2016: there was a 0.78% swing from yes to no
    • OpenEMR saw a 7.52% swing from yes to no
    • OpenEMR removed 1970 assignment blocks using yes

One class per file

Is each class defined in a file by itself?

Current
Key Method Use
no no 14.99%
preferred by 1.02% of projects
yes - Most popular method yes 85.01%
preferred by 96.43% of projects
undecided 2.55% of projects are undecided

Based on 52,130 classes in 196 projects

189 projects prefer yes

Historical
  • 01 Sep 2015: there was a 5.23% swing from yes to no
  • 01 Dec 2015: there was a 2.39% swing from no to yes
  • 01 Feb 2016: there was a 0.94% swing from yes to no
    • pimcore saw a 53.17% swing from yes to no
    • pimcore added 571 classes using no
  • 01 Oct 2016: there was a 0.71% swing from yes to no
    • OpenEMR saw a 5.22% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 1.2% swing from no to yes
  • 01 Apr 2017: there was a 0.98% swing from no to yes
    • pimcore saw a 50.98% swing from no to yes
    • pimcore removed 570 classes using no

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.)?

Current
Key Method Use
no - Most popular method no 85.67%
preferred by 94.39% of projects
yes yes 14.33%
preferred by 2.55% of projects
undecided 3.06% of projects are undecided

Based on 58,620 files in 196 projects

185 projects prefer no

Historical
  • 01 Apr 2015: there was a 0.8% swing from no to yes
  • 01 Oct 2016: there was a 0.75% swing from no to yes
    • OpenEMR saw a 19.82% swing from no to yes
    • OpenEMR removed 2402 files using no
  • 01 Nov 2016: there was a 1.13% swing from yes to no
  • 01 May 2017: there was a 0.65% swing from no to yes
  • 01 Jul 2017: there was a 1.02% swing from yes to no

PHP constant case

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

Current
Key Method Use
lower - Most popular method lower 87.97%
preferred by 93.33% of projects
mixed mixed 0.06%
preferred by 0% of projects
upper upper 11.97%
preferred by 5.64% of projects
undecided 1.03% of projects are undecided

Based on 319,836 PHP constants in 195 projects

182 projects prefer lower

2 projects are undecided

Historical

CamelCase method name

Are class method names defined using CamelCase?

Current
Key Method Use
no no 11.94%
preferred by 2.04% of projects
yes - Most popular method yes 88.06%
preferred by 95.92% of projects
undecided 2.04% of projects are undecided

Based on 312,042 methods in 196 projects

188 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.86% swing from no to yes
    • Chamilo removed 3964 methods using no
  • 01 Sep 2015: there was a 1.18% swing from no to yes
    • Pux saw a 4.74% swing from no to yes
    • SugarCRM CE saw a 16.54% swing from no to yes
    • SugarCRM CE added 23435 methods using yes
  • 01 Nov 2016: there was a 0.64% swing from no to yes

Private method prefixed with underscore

Are private methods prefixed with an underscore?

Current
Key Method Use
no - Most popular method no 89.08%
preferred by 93.38% of projects
yes yes 10.92%
preferred by 4.41% of projects
undecided 2.21% of projects are undecided

Based on 10,945 private methods in 136 projects

127 projects prefer no

3 projects are undecided

Historical
  • 01 Apr 2015: there was a 2.03% swing from yes to no
  • 01 Nov 2016: there was a 0.83% swing from yes to no
  • 01 May 2017: there was a 2.86% swing from yes to no
    • OpenEMR saw a 63.29% swing from yes to no
    • PHP_CodeSniffer saw a 100% swing from yes to no
    • OpenEMR removed 315 private methods using yes and added 2 private methods using no

Inline comment style

What comment style is used for non docblock comments?

Current
Key Method Use
# ... # ... 2.48%
preferred by 0.53% of projects
/* ... */ /* ... */ 7.61%
preferred by 1.06% of projects
// ... - Most popular method // ... 89.91%
preferred by 85.71% of projects
undecided 12.7% of projects are undecided

Based on 395,075 inline comments in 189 projects

1 project prefers # ...

2 projects prefer /* ... */

162 projects prefer // ...

Historical

Spaces after control structure open parenthesis

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

Current
Key Method Use
0 - Most popular method 0 92.15%
preferred by 98.46% of projects
1 1 7.67%
preferred by 1.54% of projects
Other other 0.18%

Based on 511,370 control structures in 195 projects

192 projects prefer 0

3 projects prefer 1

Historical

Constant name case

What case are user-defined constants defined in?

Current
Key Method Use
lower lower 0.87%
preferred by 1.25% of projects
mixed mixed 6.82%
preferred by 0.63% of projects
upper - Most popular method upper 92.31%
preferred by 98.13% of projects

Based on 23,114 constants in 160 projects

2 projects prefer lower

1 project prefers mixed

157 projects prefer upper

Historical
  • 01 Mar 2015: there was a 3.19% swing away from upper
    • Chamilo removed 16303 constants using upper
    • there was a 2.84% swing towards mixed

Line length

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

Current
Key Method Use
80 or less - Most popular method 80 or less 92.33%
preferred by 99.49% of projects
81-120 81-120 6.2%
preferred by 0% of projects
121-150 121-150 0.84%
preferred by 0% of projects
151 or more 151 or more 0.63%
preferred by 0% of projects
undecided 0.51% of projects are undecided

Based on 9,697,563 lines in 196 projects

195 projects prefer 80 or less

1 project is undecided

Historical

Spaces before control structure close parenthesis

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

Current
Key Method Use
0 - Most popular method 0 92.97%
preferred by 98.46% of projects
1 1 7.02%
preferred by 1.54% of projects
2 2 0.01%
preferred by 0% of projects
3 3 < 0.01%
preferred by 0% of projects

Based on 511,370 control structures in 195 projects

192 projects prefer 0

3 projects prefer 1

Historical

Number of newlines at EOF

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

Current
Key Method Use
0 0 4.84%
preferred by 0.51% of projects
1 - Most popular method 1 93.27%
preferred by 95.41% of projects
2 2 1.46%
preferred by 0% of projects
Other other 0.44%
undecided 4.08% of projects are undecided

Based on 56,053 files in 196 projects

1 project prefers 0

187 projects prefer 1