Embed Instructions

Across all 197 projects, 89.05% 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 197 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 50.94%
preferred by 24.65% of projects
yes yes 49.06%
preferred by 52.11% of projects
undecided 23.24% of projects are undecided

Based on 15,151 array definitions in 142 projects

74 projects prefer yes

Historical
  • 01 Dec 2015: there was a 0.81% 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
    • PHPMailer saw a 9.52% 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.3% swing from no to yes
    • OpenEMR removed 783 array definitions using no
  • 01 Sep 2017: there was a 0.76% swing from no to yes
    • TYPO3 CMS saw a 20.09% swing from no to yes
    • TYPO3 CMS added 230 array definitions using yes

Spacing after string concat

How many spaces follow the string concatenation operator?

Current
Key Method Use
0 0 38.91%
preferred by 10.75% of projects
1 - Most popular method 1 53.41%
preferred by 75.27% of projects
newline newline 7.53%
preferred by 1.08% of projects
Other other 0.15%
undecided 12.9% of projects are undecided

Based on 430,331 concat operators in 186 projects

140 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.64% swing away from 0
    • Zikula saw a 3.52% swing away from 0
    • Chamilo removed 7443 concat operators using 0
  • 01 Oct 2016: there was a 1.18% swing away from newline
    • OpenEMR saw a 6.93% swing away from newline
    • OpenEMR removed 5793 concat operators using newline
    • there was a 1.1% swing towards 0
    • OpenEMR saw a 5.78% swing towards 0
    • OpenEMR added 1577 concat operators using 0
  • 01 Nov 2016: there was a 0.6% swing away from 0
  • 01 May 2017: there was a 1.32% swing towards 0
    • OpenEMR saw a 7.12% swing towards 0
    • there was a 1.59% swing away from 1
    • OpenEMR saw a 12.66% 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.58%
preferred by 10.75% of projects
1 - Most popular method 1 56.07%
preferred by 63.98% of projects
newline newline 3.77%
preferred by 2.15% of projects
Other other 0.58%
undecided 23.12% of projects are undecided

Based on 430,329 concat operators in 186 projects

119 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.62% swing away from 0
    • Chamilo removed 7486 concat operators using 0
  • 01 Oct 2016: there was a 1.11% swing from 1 to 0
    • OpenEMR saw a 6.84% swing away from 1
    • OpenEMR saw a 5.94% 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 1.36% swing from newline to 0
    • OpenEMR saw a 10.88% swing away from newline
    • OpenEMR saw a 7.64% swing towards 0
    • OpenEMR removed 6988 concat operators using newline

Short array syntax used

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

Current
Key Method Use
no no 43.07%
preferred by 36.92% of projects
yes - Most popular method yes 56.93%
preferred by 61.03% of projects
undecided 2.05% of projects are undecided

Based on 579,025 array definitions in 195 projects

119 projects prefer yes

Historical

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 59.41%
preferred by 15% of projects
1 1 40.59%
preferred by 77.78% of projects
2 2 < 0.01%
preferred by 0% of projects
8 8 < 0.01%
preferred by 0% of projects
undecided 7.22% of projects are undecided

Based on 39,151 cast statements in 180 projects

140 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.65% swing from 1 to 0
  • 01 Apr 2015: there was a 0.58% swing from 1 to 0
    • Chamilo saw a 6.1% swing from 1 to 0
    • TYPO3 CMS saw a 3.17% swing from 1 to 0
    • Chamilo removed 188 cast statements using 1
  • 01 Oct 2016: there was a 1.83% 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.19% swing from 0 to 1
    • Moodle saw a 3.14% swing from 0 to 1
    • TYPO3 CMS removed 330 cast statements using 0 and 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 35.59%
preferred by 12.69% of projects
yes - Most popular method yes 64.41%
preferred by 83.76% of projects
undecided 3.55% of projects are undecided

Based on 54,659 classes in 197 projects

165 projects prefer yes

Historical
  • 01 Apr 2015: there was a 0.74% swing from no to yes
  • 01 Jun 2015: there was a 0.65% swing from yes to no
  • 01 Sep 2015: there was a 3.8% swing from yes to no
  • 01 Nov 2015: there was a 0.66% swing from no to yes
    • Chamilo saw a 4.42% swing from no to yes
    • phpMyAdmin saw a 70.26% swing from no to yes
  • 01 Dec 2015: there was a 1.99% swing from no to yes
    • Chamilo saw a 12.4% swing from no to yes
    • PHPMailer saw a 100% swing from no to yes
    • TYPO3 CMS saw a 39.86% swing from no to yes
    • Chamilo removed 3 classes using no and added 270 classes using yes
    • TYPO3 CMS removed 1318 classes using no
  • 01 Feb 2016: there was a 0.69% swing from no to yes
    • pimcore saw a 6.35% swing from no to yes
    • pimcore removed 9 classes using no and added 576 classes using yes
  • 01 Oct 2016: there was a 1.82% swing from yes to no
    • OpenEMR saw a 54.91% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 2.23% swing from no to yes
  • 01 Jan 2017: there was a 0.81% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes

Lowercase filename

Are PHP filenames lowercase?

Current
Key Method Use
no - Most popular method no 66.46%
preferred by 86.8% of projects
yes yes 33.54%
preferred by 6.6% of projects
undecided 6.6% of projects are undecided

Based on 61,516 files in 197 projects

171 projects prefer no

Historical
  • 01 Mar 2015: there was a 0.57% swing from yes to no
    • Chamilo removed 1379 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.02% swing from no to yes
    • OpenEMR removed 2425 files using no and added 9 files using yes
  • 01 Nov 2016: there was a 1.85% 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 32.14%
preferred by 16.24% of projects
yes - Most popular method yes 67.86%
preferred by 64.47% of projects
undecided 19.29% of projects are undecided

Based on 54,659 classes in 197 projects

127 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.64% swing from yes to no
    • Chamilo removed 1606 classes using yes
  • 01 Apr 2015: there was a 0.61% swing from yes to no
  • 01 Sep 2015: there was a 3.22% swing from yes to no
  • 01 Dec 2015: there was a 1.21% swing from yes to no
  • 01 Oct 2016: there was a 1.09% swing from no to yes
  • 01 Nov 2016: there was a 2.57% swing from no to yes
    • pimcore saw a 27.68% swing from no to yes
  • 01 Jan 2017: there was a 0.85% swing from yes to no

Function has doc comment

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

Current
Key Method Use
no no 27.66%
preferred by 6.09% of projects
yes - Most popular method yes 72.34%
preferred by 78.68% of projects
undecided 15.23% of projects are undecided

Based on 367,661 functions in 197 projects

155 projects prefer yes

Historical
  • 01 Sep 2015: there was a 4.96% swing from yes to no
  • 01 Oct 2016: there was a 1.06% swing from yes to no
    • OpenEMR saw a 22.49% swing from yes to no
    • OpenEMR removed 11790 functions using yes
  • 01 Nov 2016: there was a 1.66% swing from no to yes
    • RoboTask saw a 50.37% swing from no to yes
  • 01 Mar 2018: there was a 1.06% swing from no to yes
    • Anchor CMS saw a 59.65% swing from no to yes
    • OpenEMR saw a 36.55% swing from no to yes
    • React.dns saw a 4.1% swing from no to yes
    • OpenEMR added 12309 functions using yes

PascalCase class name

Are class names defined using PascalCase?

Current
Key Method Use
no no 26.24%
preferred by 7.11% of projects
yes - Most popular method yes 73.76%
preferred by 90.36% of projects
undecided 2.54% of projects are undecided

Based on 54,659 classes in 197 projects

178 projects prefer yes

Historical
  • 01 Apr 2015: there was a 0.7% swing from no to yes
  • 01 Sep 2015: there was a 4.66% swing from yes to no
  • 01 Dec 2015: there was a 2.25% swing from no to yes
    • Chamilo saw a 5.16% swing from no to yes
    • PHPMailer saw a 15.38% swing from no to yes
    • TYPO3 CMS saw a 39.71% swing from no to yes
    • Chamilo removed 2 classes using no and added 269 classes using yes
    • TYPO3 CMS removed 1312 classes using no
  • 01 Feb 2016: there was a 0.67% swing from yes to no
    • PHPMailer saw a 8.33% swing from yes to no
    • pimcore saw a 46.21% swing from yes to no
    • pimcore added 550 classes using no
  • 01 Oct 2016: there was a 1.32% swing from yes to no
    • OpenEMR saw a 37.82% swing from yes to no
    • OpenEMR removed 2178 classes using yes
  • 01 Nov 2016: there was a 1.2% swing from no to yes
  • 01 Jan 2017: there was a 0.68% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes
  • 01 Mar 2017: there was a 0.87% swing from no to yes
    • pimcore saw a 48.26% swing from no to yes
    • pimcore removed 571 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 25.44%
preferred by 5.17% of projects
elseif - Most popular method elseif 74.56%
preferred by 87.93% of projects
undecided 6.9% of projects are undecided

Based on 29,828 elseif statements in 174 projects

153 projects prefer elseif

Historical
  • 01 Mar 2015: there was a 1.44% swing from else if to elseif
    • Chamilo saw a 15.37% swing from else if to elseif
    • Chamilo removed 963 elseif statements using else if
  • 01 Aug 2015: there was a 0.98% swing from else if to elseif
  • 01 Mar 2016: there was a 1.63% 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.65% swing from else if to elseif
    • Chamilo saw a 4.85% 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.62% swing from elseif to else if
    • OpenEMR saw a 7.32% 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.9% swing from else if to elseif
    • PHP Parser saw a 9.82% swing from else if to elseif
  • 01 May 2017: there was a 0.68% swing from elseif to else if
    • OpenEMR saw a 11.37% swing from elseif to else if
    • React.http saw a 25% swing from elseif to else if
    • OpenEMR removed 977 elseif statements using elseif
  • 01 Mar 2018: there was a 2.08% swing from elseif to else if
    • OpenEMR saw a 13.02% swing from elseif to else if
    • OpenEMR added 802 elseif statements using else if
  • 01 Jun 2018: there was a 0.73% swing from else if to elseif
    • ownCloud saw a 64.61% swing from else if to elseif

File has doc comment

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

Current
Key Method Use
no no 24.48%
preferred by 19.8% of projects
yes - Most popular method yes 75.52%
preferred by 77.66% of projects
undecided 2.54% of projects are undecided

Based on 61,515 files in 197 projects

153 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.93% swing from no to yes
    • Chamilo saw a 12.51% 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 1.24% swing from yes to no
  • 01 Jun 2015: there was a 0.59% swing from yes to no
  • 01 Jan 2016: there was a 0.61% swing from yes to no
  • 01 Oct 2016: there was a 0.97% swing from yes to no
    • OpenEMR saw a 11.06% swing from yes to no
    • OpenEMR removed 2413 files using yes
  • 01 Nov 2016: there was a 1.45% swing from no to yes
  • 01 Jan 2017: there was a 1% swing from yes to no
  • 01 Feb 2017: there was a 1.22% 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 Feb 2018: there was a 0.73% swing from yes to no
  • 01 Mar 2018: there was a 0.89% swing from yes to no
    • OpenEMR saw a 21.9% swing from yes to no
    • OpenEMR added 705 files using no

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.34%
preferred by 90.86% of projects
same line same line 23.66%
preferred by 7.11% of projects
undecided 2.03% of projects are undecided

Based on 350,198 functions in 197 projects

179 projects prefer new line

Historical
  • 01 Sep 2015: there was a 2.14% 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.18% 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.42% 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.8% swing from new line to same line
    • OpenEMR saw a 26.28% swing from new line to same line
    • OpenEMR removed 11266 functions using new line
  • 01 Nov 2016: there was a 2.51% swing from new line to 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 70.85% swing from same line to new line
  • 01 Mar 2018: there was a 0.88% swing from same line to new line
    • OpenEMR added 12347 functions using new line

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 78.25%
preferred by 90.86% of projects
same line same line 21.75%
preferred by 6.6% of projects
undecided 2.54% of projects are undecided

Based on 54,659 classes in 197 projects

179 projects prefer new line

Historical
  • 01 Feb 2015: there was a 0.78% 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.81% swing from new line to same line
    • Chamilo saw a 12.02% swing from new line to same line
    • Chamilo removed 1662 classes using new line
  • 01 Jun 2015: there was a 0.77% swing from same line to new line
  • 01 Sep 2015: there was a 1.53% 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.81% 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.06% swing from new line to same line
    • PHPMailer saw a 8.33% swing from new line to same line
    • pimcore saw a 3.56% swing from new line to same line
    • pimcore added 565 classes using same line
  • 01 Mar 2016: there was a 2.94% 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 286 classes using new line
  • 01 Oct 2016: there was a 0.8% swing from new line to same line
    • OpenEMR saw a 13.08% swing from new line to same line
    • OpenEMR removed 2179 classes using new line
  • 01 Nov 2016: there was a 3.67% swing from new line to same line
  • 01 Aug 2017: there was a 0.91% swing from same line to new line
    • Agora Invoicing saw a 50.14% swing from same line to new line
    • OpenEMR saw a 44.17% swing from same line to new line

Space before operator

How many spaces precede comparison, arithmetic and assignment operators?

Current
Key Method Use
0 0 20.14%
preferred by 1.04% of projects
1 - Most popular method 1 78.57%
preferred by 94.3% of projects
newline newline 1.13%
preferred by 0% of projects
Other other 0.16%
undecided 4.66% of projects are undecided

Based on 454,818 operators in 193 projects

182 projects prefer 1

0 projects prefer newline

Historical
  • 01 Mar 2015: there was a 18.12% swing away from 0
    • Chamilo saw a 49.36% swing away from 0
    • Chamilo removed 175949 operators using 0
    • there was a 17.74% swing towards 1
    • Chamilo saw a 48.99% swing towards 1
  • 01 Feb 2016: there was a 0.61% swing from 0 to 1
    • pimcore saw a 54.44% swing away from 0
    • pimcore saw a 54.26% swing towards 1
    • pimcore removed 3429 operators using 0 and added 9 operators using 1
  • 01 Mar 2016: there was a 0.8% swing from 1 to 0
  • 01 Oct 2016: there was a 0.64% swing from 1 to 0
    • OpenEMR saw a 5.52% swing away from 1
    • OpenEMR saw a 5.77% swing towards 0
    • OpenEMR removed 8965 operators using 1 and added 671 operators using 0
  • 01 Nov 2016: there was a 0.96% swing from 0 to 1
  • 01 May 2017: there was a 6.63% swing from 0 to 1
    • OpenEMR saw a 21.07% swing away from 0
    • pimcore saw a 5.72% swing away from 0
    • OpenEMR saw a 21.49% swing towards 1
    • pimcore saw a 5.91% swing towards 1
    • PHPUnit saw a 7.19% swing towards 1
    • OpenEMR removed 45795 operators using 0

Line indent

Are lines indented using spaces or tabs?

Current
Key Method Use
mixed mixed 0.32%
preferred by 0% of projects
spaces - Most popular method spaces 79.25%
preferred by 83.25% of projects
tabs tabs 20.43%
preferred by 16.75% of projects

Based on 8,203,119 indented lines in 197 projects

164 projects prefer spaces

Historical
  • 01 Aug 2015: there was a 1.88% swing from tabs to spaces
  • 01 Sep 2015: there was a 0.69% swing from tabs to spaces
  • 01 Nov 2015: there was a 4.83% swing from tabs to spaces
    • TYPO3 CMS saw a 96.61% swing from tabs to spaces
  • 01 Oct 2016: there was a 0.68% swing from spaces to tabs
    • OpenEMR saw a 9.26% swing away from spaces
    • OpenEMR saw a 8.77% swing towards tabs
    • OpenEMR removed 219266 indented lines using spaces and added 1162 indented lines using tabs
  • 01 Nov 2016: there was a 1.35% swing towards spaces
    • there was a 1.33% swing away from tabs
  • 01 Aug 2017: there was a 1.5% swing towards spaces
    • Agora Invoicing saw a 35.36% swing towards spaces
    • OpenEMR saw a 33.18% swing towards spaces
    • there was a 1.43% swing away from tabs
    • Agora Invoicing saw a 35.01% swing away from tabs
    • OpenEMR saw a 31.12% swing away from tabs
  • 01 Mar 2018: there was a 0.65% swing towards spaces
    • Anchor CMS saw a 15.2% swing towards spaces
    • OpenEMR added 231710 indented lines using spaces
    • there was a 0.64% swing away from tabs
    • Anchor CMS saw a 15.1% swing away from tabs

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 80.62%
preferred by 61.34% of projects
yes yes 19.38%
preferred by 10.31% of projects
undecided 28.35% of projects are undecided

Based on 195,424 assignment blocks in 194 projects

119 projects prefer no

Historical
  • 01 Sep 2015: there was a 0.68% swing from no to yes
  • 01 Oct 2016: there was a 0.79% swing from yes to no
    • OpenEMR saw a 7.55% swing from yes to no
    • OpenEMR removed 1975 assignment blocks using yes

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.04%
preferred by 94.42% of projects
yes yes 14.96%
preferred by 2.54% of projects
undecided 3.05% of projects are undecided

Based on 61,516 files in 197 projects

186 projects prefer no

Historical
  • 01 Apr 2015: there was a 0.73% swing from no to yes
  • 01 Oct 2016: there was a 0.74% swing from no to yes
    • OpenEMR saw a 19.73% swing from no to yes
    • OpenEMR removed 2402 files using no
  • 01 Nov 2016: there was a 1.15% swing from yes to no

One class per file

Is each class defined in a file by itself?

Current
Key Method Use
no no 14.46%
preferred by 1.02% of projects
yes - Most popular method yes 85.54%
preferred by 96.45% of projects
undecided 2.54% of projects are undecided

Based on 54,659 classes in 197 projects

190 projects prefer yes

Historical
  • 01 Sep 2015: there was a 5.22% swing from yes to no
  • 01 Dec 2015: there was a 2.39% swing from no to yes
    • PHPMailer saw a 7.69% swing from no to yes
    • TYPO3 CMS saw a 38.76% swing from no to yes
    • Chamilo removed 1 classes using no and added 268 classes using yes
    • TYPO3 CMS removed 1280 classes using no
  • 01 Feb 2016: there was a 0.88% swing from yes to no
    • pimcore saw a 51.39% swing from yes to no
    • pimcore added 562 classes using no
  • 01 Oct 2016: there was a 0.71% swing from yes to no
    • OpenEMR saw a 5.23% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 1.23% swing from no to yes
  • 01 Mar 2017: there was a 0.97% swing from no to yes
    • pimcore saw a 50.84% swing from no to yes
    • pimcore removed 569 classes using no

CamelCase method name

Are class method names defined using CamelCase?

Current
Key Method Use
no no 12.63%
preferred by 2.03% of projects
yes - Most popular method yes 87.37%
preferred by 96.45% of projects
undecided 1.52% of projects are undecided

Based on 332,434 methods in 197 projects

190 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.84% swing from no to yes
    • Chamilo removed 3973 methods using no
  • 01 Sep 2015: there was a 1.2% 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.66% swing from no to yes

PHP constant case

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

Current
Key Method Use
lower - Most popular method lower 87.59%
preferred by 93.37% of projects
mixed mixed 0.05%
preferred by 0% of projects
upper upper 12.36%
preferred by 5.61% of projects
undecided 1.02% of projects are undecided

Based on 349,459 PHP constants in 196 projects

183 projects prefer lower

2 projects are undecided

Historical

Private method prefixed with underscore

Are private methods prefixed with an underscore?

Current
Key Method Use
no - Most popular method no 89.72%
preferred by 93.53% of projects
yes yes 10.28%
preferred by 3.6% of projects
undecided 2.88% of projects are undecided

Based on 11,710 private methods in 139 projects

130 projects prefer no

Historical
  • 01 Apr 2015: there was a 2.16% swing from yes to no
  • 01 Nov 2016: there was a 0.89% swing from yes to no
  • 01 May 2017: there was a 2.57% swing from yes to no
    • OpenEMR saw a 63.29% 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.34%
preferred by 0.52% of projects
/* ... */ /* ... */ 7.46%
preferred by 1.04% of projects
// ... - Most popular method // ... 90.21%
preferred by 86.98% of projects
undecided 11.46% of projects are undecided

Based on 421,233 inline comments in 192 projects

1 project prefers # ...

2 projects prefer /* ... */

167 projects prefer // ...

Historical

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.29%
preferred by 99.49% of projects
81-120 81-120 6.23%
preferred by 0% of projects
121-150 121-150 0.84%
preferred by 0% of projects
151 or more 151 or more 0.64%
preferred by 0% of projects
undecided 0.51% of projects are undecided

Based on 10,290,233 lines in 197 projects

196 projects prefer 80 or less

1 project is undecided

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.47%
preferred by 98.47% of projects
1 1 7.37%
preferred by 1.53% of projects
Other other 0.16%

Based on 551,051 control structures in 196 projects

193 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.86%
preferred by 0.63% of projects
mixed mixed 6.66%
preferred by 0.63% of projects
upper - Most popular method upper 92.48%
preferred by 98.73% of projects

Based on 24,000 constants in 158 projects

1 project prefers lower

1 project prefers mixed

156 projects prefer upper

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

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 93.16%
preferred by 98.47% of projects
1 1 6.84%
preferred by 1.53% of projects
2 2 < 0.01%
preferred by 0% of projects
3 3 < 0.01%
preferred by 0% of projects

Based on 551,051 control structures in 196 projects

193 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.63%
preferred by 0.51% of projects
1 - Most popular method 1 93.66%
preferred by 95.94% of projects
2 2 1.29%
preferred by 0% of projects
Other other 0.42%
undecided 3.55% of projects are undecided

Based on 58,939 files in 197 projects

1 project prefers 0

189 projects prefer 1

Historical