安裝擴展
phpformatter

安裝完成后,將文檔進行格式化后,就會變成如下的代碼格式

安裝插件后,也可以對格式化進行配置
//打印日志信息,用於調試 "phpformatter.logging": true, //不使用composer方式 "phpformatter.composer": false, //添加自定義參數,默認的參數level已經在新版本中移出所以會導致運行出錯 //RULES=[@PSR1,@PSR2,@Symfony] //source:https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage "phpformatter.arguments": [ "--rules=@Symfony" ], // Should point to php-cs-fixer.phar file, if you have installed this manually (without Composer). Should include .phar extension. // php-cs-fixer.phar路徑,使用composer方式時可以不填 "phpformatter.pharPath": "C:/phpStudy/PHPTutorial/php/php-7.2.1-nts/php-cs-fixer-v2.phar", // If the pharPath is set, and you are not using Composer, and you haven't added PHP to your PATH, this should point to the php.exe file. // php路徑,使用composer方式時可以不填 "phpformatter.phpPath": "C:/phpStudy/PHPTutorial/php/php-7.2.1-nts/php.exe", "php.validate.executablePath": "C:/phpStudy/PHPTutorial/php/php-7.2.1-nts/php.exe"
