I have used phpfmt
extension to indent the code which formatted code like this
'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
'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?
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.
{
"phpfmt.php_bin": "php",
"phpfmt.passes": [
"AlignPHPCode",
"AlignTypeHint",
"AlignDoubleArrow",
"AddMissingParentheses",
"ConvertOpenTagWithEcho",
"DocBlockToComment",
"IndentTernaryConditions",
"JoinToImplode",
"PSR2KeywordsLowerCase",
"PSR2LnAfterNamespace",
"PSR2CurlyOpenNextLine",
"PSR2ModifierVisibilityStaticOrder",
"PSR2SingleEmptyLineAndStripClosingTag",
"ReindentSwitchBlocks",
"RemoveUseLeadingSlash",
"StripExtraCommaInArray",
"SpaceBetweenMethods",
],
"phpfmt.exclude": [
"ReindentComments",
"StripNewlineWithinClassBody"
],
"phpfmt.psr2": false
}