View Issue Details

IDProjectCategoryView StatusLast Update
0003860Composrcorepublic2019-12-03 04:00
ReporterChris GrahamAssigned ToChris Graham 
Severityfeature 
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0003860: Use PSR-12 standard
DescriptionOur code is formatted according to PSR-2. Now there's a new PSR-12 standard.

There are a lot of very prescriptive parts that are common sense that I don't want to implement into the Code Quality Checker, and really are just there to hit programmers over the head with when they write awfully ugly code.

But of what is there and we don't currently support, the following is relevant to enforce our code to...

1) No "?>" at end of PHP file
2) No lines longer than 80 characters
3) No multiple statements per line
4) No upper case keywords
5) No long-form casting or type declarations, e.g. do (int) not (integer)
6) Do not skip parentheses when constructing a new object, even if not needed
7) No blank lines after an opening brace or before a closing brace
8) Visibility must be declared on class constants (PHP 7.1+)
9) If a case statement has no break, it must be documented '// no break'

I am happy to implement some of these independently into the CQC without formally declaring PSR-12.

If it's all done, we can then updating the coding standards document to reflect our PSR-12 support.

PHP CodeSniffer can scan for PSR-12 issues https://github.com/squizlabs/PHP_CodeSniffer/ -- we should perhaps add this to our release process as an extra manual check. If we are finding many issues, they should also be coded into the CQC.
TagsType: Standards compliance
Attach Tags
Time estimation (hours)40
Sponsorship open

Relationships

related to 0003681 resolvedChris Graham Run the PHP codebase through PHP_CodeSniffer beautifier 
related to 0002747 non-assigned PHP refresh (ongoing) 

Activities

Chris Graham

2019-12-03 04:00

administrator   ~0006193

This is essentially done. I'll comment on it in 0003681.

Issue History

Date Modified Username Field Change
2019-08-12 17:21 Chris Graham New Issue
2019-08-12 17:21 Chris Graham Tag Attached: Type: Standards compliance
2019-08-12 17:22 Chris Graham Relationship added related to 0003681
2019-08-12 17:23 Chris Graham Relationship added related to 0002747
2019-11-14 21:23 Chris Graham Description Updated View Revisions
2019-11-14 22:25 Chris Graham Time estimation (hours) => 40
2019-12-03 04:00 Chris Graham Assigned To => Chris Graham
2019-12-03 04:00 Chris Graham Status non-assigned => resolved
2019-12-03 04:00 Chris Graham Resolution open => fixed
2019-12-03 04:00 Chris Graham Note Added: 0006193