1. composer.json (composer.lock must be exist)
{
"name": "project-name",
"description": "...",
"require": {
},
"require-dev": {
"wp-coding-standards/wpcs": "^2.3"
},
"scripts": {
"post-install-cmd": [
"phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs",
"phpcs --config-set default_standard WordPress"
],
"test": [
"phpcs --ignore=./vendor ./"
],
"fix": [
"phpcbf --ignore=./vendor ./"
]
}
}
Code language: JSON / JSON with Comments (json)
2. Install the VS Code Extension
PHP Sniffer & Beautifier: https://marketplace.visualstudio.com/items?itemName=ValeryanM.vscode-phpsab
Leave a Reply