You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PEAR.Functions.FunctionCallSignature allows to configure how many spaces are required after the open parenthesis and before the close parenthesis through the $requiredSpacesAfterOpen and $requiredSpacesBeforeClose properties.
For a single line function call without parameters, the behaviour is inconsistent however when these properties are set to something other than 0.
If there are no tokens between the parenthesis, it bows out of the processSingleLineCall() method.
If there is only a whitespace token between the parenthesis, but this contains more than one space, it will report this and the auto-fixer will correct it to the expected 1 space.
If there is a whitespace token between the parenthesis with only one space, it will stay silent.
Expected behaviour:
Either always remove the whitespace between the parenthesis if there are no parameters
Or always correct it to the expected nr of spaces
Example code:
ms_cookie_constants(); // Is ignored.ms_cookie_constants( ); // Is ignored as has one space.ms_cookie_constants( ); // Gets corrected to one space.
I'd be happy to send in a PR to make the behaviour consistent, but would want to know which of the expected behaviours is desired.
gsherwood
changed the title
Inconsistency in the PEAR.Functions.FunctionCallSignature sniff icm no params
PEAR.Functions.FunctionCallSignature enforces spaces when no arguments if required spaces is not 0
Oct 12, 2017
This was obviously something I didn't consider when adding that option for setting the required spaces. Now, if the function contains no args and no comments, the required spaces is reset back to zero. Thanks for reporting this.
The
PEAR.Functions.FunctionCallSignature
allows to configure how many spaces are required after the open parenthesis and before the close parenthesis through the$requiredSpacesAfterOpen
and$requiredSpacesBeforeClose
properties.For a single line function call without parameters, the behaviour is inconsistent however when these properties are set to something other than
0
.Current behaviour:
processSingleLineCall()
method.1
space.Expected behaviour:
Example code:
I'd be happy to send in a PR to make the behaviour consistent, but would want to know which of the expected behaviours is desired.
Related: WordPress/WordPress-Coding-Standards#970
The text was updated successfully, but these errors were encountered: