list() obeys the Function/constructor call wrapping setting, and using [] like this is not even considered an array initializer.
Not sure if there's a way for PhpStorm to tell array destructuring from a plain array, but it's definitely worth taking a look at. Please submit a feature request: https://youtrack.jetbrains.com/newIssue?project=WI
"Not sure if there's a way for PhpStorm to tell array destructuring from a plain array"
Actually, that's the problem - it is telling the difference because if this was a plain array, it would format it as I indicated. We want our "structuring and destructuring" of arrays to look the same:
I just started using the short syntax for list() ([]), and PS forces the use in foreach to be like this, how awful!
By the chance, do you have any non-default settings in "Code Style > PHP > Wrapping and braces"? (f.e. in "For()/Foreach() statements" section)
Would it be possible to provide a full example that we could try to reformat?
Wow, that was a terrible post. What I meant to say is the options are these (using the settings you indicate), all which suck for us:
foreach($aCase5SkeysDates as [$iCase5Skey, $sTreatmentDate]){But I see no way for us to get this:
However, if we use the long format for list(), this works:
But we are moving away from that to [].
Currently, there's no way to configure that.
list()obeys the Function/constructor call wrapping setting, and using[]like this is not even considered an array initializer.Not sure if there's a way for PhpStorm to tell array destructuring from a plain array, but it's definitely worth taking a look at. Please submit a feature request: https://youtrack.jetbrains.com/newIssue?project=WI
"Not sure if there's a way for PhpStorm to tell array destructuring from a plain array"
Actually, that's the problem - it is telling the difference because if this was a plain array, it would format it as I indicated. We want our "structuring and destructuring" of arrays to look the same:
$a =
[
1,
2,
3
];
[
$a,
$b,
$c
]
= $a;
I'll submit the request.
https://youtrack.jetbrains.com/issue/WI-47343?project=WI