将如下内容保存为 .xml 格式
<code_scheme name="Default"> <PHPCodeStyleSettings> <option name="ALIGN_KEY_VALUE_PAIRS" value="true" /> <option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" /> <option name="ALIGN_PHPDOC_COMMENTS" value="true" /> <option name="ALIGN_ASSIGNMENTS" value="true" /> <option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" /> <option name="PHPDOC_WRAP_LONG_LINES" value="true" /> <option name="LOWER_CASE_BOOLEAN_CONST" value="true" /> <option name="LOWER_CASE_NULL_CONST" value="true" /> <option name="ELSE_IF_STYLE" value="COMBINE" /> <option name="ALIGN_CLASS_CONSTANTS" value="true" /> <option name="KEEP_BLANK_LINES_AFTER_LBRACE" value="1" /> <option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" /> <option name="PHPDOC_USE_FQCN" value="true" /> </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="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> <option name="KEEP_BLANK_LINES_IN_CODE" value="1" /> <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" /> <option name="BLANK_LINES_BEFORE_PACKAGE" value="0" /> <option name="BLANK_LINES_AFTER_PACKAGE" value="1" /> <option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" /> </codeStyleSettings> </code_scheme>
设置里面找到:Editor --> Code Style --> PHP 。右侧选择导入XML。
设置里面搜索“Reformat”,查看快捷键,也可以自己设置