Aym*_*Dev 1 php editor phpstorm
我前段时间编辑了代码样式设置,但我“破坏”了一些关于短数组语法的内容,我找不到如何修复。
例如,假设我调用一个函数并传递一个数组:
my_func([]);
Run Code Online (Sandbox Code Playgroud)
如果我按Enter在多行上写入数组元素,我会得到这个(我觉得这很糟糕):
my_func([
]);
Run Code Online (Sandbox Code Playgroud)
my_func([
]);
Run Code Online (Sandbox Code Playgroud)
我在 Ubuntu 上使用 PhpStorm 2019.3。
编辑:这里是设置的导出:
<code_scheme name="Default" version="173">
<PHPCodeStyleSettings>
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="ALIGN_ASSIGNMENTS" value="true" />
<option name="ALIGN_INLINE_COMMENTS" value="true" />
<option name="CONCAT_SPACES" value="false" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
<option name="ALIGN_CLASS_CONSTANTS" value="true" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
<option name="NAMESPACE_BRACE_STYLE" value="2" />
<option name="PLACE_PARENS_FOR_CONSTRUCTOR" value="1" />
</PHPCodeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Shell Script">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="yaml">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
Run Code Online (Sandbox Code Playgroud)
检查选项卡上的内容——应该是或...Settings/Preferences | Editor | Code Style | PHP | Wrapping and Braces下的选项之一Function/constructor call argumentsArray initializer nodes
根据您导出的代码样式文件,这将是Function/constructor call arguments | Align when multiline一个选项。另外两个控制 after(和 before 的空行)。