PHP-Parser
PHP-Parser copied to clipboard
Improve printer compatibility with PSR-2/12
Fixed whitespace before Closure "use" statement.
Before:
function ($arg) use($var) { ... }
After:
function ($arg) use ($var) { ... }
// ^ whitespace added
Reason: PSR-2 https://www.php-fig.org/psr/psr-2/#6-closures
Removed whitespace prefix before typehint colon.
Before:
function example() : void { ... }
After:
function example(): void { ... }
// ^ whitespace removed
Reason: PSR-12 https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md#45-method-and-function-arguments
Generally this looks reasonable, but I don't think I can merge this into 4.x due to the backwards compatibility break this causes.
I propose to merge this PR into the future 4.3 version.
Test fails associated with incorrect work on PHP 7.4
Variants of these changes have been implemented for the next major in the meantime.