It adds and removes spaces where needed in square brackets and around operators. The add_operator_space() formatter was copied from https://github.com/cmrcx/phptidy
DocBlock params
PhpTidy creates two spaces after the parameter type declaration.
/**
* @param string $parameter Parameter.
*/
The padding for the type is hardcoded at 7. This PR calculates the real padding needed.
Example before this PR.
In this example there was only one space used between all the types, variables and descriptions. After running PhpTidy the spaces for $var2 are not in line with $variable.
This pull request fixes whitespace issues with the WordPress Coding Standards for PHP_CodeSniffer rules.
It adds and removes spaces where needed in square brackets and around operators. The
add_operator_space()
formatter was copied from https://github.com/cmrcx/phptidyExample before:
And after:
DocBlock params PhpTidy creates two spaces after the parameter type declaration.
The padding for the type is hardcoded at 7. This PR calculates the real padding needed.
Example before this PR. In this example there was only one space used between all the types, variables and descriptions. After running PhpTidy the spaces for
$var2
are not in line with$variable
.Example after running PhpTidy with this pull request: