Closed nisarul-dev closed 1 year ago
Hello, good morning.
@kokororin has indicated I could directly help with this issue. Under the hood, vscode-phpfmt uses the package https://github.com/driade/phpfmt8 that I currently maintain.
Please feel free to open and issue there so we can discuss this update you need. There's nothing like this at this moment (WP special formatters) but I think we could handle it.
Thanks.
Thank you for the kind information and valuable suggestion. I am opening an issue under https://github.com/driade/phpfmt8
Thanks.
Hello, good morning.
This issue has been solved in https://github.com/driade/phpfmt8/issues/33
I've added a new option in the config, "--wp", which works like PSR2 but adding the formatting for the spaces you asked for.
I don't know much about WP coding standards, please indicate if there's any other update I should make.
Thanks.
Hello,
You can upgrade fmt by using such vscode command:
F1
-> phpfmt: Upgrade fmt.phar or fmt.stub.php
Then add "--wp" to settings.json
.
Issues:
As per WordPress Coding Standard, an array should be defined like this: (space at the beginning and closing of parentheses or square brackets) Source: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#declaring-arrays
As per WordPress Coding Standard, spaces while accessing array items will be like this: Source: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#space-usage
Please, solve this issue by introducing some configurations regarding "[]" (Square brackets) so that WordPress Developers can write PHP and use the vscode-phpfmt with more ease.
Thank you.