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
Update FunctionCallSignatureSniff to allow non-isolated parentheses on multiline calls #330
Conversation
…neCallParentheses
…hen requireIsolatedMultilineCallParentheses
I think this option is actually too specific, especially given it sounds generic (closing brace doesnt need to be isolated) but actually it is checking a whitelist of tokens. But what I can do is stop this indent error from being printed for the closing brace if the closing brace is already throwing an error about not being on a line by itself. Then you can mute the closing brace issue but the indent checks will still work correctly. What you don't get is the guarantee that the token before the closing brace is a curly brace of parenthesis, but you could write another sniff if you want to specifically check for that. Does that sound like it would work? |
@gsherwood thanks a lot for the reply. To recap, the problem is with <?php
foreach ( $core_options as $option_name => $real_value ) {
add_filter( "pre_option_{$option_name}", function( $value ) use ( $real_current_blog_id, $real_value ) {
if ( get_current_blog_id() == $real_current_blog_id ) {
return $real_value + 1;
} else {
return $value;
}
} );
} Yields the following:
So you're saying that you could make it so that the <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule> Is that right? |
If so, it sounds perfect. |
@westonruter yes, this is what I was suggesting. I'll commit this change so you can test that out. |
I've committed this change here: efd8cd9 Please let me know if it doesn't work out for you. |
Looking good! Thanks! |
This allows the following code block to be valid if the new property
requireIsolatedMultilineCallParentheses
is set tofalse
on thePEAR.Functions.FunctionCallSignature
sniff:See WordPress/WordPress-Coding-Standards#272