[英]How Visual Studio Code will use to format PHP like PhpStorm?
I have used phpfmt
extension to indent the code which formatted code like this我使用phpfmt
扩展来缩进格式化代码的代码
'cms' => [
'class' => 'yii2mod\cms\Module',
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'cms',
],
And when I merge it return the code intend error.当我合并它时返回代码意图错误。 I need the code to format like PhpStorm did this我需要像 PhpStorm 那样格式化的代码
'cms' => [
'class' => 'yii2mod\cms\Module',
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'cms',
],
Which extension and how I use it in Visual Studio Code to get rid of PHP intended error in Visual Studio Code?哪个扩展以及我如何在 Visual Studio Code 中使用它来消除 Visual Studio Code 中的 PHP 预期错误?
You can use the following settings that i use for my development env, would be closest to what you are looking for.您可以使用我用于我的开发环境的以下设置,最接近您正在寻找的设置。
Add the following into your settings.json
in VSCode.将以下内容添加到 VSCode 的settings.json
中。
//phpfmt
"phpfmt.php_bin": "php",
"phpfmt.passes": [
"AlignPHPCode",
"AlignTypeHint",
"AddMissingParentheses",
"ConvertOpenTagWithEcho",
"DocBlockToComment",
"IndentTernaryConditions",
"JoinToImplode",
"PSR2KeywordsLowerCase",
"PSR2LnAfterNamespace",
"PSR2CurlyOpenNextLine",
"PSR2ModifierVisibilityStaticOrder",
"PSR2SingleEmptyLineAndStripClosingTag",
"ReindentSwitchBlocks",
"RemoveUseLeadingSlash",
"StripExtraCommaInArray",
"SpaceBetweenMethods",
],
"phpfmt.exclude": [
"ReindentComments",
"StripNewlineWithinClassBody"
],
"phpfmt.psr2": false,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.