PhpStorm数组未在行开始处关闭 [英] PhpStorm array is not closing on line start

查看:99
本文介绍了PhpStorm数组未在行开始处关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间我编辑了代码样式设置,但是我 broke 关于短数组语法的一些知识,我找不到解决方法。

I edited the code styles settings some time ago but I "broke" something about the short array syntax which I can't find how to fix.

例如,假设我调用一个函数并传递一个数组:

For example, let's say I call a function and pass an array:

my_func([]);

如果按 Enter 在多行上写数组元素,我得到这(我觉得很糟糕):

If I press Enter to write array elements on multiple lines, I get this (which I find awful):

my_func([

        ]);



我应该在设置中进行哪些更改才能使阵列像


What should I change in the settings in order to get my array like this:

my_func([

]);

我在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>


推荐答案

Settings /首选项|编辑器代码样式| PHP |包装和花括号标签-应该是函数/构造函数调用参数数组初始化程序节点中的选项之一。 code> ...

Check stuff at Settings/Preferences | Editor | Code Style | PHP | Wrapping and Braces tab -- should be one of the options under Function/constructor call arguments or Array initializer nodes...

基于导出的代码样式文件,该文件将为 Function / constructor调用参数|多行时对齐选项。其他两个在之后和之后控制空行。

Based on your exported Code Style file, that would be Function/constructor call arguments | Align when multiline option. Other two are controlling empty lines after ( and before ).

这篇关于PhpStorm数组未在行开始处关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆