Fix your Wordpress PHP code with PHP CS Fixer bin (https://github.com/FriendsOfPHP/PHP-CS-Fixer).
wp package install [email protected]:opsone/wp-beautiful-php.git
-
wp beautiful php --what=core
: Fix all php files in the Wordpress Core. (exclude : wp-content/themes/) -
wp beautiful php --what=themes
: Fix all php files in wp-content/themes folder. -
wp beautiful php --what=themes --themename=mytheme
: Fix all php files in 'mytheme' theme folder.
You can create a wp-cli.yml file to add some options to commands. For example, you can exclude some files or folders.
php-fixer:
excludes:
files:
- 'index.php'
- ...
folders:
- 'wp-includes'
- 'wp-admin'
- ...
Some Wordpress files and folders are excluded by default :
wp-content/plugins
wp-config.php
You can set some files or folders to exclude with the wp-cli.yml option file.
Some PHP CS Fixer options are set by default :
'single_quote' => true
'trim_array_spaces' => true
'no_useless_else' => true
'elseif' => true
'align_double_arrow' => true
'align_equals' => true
Please refer to the PHP CS Fixer Github documentation to get more informations about that.
wp package uninstall opsone/wp-beautiful-php