6
6
import com .jetbrains .php .lang .PhpFileType ;
7
7
import com .jetbrains .php .lang .PhpLanguage ;
8
8
import com .jetbrains .php .lang .formatter .PhpCodeStyleSettings ;
9
+ import com .jetbrains .php .refactoring .PhpNameStyle ;
9
10
10
11
/**
11
12
* @author Reedy
@@ -47,19 +48,40 @@ public void apply(CodeStyleSettings settings) {
47
48
commonSettings .FOR_BRACE_FORCE = 3 ;
48
49
commonSettings .DOWHILE_BRACE_FORCE = 3 ;
49
50
commonSettings .WHILE_BRACE_FORCE = 3 ;
50
-
51
- // Chop down if long
51
+
52
52
commonSettings .ARRAY_INITIALIZER_WRAP = 2 ;
53
- commonSettings .CALL_PARAMETERS_WRAP = 2 ;
53
+ commonSettings .ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = true ;
54
+ commonSettings .ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = true ;
55
+
56
+ commonSettings .CALL_PARAMETERS_WRAP = 5 ;
57
+ commonSettings .METHOD_PARAMETERS_WRAP = 5 ;
58
+
59
+ commonSettings .EXTENDS_KEYWORD_WRAP = 1 ;
60
+ commonSettings .EXTENDS_LIST_WRAP = 5 ;
61
+
62
+ commonSettings .CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true ;
63
+ commonSettings .CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = true ;
54
64
55
- // Wrap if long
56
- commonSettings .METHOD_CALL_CHAIN_WRAP = 1 ;
65
+ commonSettings .METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE = true ;
66
+ commonSettings .METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE = true ;
67
+
68
+ commonSettings .METHOD_CALL_CHAIN_WRAP = 5 ;
69
+ commonSettings .BINARY_OPERATION_WRAP = 5 ;
70
+ commonSettings .TERNARY_OPERATION_WRAP = 1 ;
71
+ commonSettings .TERNARY_OPERATION_SIGNS_ON_NEXT_LINE = true ;
72
+
73
+ commonSettings .FOR_STATEMENT_WRAP = 1 ;
74
+ commonSettings .FOR_STATEMENT_LPAREN_ON_NEXT_LINE = true ;
75
+ commonSettings .FOR_STATEMENT_RPAREN_ON_NEXT_LINE = true ;
57
76
58
77
// Hard wrap at 120 characters
59
78
commonSettings .RIGHT_MARGIN = 120 ;
79
+
80
+ // Doesn't seem to exist?
81
+ // commonSettings.SOFT_MARGINS = 100;
60
82
61
- // Keep line breaks when reformatting
62
- commonSettings .KEEP_LINE_BREAKS = true ;
83
+ // Don't keep line breaks when reformatting
84
+ commonSettings .KEEP_LINE_BREAKS = false ;
63
85
64
86
PhpCodeStyleSettings phpSettings = settings .getCustomSettings (PhpCodeStyleSettings .class );
65
87
phpSettings .LOWER_CASE_BOOLEAN_CONST = true ;
@@ -68,11 +90,15 @@ public void apply(CodeStyleSettings settings) {
68
90
phpSettings .KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE = true ;
69
91
phpSettings .SPACE_AFTER_COLON_IN_RETURN_TYPE = true ;
70
92
phpSettings .SPACE_BEFORE_COLON_IN_RETURN_TYPE = true ;
93
+ phpSettings .IF_LPAREN_ON_NEXT_LINE = true ;
94
+ phpSettings .IF_RPAREN_ON_NEXT_LINE = true ;
95
+ phpSettings .VARIABLE_NAMING_STYLE = PhpNameStyle .Style .CAMEL_CASE ;
71
96
72
97
phpSettings .PHPDOC_BLANK_LINE_BEFORE_TAGS = true ;
73
98
phpSettings .PHPDOC_KEEP_BLANK_LINES = true ;
74
99
phpSettings .PHPDOC_BLANK_LINES_AROUND_PARAMETERS = true ;
75
100
phpSettings .PHPDOC_WRAP_LONG_LINES = true ;
101
+ phpSettings .SORT_PHPDOC_ELEMENTS = false ;
76
102
77
103
CodeStyleSettings .IndentOptions indentOptions = settings .getIndentOptions (PhpFileType .INSTANCE );
78
104
indentOptions .USE_TAB_CHARACTER = true ;
0 commit comments