New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiline foreach in Squiz.ControlStructures.ForEachLoopDeclaration #3907
Comments
@Daimona If you want multi-line control structures, the |
Thank you for the suggestion. Unfortunately, the only thing that I wanted to use the ForEachLoopDeclaration for is the spacing around the |
The
Squiz.ControlStructures.ForEachLoopDeclaration
sniff fails to account for multiline foreach loops when checking the space around theas
keyword. If you simply enable the sniff and run it on this code (withtabWidth
= 4):it says:
And similarly, for this code:
Regardless of where the
as
keyword is placed, there is no way to have a multiline foreach assignment with this sniff enabled. This is especially problematic if any side ofas
is particularly long (e.g., a function call, or an array destructuring expression).The
Squiz.ControlStructures.ForLoopDeclaration
sniff provides theignoreNewlines
option to ignore multi-linefor
conditions. It would be nice to have something similar here.The text was updated successfully, but these errors were encountered: