2

I'm looking for a rule (or a combination of a multiple rules) to wrap super long associative arrays. Maybe based on max line length? (I'm not a CS Fixer expert, sorry if its a dumb idea)

// Remains Untouched
$foo = ['bar' => $bar, 'biz' => $biz];

// Long Assoc Arrays are wrapped and stacked
$foo = ['bar' => $bar, 'biz' => $biz, 'anotherSweetKey' => $totallRadVar, 'longEnoughToBreakLineLengthMax' => $something ];

$foo = [
    'bar' => $bar,
    'biz' => $biz,
    'anotherSweetKey' => $totallRadVar,
    'longEnoughToBreakLineLengthMax' => $something
];

If anyone knows whether this exists already, I'd love a clue on which rule to use. Thanks.

slowFooMovement
  • 498
  • 5
  • 14
  • 1
    php-cs-fixer has a chat channel for such kind of questions. It generally is not that flexible with rules and combinations, multilines etc.. For more fine-controlled handling, please consider PHP_CodeSniffer instead. You can also combine both. – hakre Sep 11 '21 at 20:25
  • @hakre thanks for the tip. Do you have a link to that chat channel? Is it on slack? – slowFooMovement Sep 11 '21 at 22:13
  • 1
    It's linked in the readme: https://gitter.im/PHP-CS-Fixer/Lobby – hakre Sep 11 '21 at 22:20

0 Answers0