If you have installed "php cs fixer" vscode extension, the following will make it work on saving your php file
extension link: https://marketplace.visualstudio.com/items/?itemName=junstyle.php-cs-fixer
composer global require friendsofphp/php-cs-fixer --dev