Closed phil-davis closed 2 months ago
This example of a diff made me think of this: https://github.com/owncloud/ocis-php-sdk/pull/249/files#diff-82277ffad27771b61ef747676ab6b941eff7ed78d53b2633a6e5c29fe202309bR100-R101
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
66.0% Coverage on New Code
0.0% Duplication on New Code
@individual-it @amrita-shrestha what do you think? Is this a reasonable coding standard to use?
In "modern" PHP, you can put a trailing comma at the end of "lists of things" such as an array, function parameter list, function call list, etc.
Without the trailing comma, you have something like:
And when you want to add "d" to the list, you have to also put a comma after "c". That makes extra lines in the diff listing, and so the "blame" history in Git is not as effective. And it is a bit of cognitive load to think to add the comma after "c" then add "d". Although a modern IDE should do it for you these days.
The trailing comma is an optional thing, not specified either way in PSR-12. But we could decide to be consistent and always use the trailing comma.
These are the changes that php-cs-fixer makes.