I have a developer who wants to use comma-first code style in a PHP codebase to make it easier to comment out variables without having to move the comma around.
PHPStorm, configured to conform to PSR-2 standard, automatically reformats the following code:
<?php
$example = new Triceratops([
'option1' => 'green'
, 'option2' => 'purple'
, 'option3' => 'orange'
, 'option4' => 'yellow'
, 'option5' => $userSubmittedColor
, 'option6' => 'cyan'
]);
to this:
<?php
$example = new Triceratops([
'option1' => 'green'
,
'option2' => 'purple'
,
'option3' => 'orange'
,
'option4' => 'yellow'
,
'option5' => $userSubmittedColor
,
'option6' => 'cyan'
]);
Google returns many references to `comma-first coding about javascript, but I didn't find anything about using it in PHP.
Does comma-first code conflict with PSR-2? If not, how do you configure PhpStorm to use it, or would this be considered a bug?