Most of our projects are WordPress, and while we agree with the most of coding standards it sets, there are some which we disagree on and do not want to use in our own private projects. Somehow pieces of those disagreements still end up in the codebase due to devs copypasting solutions they found online, and I’d like to prevent that with phpcs. Not only because copypasting is questionable (the quality of these codesnippets is often terrible), but because it’s harder to read and edit.
This is the way WordPress tells you to do it:
fn_call( array( 1, 2, 3 ) );
This is the way we do it:
fn_call([(1, 2, 3)]);
I found a way to exclude these rules from the WordPress coding standards
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" /> <exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" /> <exclude name="WordPress.Arrays.ArrayDeclaration.NoSpaceAfterOpenParenthesis" />
but how do I enforce that there should be no spaces? I can’t find anything on that.