Topic #4189 (no title)
0 guests and 0 members have recently viewed this.
The top 3 point earners from 14th Dec 2025 to 21st Dec 2025.
| PDStig |
|
|
|---|---|---|
| Gabri |
|
|
| sholzy |
|
|
There are no events at this time
#3681 - Run the PHP codebase through PHP_CodeSniffer beautifier
The 'external_code_considerations' test needs to be updated to make sure exceptions coded for 3rd party libs are consistent with exceptions coded in other configuration files.
Advantages to running the formatter: closer to the code examples in the PSR-2 spec (which apparently our initial PHPStorm-based is not so much); closer to how our JS code is now formatted.
After running the formatter carefully check over the diff to make sure it's not breaking stuff.
We need to make sure the CQC still works. In particular it checks tabbing by comparing opening and closing brace positions.
I've approached this more broadly. PHP CodeSniffer and ESLint are now integrated directly into the CQC, which has also been refactored to have cleaner command line options. These tools are considered deeper checks. ESLint is not expected to have 100% passing, but PHP CodeSniffer is.
Both the PHP CodeSniffer and ESLint configurations are in git. PHP CodeSniffer has been given a PSR-12 configuration.
Additional changes have been made to the CQC so most of the PSR-12 checks can be done by the CQC itself. PHP CodeSniffer is more for very detailed text formatting stuff beyond the simple bracing and operator checks that the CQC does.
The codebook_standards document is updated to reflect PHP CodeSniffer and ESLint as official sources for code beautification and formatting guidance, as well as PSR-12.
We no longer reference PHP CS Fixer.
Running PHP CodeSniffer beautification over the codebase (at time of writing, and barring third party code) produces zero changes, as I have manually gone over to make sure it is 100% compliant.