This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 258883
Collapse All | Expand All

(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/CodeStyle.java (+17 lines)
Lines 124-129 Link Here
124
        return BracePlacement.valueOf(placement);
124
        return BracePlacement.valueOf(placement);
125
    }
125
    }
126
126
127
    public BracePlacement getAnonymousClassBracePlacement() {
128
        String placement = preferences.get(ANONYMOUS_CLASS_BRACE_PLACEMENT, getDefaultAsString(ANONYMOUS_CLASS_BRACE_PLACEMENT));
129
        return BracePlacement.valueOf(placement);
130
    }
131
127
    public BracePlacement getMethodDeclBracePlacement() {
132
    public BracePlacement getMethodDeclBracePlacement() {
128
        String placement = preferences.get(METHOD_DECL_BRACE_PLACEMENT, getDefaultAsString(METHOD_DECL_BRACE_PLACEMENT));
133
        String placement = preferences.get(METHOD_DECL_BRACE_PLACEMENT, getDefaultAsString(METHOD_DECL_BRACE_PLACEMENT));
129
        return BracePlacement.valueOf(placement);
134
        return BracePlacement.valueOf(placement);
Lines 264-269 Link Here
264
        return preferences.getBoolean(SPACE_BEFORE_FINALLY, getDefaultAsBoolean(SPACE_BEFORE_FINALLY));
269
        return preferences.getBoolean(SPACE_BEFORE_FINALLY, getDefaultAsBoolean(SPACE_BEFORE_FINALLY));
265
    }
270
    }
266
271
272
    public boolean spaceBeforeAnonymousClassParen() {
273
        return preferences.getBoolean(SPACE_BEFORE_ANONYMOUS_CLASS_PAREN, getDefaultAsBoolean(SPACE_BEFORE_ANONYMOUS_CLASS_PAREN));
274
    }
275
267
    public boolean spaceBeforeMethodDeclParen() {
276
    public boolean spaceBeforeMethodDeclParen() {
268
        return preferences.getBoolean(SPACE_BEFORE_METHOD_DECL_PAREN, getDefaultAsBoolean(SPACE_BEFORE_METHOD_DECL_PAREN));
277
        return preferences.getBoolean(SPACE_BEFORE_METHOD_DECL_PAREN, getDefaultAsBoolean(SPACE_BEFORE_METHOD_DECL_PAREN));
269
    }
278
    }
Lines 328-333 Link Here
328
        return preferences.getBoolean(SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_CLASS_DECL_LEFT_BRACE));
337
        return preferences.getBoolean(SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_CLASS_DECL_LEFT_BRACE));
329
    }
338
    }
330
339
340
    public boolean spaceBeforeAnonymousClassLeftBrace() {
341
        return preferences.getBoolean(SPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE));
342
    }
343
331
    public boolean spaceBeforeMethodDeclLeftBrace() {
344
    public boolean spaceBeforeMethodDeclLeftBrace() {
332
        return preferences.getBoolean(SPACE_BEFORE_METHOD_DECL_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_METHOD_DECL_LEFT_BRACE));
345
        return preferences.getBoolean(SPACE_BEFORE_METHOD_DECL_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_METHOD_DECL_LEFT_BRACE));
333
    }
346
    }
Lines 372-377 Link Here
372
        return preferences.getBoolean(SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE));
385
        return preferences.getBoolean(SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE, getDefaultAsBoolean(SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE));
373
    }
386
    }
374
387
388
    public boolean spaceWithinAnonymousClassParens() {
389
        return preferences.getBoolean(SPACE_WITHIN_ANONYMOUS_CLASS_PARENS, getDefaultAsBoolean(SPACE_WITHIN_ANONYMOUS_CLASS_PARENS));
390
    }
391
375
    public boolean spaceWithinMethodDeclParens() {
392
    public boolean spaceWithinMethodDeclParens() {
376
        return preferences.getBoolean(SPACE_WITHIN_METHOD_DECL_PARENS, getDefaultAsBoolean(SPACE_WITHIN_METHOD_DECL_PARENS));
393
        return preferences.getBoolean(SPACE_WITHIN_METHOD_DECL_PARENS, getDefaultAsBoolean(SPACE_WITHIN_METHOD_DECL_PARENS));
377
    }
394
    }
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/FmtOptions.java (+7 lines)
Lines 103-108 Link Here
103
    public static final String RIGHT_MARGIN = SimpleValueNames.TEXT_LIMIT_WIDTH;
103
    public static final String RIGHT_MARGIN = SimpleValueNames.TEXT_LIMIT_WIDTH;
104
    public static final String INITIAL_INDENT = "init.indent"; //NOI18N
104
    public static final String INITIAL_INDENT = "init.indent"; //NOI18N
105
    public static final String CLASS_DECL_BRACE_PLACEMENT = "classDeclBracePlacement"; //NOI18N
105
    public static final String CLASS_DECL_BRACE_PLACEMENT = "classDeclBracePlacement"; //NOI18N
106
    public static final String ANONYMOUS_CLASS_BRACE_PLACEMENT = "anonymousClassBracePlacement"; //NOI18N
106
    public static final String METHOD_DECL_BRACE_PLACEMENT = "methodDeclBracePlacement"; //NOI18N
107
    public static final String METHOD_DECL_BRACE_PLACEMENT = "methodDeclBracePlacement"; //NOI18N
107
    public static final String IF_BRACE_PLACEMENT = "ifBracePlacement"; //NOI18N
108
    public static final String IF_BRACE_PLACEMENT = "ifBracePlacement"; //NOI18N
108
    public static final String FOR_BRACE_PLACEMENT = "forBracePlacement"; //NOI18N
109
    public static final String FOR_BRACE_PLACEMENT = "forBracePlacement"; //NOI18N
Lines 134-139 Link Here
134
    public static final String SPACE_BEFORE_ELSE = "spaceBeforeElse"; //NOI18N
135
    public static final String SPACE_BEFORE_ELSE = "spaceBeforeElse"; //NOI18N
135
    public static final String SPACE_BEFORE_CATCH = "spaceBeforeCatch"; //NOI18N
136
    public static final String SPACE_BEFORE_CATCH = "spaceBeforeCatch"; //NOI18N
136
    public static final String SPACE_BEFORE_FINALLY = "spaceBeforeFinally"; //NOI18N
137
    public static final String SPACE_BEFORE_FINALLY = "spaceBeforeFinally"; //NOI18N
138
    public static final String SPACE_BEFORE_ANONYMOUS_CLASS_PAREN = "spaceBeforeAnonymousClassParen"; //NOI18N
137
    public static final String SPACE_BEFORE_METHOD_DECL_PAREN = "spaceBeforeMethodDeclParen"; //NOI18N
139
    public static final String SPACE_BEFORE_METHOD_DECL_PAREN = "spaceBeforeMethodDeclParen"; //NOI18N
138
    public static final String SPACE_BEFORE_METHOD_CALL_PAREN = "spaceBeforeMethodCallParen"; //NOI18N
140
    public static final String SPACE_BEFORE_METHOD_CALL_PAREN = "spaceBeforeMethodCallParen"; //NOI18N
139
    public static final String SPACE_BEFORE_IF_PAREN = "spaceBeforeIfParen"; //NOI18N
141
    public static final String SPACE_BEFORE_IF_PAREN = "spaceBeforeIfParen"; //NOI18N
Lines 150-155 Link Here
150
    public static final String SPACE_AROUND_KEY_VALUE_OPS = "spaceAroundKeyValueOps"; //NOI18N
152
    public static final String SPACE_AROUND_KEY_VALUE_OPS = "spaceAroundKeyValueOps"; //NOI18N
151
    public static final String SPACE_AROUND_OBJECT_OPS = "spaceAroundObjectOps"; //NOI18N
153
    public static final String SPACE_AROUND_OBJECT_OPS = "spaceAroundObjectOps"; //NOI18N
152
    public static final String SPACE_BEFORE_CLASS_DECL_LEFT_BRACE = "spaceBeforeClassDeclLeftBrace"; //NOI18N
154
    public static final String SPACE_BEFORE_CLASS_DECL_LEFT_BRACE = "spaceBeforeClassDeclLeftBrace"; //NOI18N
155
    public static final String SPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE = "spaceBeforeAnonymousClassLeftBrace"; //NOI18N
153
    public static final String SPACE_BEFORE_METHOD_DECL_LEFT_BRACE = "spaceBeforeMethodDeclLeftBrace"; //NOI18N
156
    public static final String SPACE_BEFORE_METHOD_DECL_LEFT_BRACE = "spaceBeforeMethodDeclLeftBrace"; //NOI18N
154
    public static final String SPACE_BEFORE_IF_LEFT_BRACE = "spaceBeforeIfLeftBrace"; //NOI18N
157
    public static final String SPACE_BEFORE_IF_LEFT_BRACE = "spaceBeforeIfLeftBrace"; //NOI18N
155
    public static final String SPACE_BEFORE_ELSE_LEFT_BRACE = "spaceBeforeElseLeftBrace"; //NOI18N
158
    public static final String SPACE_BEFORE_ELSE_LEFT_BRACE = "spaceBeforeElseLeftBrace"; //NOI18N
Lines 162-167 Link Here
162
    public static final String SPACE_BEFORE_FINALLY_LEFT_BRACE = "spaceBeforeFinallyLeftBrace"; //NOI18N
165
    public static final String SPACE_BEFORE_FINALLY_LEFT_BRACE = "spaceBeforeFinallyLeftBrace"; //NOI18N
163
    public static final String SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE = "spaceBeforeUseTraitBodyLeftBrace"; //NOI18N
166
    public static final String SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE = "spaceBeforeUseTraitBodyLeftBrace"; //NOI18N
164
    public static final String SPACE_WITHIN_ARRAY_DECL_PARENS = "spaceWithinArrayDeclParens"; //NOI18N
167
    public static final String SPACE_WITHIN_ARRAY_DECL_PARENS = "spaceWithinArrayDeclParens"; //NOI18N
168
    public static final String SPACE_WITHIN_ANONYMOUS_CLASS_PARENS = "spaceWithinAnonymousClassParens"; //NOI18N
165
    public static final String SPACE_WITHIN_METHOD_DECL_PARENS = "spaceWithinMethodDeclParens"; //NOI18N
169
    public static final String SPACE_WITHIN_METHOD_DECL_PARENS = "spaceWithinMethodDeclParens"; //NOI18N
166
    public static final String SPACE_WITHIN_METHOD_CALL_PARENS = "spaceWithinMethodCallParens"; //NOI18N
170
    public static final String SPACE_WITHIN_METHOD_CALL_PARENS = "spaceWithinMethodCallParens"; //NOI18N
167
    public static final String SPACE_WITHIN_IF_PARENS = "spaceWithinIfParens"; //NOI18N
171
    public static final String SPACE_WITHIN_IF_PARENS = "spaceWithinIfParens"; //NOI18N
Lines 264-269 Link Here
264
            {INITIAL_INDENT, "0"}, //NOI18N
268
            {INITIAL_INDENT, "0"}, //NOI18N
265
269
266
            {CLASS_DECL_BRACE_PLACEMENT, OBRACE_SAMELINE},
270
            {CLASS_DECL_BRACE_PLACEMENT, OBRACE_SAMELINE},
271
            {ANONYMOUS_CLASS_BRACE_PLACEMENT, OBRACE_SAMELINE},
267
            {METHOD_DECL_BRACE_PLACEMENT, OBRACE_SAMELINE},
272
            {METHOD_DECL_BRACE_PLACEMENT, OBRACE_SAMELINE},
268
            {IF_BRACE_PLACEMENT, OBRACE_SAMELINE},
273
            {IF_BRACE_PLACEMENT, OBRACE_SAMELINE},
269
            {FOR_BRACE_PLACEMENT, OBRACE_SAMELINE},
274
            {FOR_BRACE_PLACEMENT, OBRACE_SAMELINE},
Lines 296-301 Link Here
296
            {SPACE_BEFORE_ELSE, TRUE},
301
            {SPACE_BEFORE_ELSE, TRUE},
297
            {SPACE_BEFORE_CATCH, TRUE},
302
            {SPACE_BEFORE_CATCH, TRUE},
298
            {SPACE_BEFORE_FINALLY, TRUE},
303
            {SPACE_BEFORE_FINALLY, TRUE},
304
            {SPACE_BEFORE_ANONYMOUS_CLASS_PAREN, FALSE},
299
            {SPACE_BEFORE_METHOD_DECL_PAREN, FALSE},
305
            {SPACE_BEFORE_METHOD_DECL_PAREN, FALSE},
300
            {SPACE_BEFORE_METHOD_CALL_PAREN, FALSE},
306
            {SPACE_BEFORE_METHOD_CALL_PAREN, FALSE},
301
            {SPACE_BEFORE_IF_PAREN, TRUE},
307
            {SPACE_BEFORE_IF_PAREN, TRUE},
Lines 324-329 Link Here
324
            {SPACE_BEFORE_FINALLY_LEFT_BRACE, TRUE},
330
            {SPACE_BEFORE_FINALLY_LEFT_BRACE, TRUE},
325
            {SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE, TRUE},
331
            {SPACE_BEFORE_USE_TRAIT_BODY_LEFT_BRACE, TRUE},
326
            {SPACE_WITHIN_ARRAY_DECL_PARENS, FALSE},
332
            {SPACE_WITHIN_ARRAY_DECL_PARENS, FALSE},
333
            {SPACE_WITHIN_ANONYMOUS_CLASS_PARENS, FALSE},
327
            {SPACE_WITHIN_METHOD_DECL_PARENS, FALSE},
334
            {SPACE_WITHIN_METHOD_DECL_PARENS, FALSE},
328
            {SPACE_WITHIN_METHOD_CALL_PARENS, FALSE},
335
            {SPACE_WITHIN_METHOD_CALL_PARENS, FALSE},
329
            {SPACE_WITHIN_IF_PARENS, FALSE},
336
            {SPACE_WITHIN_IF_PARENS, FALSE},
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/FormatToken.java (+6 lines)
Lines 68-73 Link Here
68
        WHITESPACE_BETWEEN_USE,
68
        WHITESPACE_BETWEEN_USE,
69
        WHITESPACE_AFTER_USE,
69
        WHITESPACE_AFTER_USE,
70
        WHITESPACE_BEFORE_CLASS_LEFT_BRACE,
70
        WHITESPACE_BEFORE_CLASS_LEFT_BRACE,
71
        WHITESPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE,
71
        WHITESPACE_AROUND_OBJECT_OP,
72
        WHITESPACE_AROUND_OBJECT_OP,
72
        WHITESPACE_AROUND_CONCAT_OP,
73
        WHITESPACE_AROUND_CONCAT_OP,
73
        WHITESPACE_AROUND_UNARY_OP,
74
        WHITESPACE_AROUND_UNARY_OP,
Lines 78-83 Link Here
78
        WHITESPACE_BEFORE_ASSIGN_OP,
79
        WHITESPACE_BEFORE_ASSIGN_OP,
79
        WHITESPACE_AFTER_ASSIGN_OP,
80
        WHITESPACE_AFTER_ASSIGN_OP,
80
        WHITESPACE_AROUND_KEY_VALUE_OP,
81
        WHITESPACE_AROUND_KEY_VALUE_OP,
82
        WHITESPACE_BEFORE_ANONYMOUS_CLASS_PAREN,
81
        WHITESPACE_BEFORE_METHOD_DEC_PAREN,
83
        WHITESPACE_BEFORE_METHOD_DEC_PAREN,
82
        WHITESPACE_BEFORE_METHOD_CALL_PAREN,
84
        WHITESPACE_BEFORE_METHOD_CALL_PAREN,
83
        WHITESPACE_BEFORE_IF_PAREN,
85
        WHITESPACE_BEFORE_IF_PAREN,
Lines 87-92 Link Here
87
        WHITESPACE_BEFORE_SWITCH_PAREN,
89
        WHITESPACE_BEFORE_SWITCH_PAREN,
88
        WHITESPACE_BEFORE_ARRAY_DECL_PAREN,
90
        WHITESPACE_BEFORE_ARRAY_DECL_PAREN,
89
        WHITESPACE_AFTER_CLASS_LEFT_BRACE,
91
        WHITESPACE_AFTER_CLASS_LEFT_BRACE,
92
        WHITESPACE_AFTER_ANONYMOUS_CLASS_LEFT_BRACE,
90
        WHITESPACE_AFTER_KEYWORD,
93
        WHITESPACE_AFTER_KEYWORD,
91
        WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE,
94
        WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE,
92
        WHITESPACE_BEFORE_IF_LEFT_BRACE,
95
        WHITESPACE_BEFORE_IF_LEFT_BRACE,
Lines 101-106 Link Here
101
        WHITESPACE_BEFORE_OTHER_LEFT_BRACE,
104
        WHITESPACE_BEFORE_OTHER_LEFT_BRACE,
102
        WHITESPACE_AFTER_OTHER_LEFT_BRACE,
105
        WHITESPACE_AFTER_OTHER_LEFT_BRACE,
103
        WHITESPACE_BEFORE_CLASS_RIGHT_BRACE,
106
        WHITESPACE_BEFORE_CLASS_RIGHT_BRACE,
107
        WHITESPACE_BEFORE_ANONYMOUS_CLASS_RIGHT_BRACE,
104
        WHITESPACE_BEFORE_FUNCTION_RIGHT_BRACE,
108
        WHITESPACE_BEFORE_FUNCTION_RIGHT_BRACE,
105
        WHITESPACE_BEFORE_IF_RIGHT_BRACE,
109
        WHITESPACE_BEFORE_IF_RIGHT_BRACE,
106
        WHITESPACE_BEFORE_FOR_RIGHT_BRACE,
110
        WHITESPACE_BEFORE_FOR_RIGHT_BRACE,
Lines 115-120 Link Here
115
        WHITESPACE_BEFORE_USE_TRAIT_BODY_RIGHT_BRACE,
119
        WHITESPACE_BEFORE_USE_TRAIT_BODY_RIGHT_BRACE,
116
        WHITESPACE_AFTER_ARRAY_DECL_LEFT_PAREN,
120
        WHITESPACE_AFTER_ARRAY_DECL_LEFT_PAREN,
117
        WHITESPACE_BEFORE_ARRAY_DECL_RIGHT_PAREN,
121
        WHITESPACE_BEFORE_ARRAY_DECL_RIGHT_PAREN,
122
        WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS,
118
        WHITESPACE_WITHIN_METHOD_DECL_PARENS,
123
        WHITESPACE_WITHIN_METHOD_DECL_PARENS,
119
        WHITESPACE_WITHIN_METHOD_CALL_PARENS,
124
        WHITESPACE_WITHIN_METHOD_CALL_PARENS,
120
        WHITESPACE_WITHIN_IF_PARENS,
125
        WHITESPACE_WITHIN_IF_PARENS,
Lines 131-136 Link Here
131
        WHITESPACE_AFTER_TYPE_CAST,
136
        WHITESPACE_AFTER_TYPE_CAST,
132
        WHITESPACE_BEFORE_CLASS,
137
        WHITESPACE_BEFORE_CLASS,
133
        WHITESPACE_AFTER_CLASS,
138
        WHITESPACE_AFTER_CLASS,
139
        WHITESPACE_AFTER_ANONYMOUS_CLASS,
134
        WHITESPACE_BEFORE_FUNCTION,
140
        WHITESPACE_BEFORE_FUNCTION,
135
        WHITESPACE_AFTER_FUNCTION,
141
        WHITESPACE_AFTER_FUNCTION,
136
        WHITESPACE_BEFORE_FIELDS,
142
        WHITESPACE_BEFORE_FIELDS,
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/FormatVisitor.java (-16 / +101 lines)
Lines 419-424 Link Here
419
        if (ts.token().id() == PHPTokenId.PHP_CURLY_OPEN) {
419
        if (ts.token().id() == PHPTokenId.PHP_CURLY_OPEN) {
420
            if (parent instanceof ClassDeclaration || parent instanceof InterfaceDeclaration || parent instanceof TraitDeclaration) {
420
            if (parent instanceof ClassDeclaration || parent instanceof InterfaceDeclaration || parent instanceof TraitDeclaration) {
421
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_CLASS_LEFT_BRACE, ts.offset()));
421
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_CLASS_LEFT_BRACE, ts.offset()));
422
            } else if (isAnonymousClass(parent)) {
423
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE, ts.offset()));
422
            } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
424
            } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
423
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE, ts.offset()));
425
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE, ts.offset()));
424
            } else if (parent instanceof IfStatement) {
426
            } else if (parent instanceof IfStatement) {
Lines 466-471 Link Here
466
468
467
            if (parent instanceof ClassDeclaration || parent instanceof InterfaceDeclaration || parent instanceof TraitDeclaration) {
469
            if (parent instanceof ClassDeclaration || parent instanceof InterfaceDeclaration || parent instanceof TraitDeclaration) {
468
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_CLASS_LEFT_BRACE, ts.offset()));
470
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_CLASS_LEFT_BRACE, ts.offset()));
471
            } else if (isAnonymousClass(parent)) {
472
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_ANONYMOUS_CLASS_LEFT_BRACE, ts.offset()));
469
            } else {
473
            } else {
470
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_OTHER_LEFT_BRACE, ts.offset()));
474
                formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_OTHER_LEFT_BRACE, ts.offset()));
471
            }
475
            }
Lines 516-521 Link Here
516
                        }
520
                        }
517
                        addFormatToken(formatTokens);
521
                        addFormatToken(formatTokens);
518
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_CLASS, ts.offset() + ts.token().length()));
522
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_CLASS, ts.offset() + ts.token().length()));
523
                    } else if (isAnonymousClass(parent)) {
524
                        if (includeWSBeforePHPDoc) {
525
                            formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_ANONYMOUS_CLASS_RIGHT_BRACE, ts.offset()));
526
                        }
527
                        addFormatToken(formatTokens);
528
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_AFTER_ANONYMOUS_CLASS, ts.offset() + ts.token().length()));
519
                    } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
529
                    } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
520
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_FUNCTION_RIGHT_BRACE, ts.offset()));
530
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_FUNCTION_RIGHT_BRACE, ts.offset()));
521
                        addFormatToken(formatTokens);
531
                        addFormatToken(formatTokens);
Lines 640-657 Link Here
640
    @Override
650
    @Override
641
    public void visit(ClassInstanceCreation node) {
651
    public void visit(ClassInstanceCreation node) {
642
        scan(node.getClassName());
652
        scan(node.getClassName());
643
        if (node.ctorParams() != null && node.ctorParams().size() > 0) {
653
        if (node.isAnonymous()) {
644
            boolean addIndentation = (path.size() > 2 && (path.get(1) instanceof ArrayElement) && (path.get(2) instanceof ArrayCreation));
654
            while (ts.moveNext() && ts.token().id() != PHPTokenId.PHP_CURLY_OPEN) {
645
            if (addIndentation) {
655
                switch (ts.token().id()) {
646
                formatTokens.add(new FormatToken.IndentToken(node.getClassName().getEndOffset(), options.continualIndentSize));
656
                    case PHP_CLASS:
657
                        addFormatToken(formatTokens);
658
                        break;
659
                    case PHP_IMPLEMENTS:
660
                        if (node.getInterfaces().size() > 0) {
661
                            formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_EXTENDS_IMPLEMENTS, ts.offset(), ts.token().text().toString()));
662
                            ts.movePrevious();
663
                            addListOfNodes(node.getInterfaces(), FormatToken.Kind.WHITESPACE_IN_INTERFACE_LIST);
664
                        }
665
                        break;
666
                    case PHP_EXTENDS:
667
                        formatTokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_EXTENDS_IMPLEMENTS, ts.offset(), ts.token().text().toString()));
668
                        addFormatToken(formatTokens);
669
                        break;
670
                    default:
671
                        addFormatToken(formatTokens);
672
                }
647
            }
673
            }
648
            processArguments(node.ctorParams());
674
649
            if (addIndentation) {
675
            ts.movePrevious();
650
                formatTokens.add(new FormatToken.IndentToken(node.ctorParams().get(node.ctorParams().size() - 1).getEndOffset(), -1 * options.continualIndentSize));
676
            super.visit(node);
677
        } else {
678
            if (node.ctorParams() != null && node.ctorParams().size() > 0) {
679
                boolean addIndentation = (path.size() > 2 && (path.get(1) instanceof ArrayElement) && (path.get(2) instanceof ArrayCreation));
680
                if (addIndentation) {
681
                    formatTokens.add(new FormatToken.IndentToken(node.getClassName().getEndOffset(), options.continualIndentSize));
682
                }
683
                processArguments(node.ctorParams());
684
                if (addIndentation) {
685
                    formatTokens.add(new FormatToken.IndentToken(node.ctorParams().get(node.ctorParams().size() - 1).getEndOffset(), -1 * options.continualIndentSize));
686
                }
687
                addAllUntilOffset(node.getEndOffset());
688
            } else {
689
                super.visit(node);
651
            }
690
            }
652
            addAllUntilOffset(node.getEndOffset());
653
        } else {
654
            super.visit(node);
655
        }
691
        }
656
    }
692
    }
657
693
Lines 899-904 Link Here
899
                addFormatToken(formatTokens); // add the first token of the expression and then add the indentation
935
                addFormatToken(formatTokens); // add the first token of the expression and then add the indentation
900
                Expression expression = node.getExpression();
936
                Expression expression = node.getExpression();
901
                boolean addIndent = !(expression instanceof MethodInvocation || expression instanceof StaticMethodInvocation);
937
                boolean addIndent = !(expression instanceof MethodInvocation || expression instanceof StaticMethodInvocation);
938
                if (expression instanceof Assignment) {
939
                    // anonymous classes
940
                    Assignment assignment = (Assignment) expression;
941
                    Expression right = assignment.getRightHandSide();
942
                    if (isAnonymousClass(right)) {
943
                        addIndent = false;
944
                    }
945
                }
902
                if (addIndent) {
946
                if (addIndent) {
903
                    formatTokens.add(new FormatToken.IndentToken(ts.offset() + ts.token().length(), options.continualIndentSize));
947
                    formatTokens.add(new FormatToken.IndentToken(ts.offset() + ts.token().length(), options.continualIndentSize));
904
                    super.visit(node);
948
                    super.visit(node);
Lines 1121-1126 Link Here
1121
            boolean addIndentation = !(path.get(1) instanceof ReturnStatement
1165
            boolean addIndentation = !(path.get(1) instanceof ReturnStatement
1122
                    || path.get(1) instanceof Assignment
1166
                    || path.get(1) instanceof Assignment
1123
                    || (path.size() > 2 && path.get(1) instanceof MethodInvocation && path.get(2) instanceof Assignment));
1167
                    || (path.size() > 2 && path.get(1) instanceof MethodInvocation && path.get(2) instanceof Assignment));
1168
            // anonymous classes
1169
            if (options.wrapMethodCallArgs != CodeStyle.WrapStyle.WRAP_ALWAYS) {
1170
                for (Expression parameter : parameters) {
1171
                    if (isAnonymousClass(parameter)) {
1172
                        addIndentation = false;
1173
                        break;
1174
                    }
1175
                }
1176
            }
1177
1124
            if (addIndentation) {
1178
            if (addIndentation) {
1125
                formatTokens.add(new FormatToken.IndentToken(node.getFunctionName().getEndOffset(), options.continualIndentSize));
1179
                formatTokens.add(new FormatToken.IndentToken(node.getFunctionName().getEndOffset(), options.continualIndentSize));
1126
            }
1180
            }
Lines 1288-1293 Link Here
1288
                    shift = true;
1342
                    shift = true;
1289
                    addAllUntilOffset(node.getStartOffset());
1343
                    addAllUntilOffset(node.getStartOffset());
1290
                    boolean addIndent = !(path.size() > 1 && (path.get(1) instanceof Assignment));
1344
                    boolean addIndent = !(path.size() > 1 && (path.get(1) instanceof Assignment));
1345
1346
                    // anonymous classes
1347
                    if (options.wrapMethodCallArgs != CodeStyle.WrapStyle.WRAP_ALWAYS) {
1348
                        FunctionInvocation method = node.getMethod();
1349
                        List<Expression> parameters = method.getParameters();
1350
                        for (Expression parameter : parameters) {
1351
                            if (isAnonymousClass(parameter)) {
1352
                                addIndent = false;
1353
                                break;
1354
                            }
1355
                        }
1356
                    }
1357
1291
                    if (addIndent) {
1358
                    if (addIndent) {
1292
                        formatTokens.add(new FormatToken.IndentToken(ts.offset() + ts.token().length(), options.continualIndentSize));
1359
                        formatTokens.add(new FormatToken.IndentToken(ts.offset() + ts.token().length(), options.continualIndentSize));
1293
                    }
1360
                    }
Lines 1350-1360 Link Here
1350
                && ((ts.offset() + ts.token().length()) <= node.getEndOffset())) {
1417
                && ((ts.offset() + ts.token().length()) <= node.getEndOffset())) {
1351
            addFormatToken(formatTokens);
1418
            addFormatToken(formatTokens);
1352
        }
1419
        }
1420
1421
        boolean addIndent = !isAnonymousClass(node.getExpression());
1422
1353
        if (ts.token().id() == PHPTokenId.PHP_RETURN) {
1423
        if (ts.token().id() == PHPTokenId.PHP_RETURN) {
1354
            addFormatToken(formatTokens);
1424
            addFormatToken(formatTokens);
1355
            formatTokens.add(new FormatToken.IndentToken(ts.offset(), options.continualIndentSize));
1425
            if (addIndent) {
1426
                formatTokens.add(new FormatToken.IndentToken(ts.offset(), options.continualIndentSize));
1427
            }
1356
            super.visit(node);
1428
            super.visit(node);
1357
            formatTokens.add(new FormatToken.IndentToken(ts.offset(), -1 * options.continualIndentSize));
1429
            if (addIndent) {
1430
                formatTokens.add(new FormatToken.IndentToken(ts.offset(), -1 * options.continualIndentSize));
1431
            }
1358
        }
1432
        }
1359
    }
1433
    }
1360
1434
Lines 1662-1669 Link Here
1662
            case PHP_TOKEN:
1736
            case PHP_TOKEN:
1663
                text = ts.token().text().toString();
1737
                text = ts.token().text().toString();
1664
                ASTNode parent = path.get(0);
1738
                ASTNode parent = path.get(0);
1665
                if ("(".equals(text)) {
1739
                if ("(".equals(text)) { // NOI18N
1666
                    if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
1740
                    if (isAnonymousClass(parent)) {
1741
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_ANONYMOUS_CLASS_PAREN, ts.offset()));
1742
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1743
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS, ts.offset() + ts.token().length()));
1744
                    } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
1667
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_METHOD_DEC_PAREN, ts.offset()));
1745
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_BEFORE_METHOD_DEC_PAREN, ts.offset()));
1668
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1746
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1669
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS, ts.offset() + ts.token().length()));
1747
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS, ts.offset() + ts.token().length()));
Lines 1698-1705 Link Here
1698
                    } else {
1776
                    } else {
1699
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1777
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1700
                    }
1778
                    }
1701
                } else if (")".equals(text)) {
1779
                } else if (")".equals(text)) { // NOI18N
1702
                    if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
1780
                    if (isAnonymousClass(parent)) {
1781
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS, ts.offset()));
1782
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1783
                    } else if (parent instanceof FunctionDeclaration || parent instanceof MethodDeclaration) {
1703
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS, ts.offset()));
1784
                        tokens.add(new FormatToken(FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS, ts.offset()));
1704
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1785
                        tokens.add(new FormatToken(FormatToken.Kind.TEXT, ts.offset(), ts.token().text().toString()));
1705
                    } else if (parent instanceof FunctionInvocation || parent instanceof MethodInvocation || parent instanceof ClassInstanceCreation) {
1786
                    } else if (parent instanceof FunctionInvocation || parent instanceof MethodInvocation || parent instanceof ClassInstanceCreation) {
Lines 2239-2242 Link Here
2239
        }
2320
        }
2240
        return index == text.length();
2321
        return index == text.length();
2241
    }
2322
    }
2323
2324
    private static boolean isAnonymousClass(ASTNode astNode) {
2325
        return astNode instanceof ClassInstanceCreation && ((ClassInstanceCreation) astNode).isAnonymous();
2326
    }
2242
}
2327
}
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/TokenFormatter.java (-1 / +56 lines)
Lines 92-97 Link Here
92
        public int tabSize;
92
        public int tabSize;
93
        public boolean expandTabsToSpaces;
93
        public boolean expandTabsToSpaces;
94
        public CodeStyle.BracePlacement classDeclBracePlacement;
94
        public CodeStyle.BracePlacement classDeclBracePlacement;
95
        public CodeStyle.BracePlacement anonymousClassBracePlacement;
95
        public CodeStyle.BracePlacement methodDeclBracePlacement;
96
        public CodeStyle.BracePlacement methodDeclBracePlacement;
96
        public CodeStyle.BracePlacement ifBracePlacement;
97
        public CodeStyle.BracePlacement ifBracePlacement;
97
        public CodeStyle.BracePlacement forBracePlacement;
98
        public CodeStyle.BracePlacement forBracePlacement;
Lines 112-117 Link Here
112
        public boolean spaceBeforeCatchLeftBrace;
113
        public boolean spaceBeforeCatchLeftBrace;
113
        public boolean spaceBeforeFinallyLeftBrace;
114
        public boolean spaceBeforeFinallyLeftBrace;
114
        public boolean spaceBeforeUseTraitBodyLeftBrace;
115
        public boolean spaceBeforeUseTraitBodyLeftBrace;
116
        public boolean spaceBeforeAnonymousClassParen;
115
        public boolean spaceBeforeMethodDeclParen;
117
        public boolean spaceBeforeMethodDeclParen;
116
        public boolean spaceBeforeMethodCallParen;
118
        public boolean spaceBeforeMethodCallParen;
117
        public boolean spaceBeforeIfParen;
119
        public boolean spaceBeforeIfParen;
Lines 132-137 Link Here
132
        public boolean spaceAroundAssignOps;
134
        public boolean spaceAroundAssignOps;
133
        public boolean spaceAroundKeyValueOps;
135
        public boolean spaceAroundKeyValueOps;
134
        public boolean spaceWithinArrayDeclParens;
136
        public boolean spaceWithinArrayDeclParens;
137
        public boolean spaceWithinAnonymousClassParens;
135
        public boolean spaceWithinMethodDeclParens;
138
        public boolean spaceWithinMethodDeclParens;
136
        public boolean spaceWithinMethodCallParens;
139
        public boolean spaceWithinMethodCallParens;
137
        public boolean spaceWithinIfParens;
140
        public boolean spaceWithinIfParens;
Lines 220-225 Link Here
220
            expandTabsToSpaces = codeStyle.expandTabToSpaces();
223
            expandTabsToSpaces = codeStyle.expandTabToSpaces();
221
224
222
            classDeclBracePlacement = codeStyle.getClassDeclBracePlacement();
225
            classDeclBracePlacement = codeStyle.getClassDeclBracePlacement();
226
            anonymousClassBracePlacement = codeStyle.getAnonymousClassBracePlacement();
223
            methodDeclBracePlacement = codeStyle.getMethodDeclBracePlacement();
227
            methodDeclBracePlacement = codeStyle.getMethodDeclBracePlacement();
224
            ifBracePlacement = codeStyle.getIfBracePlacement();
228
            ifBracePlacement = codeStyle.getIfBracePlacement();
225
            forBracePlacement = codeStyle.getForBracePlacement();
229
            forBracePlacement = codeStyle.getForBracePlacement();
Lines 242-247 Link Here
242
            spaceBeforeFinallyLeftBrace = codeStyle.spaceBeforeFinallyLeftBrace();
246
            spaceBeforeFinallyLeftBrace = codeStyle.spaceBeforeFinallyLeftBrace();
243
            spaceBeforeUseTraitBodyLeftBrace = codeStyle.spaceBeforeUseTraitBodyLeftBrace();
247
            spaceBeforeUseTraitBodyLeftBrace = codeStyle.spaceBeforeUseTraitBodyLeftBrace();
244
248
249
            spaceBeforeAnonymousClassParen = codeStyle.spaceBeforeAnonymousClassParen();
245
            spaceBeforeMethodDeclParen = codeStyle.spaceBeforeMethodDeclParen();
250
            spaceBeforeMethodDeclParen = codeStyle.spaceBeforeMethodDeclParen();
246
            spaceBeforeMethodCallParen = codeStyle.spaceBeforeMethodCallParen();
251
            spaceBeforeMethodCallParen = codeStyle.spaceBeforeMethodCallParen();
247
            spaceBeforeIfParen = codeStyle.spaceBeforeIfParen();
252
            spaceBeforeIfParen = codeStyle.spaceBeforeIfParen();
Lines 265-270 Link Here
265
            spaceAroundKeyValueOps = codeStyle.spaceAroundKeyValueOps();
270
            spaceAroundKeyValueOps = codeStyle.spaceAroundKeyValueOps();
266
271
267
            spaceWithinArrayDeclParens = codeStyle.spaceWithinArrayDeclParens();
272
            spaceWithinArrayDeclParens = codeStyle.spaceWithinArrayDeclParens();
273
            spaceWithinAnonymousClassParens = codeStyle.spaceWithinAnonymousClassParens();
268
            spaceWithinMethodDeclParens = codeStyle.spaceWithinMethodDeclParens();
274
            spaceWithinMethodDeclParens = codeStyle.spaceWithinMethodDeclParens();
269
            spaceWithinMethodCallParens = codeStyle.spaceWithinMethodCallParens();
275
            spaceWithinMethodCallParens = codeStyle.spaceWithinMethodCallParens();
270
            spaceWithinIfParens = codeStyle.spaceWithinIfParens();
276
            spaceWithinIfParens = codeStyle.spaceWithinIfParens();
Lines 462-467 Link Here
462
                                        newLines = ws.lines;
468
                                        newLines = ws.lines;
463
                                        countSpaces = ws.spaces;
469
                                        countSpaces = ws.spaces;
464
                                        break;
470
                                        break;
471
                                    case WHITESPACE_BEFORE_ANONYMOUS_CLASS_LEFT_BRACE:
472
                                        indentRule = true;
473
                                        ws = countWhiteSpaceBeforeLeftBrace(docOptions.anonymousClassBracePlacement,
474
                                                docOptions.spaceBeforeClassDeclLeftBrace, // use the same option as class decl
475
                                                oldText,
476
                                                indent,
477
                                                peekLastBracedIndent(lastBracedBlockIndent));
478
                                        newLines = ws.lines;
479
                                        countSpaces = ws.spaces;
480
                                        break;
465
                                    case WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE:
481
                                    case WHITESPACE_BEFORE_FUNCTION_LEFT_BRACE:
466
                                        indentRule = true;
482
                                        indentRule = true;
467
                                        ws = countWhiteSpaceBeforeLeftBrace(
483
                                        ws = countWhiteSpaceBeforeLeftBrace(
Lines 621-626 Link Here
621
                                        newLines = docOptions.blankLinesAfterClassHeader + 1 > newLines ? docOptions.blankLinesAfterClassHeader + 1 : newLines;
637
                                        newLines = docOptions.blankLinesAfterClassHeader + 1 > newLines ? docOptions.blankLinesAfterClassHeader + 1 : newLines;
622
                                        countSpaces = indent;
638
                                        countSpaces = indent;
623
                                        break;
639
                                        break;
640
                                    case WHITESPACE_AFTER_ANONYMOUS_CLASS_LEFT_BRACE:
641
                                        indentRule = true;
642
                                        newLines = docOptions.blankLinesAfterClassHeader + 1;
643
                                        countSpaces = indent;
644
                                        break;
624
                                    case WHITESPACE_AFTER_CLASS:
645
                                    case WHITESPACE_AFTER_CLASS:
625
                                        indentRule = true;
646
                                        indentRule = true;
626
                                        // If there is some another visible token after this one, add an extra line,
647
                                        // If there is some another visible token after this one, add an extra line,
Lines 631-636 Link Here
631
                                        newLines = docOptions.blankLinesAfterClass + extraLines > newLines ? docOptions.blankLinesAfterClass + extraLines : newLines;
652
                                        newLines = docOptions.blankLinesAfterClass + extraLines > newLines ? docOptions.blankLinesAfterClass + extraLines : newLines;
632
                                        countSpaces = indent;
653
                                        countSpaces = indent;
633
                                        break;
654
                                        break;
655
                                    case WHITESPACE_AFTER_ANONYMOUS_CLASS:
656
                                        indentRule = true;
657
                                        newLines = 0;
658
                                        countSpaces = 0;
659
                                        break;
634
                                    case WHITESPACE_BEFORE_CLASS_RIGHT_BRACE:
660
                                    case WHITESPACE_BEFORE_CLASS_RIGHT_BRACE:
635
                                        indentRule = true;
661
                                        indentRule = true;
636
                                        ws = countWhiteSpaceBeforeRightBrace(
662
                                        ws = countWhiteSpaceBeforeRightBrace(
Lines 646-651 Link Here
646
                                        countSpaces = ws.spaces;
672
                                        countSpaces = ws.spaces;
647
                                        lastBracePlacement = docOptions.classDeclBracePlacement;
673
                                        lastBracePlacement = docOptions.classDeclBracePlacement;
648
                                        break;
674
                                        break;
675
                                    case WHITESPACE_BEFORE_ANONYMOUS_CLASS_RIGHT_BRACE:
676
                                        indentRule = true;
677
                                        if (docOptions.anonymousClassBracePlacement == CodeStyle.BracePlacement.PRESERVE_EXISTING) {
678
                                            ws = countWhiteSpaceForPreserveExistingBracePlacement(oldText, popLastBracedIndent(lastBracedBlockIndent));
679
                                        } else {
680
                                            int lines = docOptions.blankLinesBeforeClassEnd + 1;
681
                                            int spaces = docOptions.anonymousClassBracePlacement == CodeStyle.BracePlacement.NEW_LINE_INDENTED ? indent + docOptions.indentSize : indent;
682
                                            ws = new Whitespace(lines, spaces);
683
                                        }
684
                                        newLines = ws.lines;
685
                                        countSpaces = ws.spaces;
686
                                        lastBracePlacement = docOptions.anonymousClassBracePlacement;
687
                                        break;
649
                                    case WHITESPACE_BEFORE_FUNCTION:
688
                                    case WHITESPACE_BEFORE_FUNCTION:
650
                                        indentRule = true;
689
                                        indentRule = true;
651
                                        newLines = docOptions.blankLinesBeforeFunction + 1 > newLines ? docOptions.blankLinesBeforeFunction + 1 : newLines;
690
                                        newLines = docOptions.blankLinesBeforeFunction + 1 > newLines ? docOptions.blankLinesBeforeFunction + 1 : newLines;
Lines 1056-1061 Link Here
1056
                                        }
1095
                                        }
1057
                                        countSpaces = countSpaces + (docOptions.spaceAroundKeyValueOps ? 1 : 0);
1096
                                        countSpaces = countSpaces + (docOptions.spaceAroundKeyValueOps ? 1 : 0);
1058
                                        break;
1097
                                        break;
1098
                                    case WHITESPACE_BEFORE_ANONYMOUS_CLASS_PAREN:
1099
                                        countSpaces = docOptions.spaceBeforeAnonymousClassParen ? 1 : 0;
1100
                                        break;
1059
                                    case WHITESPACE_BEFORE_METHOD_DEC_PAREN:
1101
                                    case WHITESPACE_BEFORE_METHOD_DEC_PAREN:
1060
                                        countSpaces = docOptions.spaceBeforeMethodDeclParen ? 1 : 0;
1102
                                        countSpaces = docOptions.spaceBeforeMethodDeclParen ? 1 : 0;
1061
                                        break;
1103
                                        break;
Lines 1136-1143 Link Here
1136
                                    case WHITESPACE_BEFORE_ARRAY_DECL_RIGHT_PAREN:
1178
                                    case WHITESPACE_BEFORE_ARRAY_DECL_RIGHT_PAREN:
1137
                                        countSpaces = countSpacesForArrayDeclParens(index, indent, formatTokens);
1179
                                        countSpaces = countSpacesForArrayDeclParens(index, indent, formatTokens);
1138
                                        break;
1180
                                        break;
1181
                                    case WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS:
1182
                                        int helpIndex = index - 1;
1183
                                        while (helpIndex > 0
1184
                                                && formatTokens.get(helpIndex).getId() != FormatToken.Kind.WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS
1185
                                                && (formatTokens.get(helpIndex).getId() == FormatToken.Kind.WHITESPACE)) {
1186
                                            helpIndex--;
1187
                                        }
1188
                                        if (helpIndex > 0 && formatTokens.get(helpIndex).getId() == FormatToken.Kind.WHITESPACE_WITHIN_ANONYMOUS_CLASS_PARENS) {
1189
                                            countSpaces = 0;
1190
                                        } else {
1191
                                            countSpaces = docOptions.spaceWithinAnonymousClassParens ? 1 : 0;
1192
                                        }
1193
                                        break;
1139
                                    case WHITESPACE_WITHIN_METHOD_DECL_PARENS:
1194
                                    case WHITESPACE_WITHIN_METHOD_DECL_PARENS:
1140
                                        int helpIndex = index - 1;
1195
                                        helpIndex = index - 1;
1141
                                        while (helpIndex > 0
1196
                                        while (helpIndex > 0
1142
                                                && formatTokens.get(helpIndex).getId() != FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS
1197
                                                && formatTokens.get(helpIndex).getId() != FormatToken.Kind.WHITESPACE_WITHIN_METHOD_DECL_PARENS
1143
                                                && (formatTokens.get(helpIndex).getId() == FormatToken.Kind.WHITESPACE /*
1198
                                                && (formatTokens.get(helpIndex).getId() == FormatToken.Kind.WHITESPACE /*
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/Braces.php (+6 lines)
Lines 18-23 Link Here
18
    }
18
    }
19
}
19
}
20
20
21
$anonymous = new class extends AnonymousExample {
22
    public function main() {
23
        return "anonymous";
24
    }
25
};
26
21
function getFruit() {
27
function getFruit() {
22
    return "Apple";
28
    return "Apple";
23
}
29
}
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/Bundle.properties (+3 lines)
Lines 86-91 Link Here
86
LBL_spaceBeforeFinally="finally"
86
LBL_spaceBeforeFinally="finally"
87
87
88
LBL_BeforeParentheses=Before Parentheses
88
LBL_BeforeParentheses=Before Parentheses
89
LBL_spaceBeforeAnonymousClassParen=Anonymous Class
89
LBL_spaceBeforeMethodDeclParen=Method / Function Declaration
90
LBL_spaceBeforeMethodDeclParen=Method / Function Declaration
90
LBL_spaceBeforeMethodCallParen=Method / Function Call
91
LBL_spaceBeforeMethodCallParen=Method / Function Call
91
LBL_spaceBeforeIfParen="if", "elseif"
92
LBL_spaceBeforeIfParen="if", "elseif"
Lines 125-130 Link Here
125
126
126
LBL_WithinParentheses=Within Parentheses
127
LBL_WithinParentheses=Within Parentheses
127
LBL_spaceWithinParens=Parentheses
128
LBL_spaceWithinParens=Parentheses
129
LBL_spaceWithinAnonymousClassParens=Anonymous Class
128
LBL_spaceWithinMethodDeclParens=Method / Function Declaration
130
LBL_spaceWithinMethodDeclParens=Method / Function Declaration
129
LBL_spaceWithinMethodCallParens=Method / Function Call
131
LBL_spaceWithinMethodCallParens=Method / Function Call
130
LBL_spaceWithinIfParens="if"
132
LBL_spaceWithinIfParens="if"
Lines 436-438 Link Here
436
FmtWrapping.panel1.AccessibleContext.accessibleDescription=wrapping options panel
438
FmtWrapping.panel1.AccessibleContext.accessibleDescription=wrapping options panel
437
FmtWrapping.wrapAfterAssignOpsCheckBox.text_1=Wrap After Assignment Operators
439
FmtWrapping.wrapAfterAssignOpsCheckBox.text_1=Wrap After Assignment Operators
438
FmtAlignment.nlFinallyCheckBox.text="fina&lly"
440
FmtAlignment.nlFinallyCheckBox.text="fina&lly"
441
FmtBraces.anonymousClassLabel.text=&Anonymous Class:
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/FmtBraces.form (-2 / +34 lines)
Lines 77-82 Link Here
77
                              <EmptySpace max="32767" attributes="0"/>
77
                              <EmptySpace max="32767" attributes="0"/>
78
                              <Component id="classDeclCombo" linkSize="1" min="-2" max="-2" attributes="1"/>
78
                              <Component id="classDeclCombo" linkSize="1" min="-2" max="-2" attributes="1"/>
79
                          </Group>
79
                          </Group>
80
                          <Group type="102" alignment="0" attributes="0">
81
                              <Component id="anonymousClassLabel" min="-2" max="-2" attributes="0"/>
82
                              <EmptySpace max="32767" attributes="0"/>
83
                              <Component id="anonymousClassCombo" min="-2" max="-2" attributes="0"/>
84
                          </Group>
80
                      </Group>
85
                      </Group>
81
                  </Group>
86
                  </Group>
82
              </Group>
87
              </Group>
Lines 97-103 Link Here
97
                  <Component id="classDeclLabel" alignment="3" min="-2" pref="18" max="-2" attributes="0"/>
102
                  <Component id="classDeclLabel" alignment="3" min="-2" pref="18" max="-2" attributes="0"/>
98
                  <Component id="classDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/>
103
                  <Component id="classDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/>
99
              </Group>
104
              </Group>
100
              <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
105
              <EmptySpace max="-2" attributes="0"/>
106
              <Group type="103" groupAlignment="3" attributes="0">
107
                  <Component id="anonymousClassLabel" alignment="3" min="-2" max="-2" attributes="0"/>
108
                  <Component id="anonymousClassCombo" alignment="3" min="-2" max="-2" attributes="0"/>
109
              </Group>
110
              <EmptySpace min="-2" max="-2" attributes="0"/>
101
              <Group type="103" groupAlignment="3" attributes="0">
111
              <Group type="103" groupAlignment="3" attributes="0">
102
                  <Component id="methodDeclLabel" alignment="3" min="-2" max="-2" attributes="0"/>
112
                  <Component id="methodDeclLabel" alignment="3" min="-2" max="-2" attributes="0"/>
103
                  <Component id="methodDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/>
113
                  <Component id="methodDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/>
Lines 137-143 Link Here
137
                  <Component id="otherCombo" alignment="3" min="-2" max="-2" attributes="0"/>
147
                  <Component id="otherCombo" alignment="3" min="-2" max="-2" attributes="0"/>
138
                  <Component id="otherLabel" alignment="3" min="-2" max="-2" attributes="0"/>
148
                  <Component id="otherLabel" alignment="3" min="-2" max="-2" attributes="0"/>
139
              </Group>
149
              </Group>
140
              <EmptySpace pref="18" max="32767" attributes="0"/>
150
              <EmptySpace max="32767" attributes="0"/>
141
          </Group>
151
          </Group>
142
      </Group>
152
      </Group>
143
    </DimensionLayout>
153
    </DimensionLayout>
Lines 202-207 Link Here
202
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="classDeclComboActionPerformed"/>
212
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="classDeclComboActionPerformed"/>
203
      </Events>
213
      </Events>
204
    </Component>
214
    </Component>
215
    <Component class="javax.swing.JLabel" name="anonymousClassLabel">
216
      <Properties>
217
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
218
          <ResourceString bundle="org/netbeans/modules/php/editor/indent/ui/Bundle.properties" key="FmtBraces.anonymousClassLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
219
        </Property>
220
      </Properties>
221
    </Component>
222
    <Component class="javax.swing.JComboBox" name="anonymousClassCombo">
223
      <Properties>
224
        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
225
          <StringArray count="4">
226
            <StringItem index="0" value="Item 1"/>
227
            <StringItem index="1" value="Item 2"/>
228
            <StringItem index="2" value="Item 3"/>
229
            <StringItem index="3" value="Item 4"/>
230
          </StringArray>
231
        </Property>
232
      </Properties>
233
      <AuxValues>
234
        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
235
      </AuxValues>
236
    </Component>
205
    <Component class="javax.swing.JLabel" name="methodDeclLabel">
237
    <Component class="javax.swing.JLabel" name="methodDeclLabel">
206
      <Properties>
238
      <Properties>
207
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
239
        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/FmtBraces.java (-3 / +20 lines)
Lines 64-69 Link Here
64
    public FmtBraces() {
64
    public FmtBraces() {
65
        initComponents();
65
        initComponents();
66
        classDeclCombo.putClientProperty(OPTION_ID, CLASS_DECL_BRACE_PLACEMENT);
66
        classDeclCombo.putClientProperty(OPTION_ID, CLASS_DECL_BRACE_PLACEMENT);
67
        anonymousClassCombo.putClientProperty(OPTION_ID, ANONYMOUS_CLASS_BRACE_PLACEMENT);
67
        methodDeclCombo.putClientProperty(OPTION_ID, METHOD_DECL_BRACE_PLACEMENT);
68
        methodDeclCombo.putClientProperty(OPTION_ID, METHOD_DECL_BRACE_PLACEMENT);
68
        ifCombo.putClientProperty(OPTION_ID, IF_BRACE_PLACEMENT);
69
        ifCombo.putClientProperty(OPTION_ID, IF_BRACE_PLACEMENT);
69
        forCombo.putClientProperty(OPTION_ID, FOR_BRACE_PLACEMENT);
70
        forCombo.putClientProperty(OPTION_ID, FOR_BRACE_PLACEMENT);
Lines 96-101 Link Here
96
        bracesPlacementLabel = new javax.swing.JLabel();
97
        bracesPlacementLabel = new javax.swing.JLabel();
97
        classDeclLabel = new javax.swing.JLabel();
98
        classDeclLabel = new javax.swing.JLabel();
98
        classDeclCombo = new javax.swing.JComboBox();
99
        classDeclCombo = new javax.swing.JComboBox();
100
        anonymousClassLabel = new javax.swing.JLabel();
101
        anonymousClassCombo = new javax.swing.JComboBox<>();
99
        methodDeclLabel = new javax.swing.JLabel();
102
        methodDeclLabel = new javax.swing.JLabel();
100
        methodDeclCombo = new javax.swing.JComboBox();
103
        methodDeclCombo = new javax.swing.JComboBox();
101
        otherLabel = new javax.swing.JLabel();
104
        otherLabel = new javax.swing.JLabel();
Lines 130-135 Link Here
130
            }
133
            }
131
        });
134
        });
132
135
136
        org.openide.awt.Mnemonics.setLocalizedText(anonymousClassLabel, org.openide.util.NbBundle.getMessage(FmtBraces.class, "FmtBraces.anonymousClassLabel.text")); // NOI18N
137
138
        anonymousClassCombo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
139
133
        methodDeclLabel.setLabelFor(methodDeclCombo);
140
        methodDeclLabel.setLabelFor(methodDeclCombo);
134
        org.openide.awt.Mnemonics.setLocalizedText(methodDeclLabel, org.openide.util.NbBundle.getMessage(FmtBraces.class, "LBL_bp_MethodDecl")); // NOI18N
141
        org.openide.awt.Mnemonics.setLocalizedText(methodDeclLabel, org.openide.util.NbBundle.getMessage(FmtBraces.class, "LBL_bp_MethodDecl")); // NOI18N
135
142
Lines 221-227 Link Here
221
                            .addGroup(layout.createSequentialGroup()
228
                            .addGroup(layout.createSequentialGroup()
222
                                .addComponent(classDeclLabel)
229
                                .addComponent(classDeclLabel)
223
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
230
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
224
                                .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
231
                                .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
232
                            .addGroup(layout.createSequentialGroup()
233
                                .addComponent(anonymousClassLabel)
234
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
235
                                .addComponent(anonymousClassCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
225
                .addContainerGap())
236
                .addContainerGap())
226
        );
237
        );
227
238
Lines 238-244 Link Here
238
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
249
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
239
                    .addComponent(classDeclLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
250
                    .addComponent(classDeclLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
240
                    .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
251
                    .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
241
                .addGap(6, 6, 6)
252
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
253
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
254
                    .addComponent(anonymousClassLabel)
255
                    .addComponent(anonymousClassCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
256
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
242
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
257
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
243
                    .addComponent(methodDeclLabel)
258
                    .addComponent(methodDeclLabel)
244
                    .addComponent(methodDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
259
                    .addComponent(methodDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
Lines 270-276 Link Here
270
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
285
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
271
                    .addComponent(otherCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
286
                    .addComponent(otherCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
272
                    .addComponent(otherLabel))
287
                    .addComponent(otherLabel))
273
                .addContainerGap(18, Short.MAX_VALUE))
288
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
274
        );
289
        );
275
290
276
        bracesPlacementLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FmtBraces.class, "FmtBraces.bracesPlacementLabel.AccessibleContext.accessibleName")); // NOI18N
291
        bracesPlacementLabel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FmtBraces.class, "FmtBraces.bracesPlacementLabel.AccessibleContext.accessibleName")); // NOI18N
Lines 328-333 Link Here
328
343
329
344
330
    // Variables declaration - do not modify//GEN-BEGIN:variables
345
    // Variables declaration - do not modify//GEN-BEGIN:variables
346
    private javax.swing.JComboBox<String> anonymousClassCombo;
347
    private javax.swing.JLabel anonymousClassLabel;
331
    private javax.swing.JLabel bracesPlacementLabel;
348
    private javax.swing.JLabel bracesPlacementLabel;
332
    private javax.swing.JComboBox catchCombo;
349
    private javax.swing.JComboBox catchCombo;
333
    private javax.swing.JLabel catchLabel;
350
    private javax.swing.JLabel catchLabel;
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/FmtSpaces.java (+2 lines)
Lines 267-272 Link Here
267
                new Item(SPACE_BEFORE_FINALLY)),
267
                new Item(SPACE_BEFORE_FINALLY)),
268
268
269
            new Item("BeforeParentheses",                       // NOI18N
269
            new Item("BeforeParentheses",                       // NOI18N
270
                new Item(SPACE_BEFORE_ANONYMOUS_CLASS_PAREN),
270
                new Item(SPACE_BEFORE_METHOD_DECL_PAREN),
271
                new Item(SPACE_BEFORE_METHOD_DECL_PAREN),
271
                new Item(SPACE_BEFORE_METHOD_CALL_PAREN),
272
                new Item(SPACE_BEFORE_METHOD_CALL_PAREN),
272
                new Item(SPACE_BEFORE_IF_PAREN),
273
                new Item(SPACE_BEFORE_IF_PAREN),
Lines 302-307 Link Here
302
                ),
303
                ),
303
304
304
            new Item("WithinParentheses",                       // NOI18N
305
            new Item("WithinParentheses",                       // NOI18N
306
                new Item(SPACE_WITHIN_ANONYMOUS_CLASS_PARENS),
305
                new Item(SPACE_WITHIN_METHOD_DECL_PARENS),
307
                new Item(SPACE_WITHIN_METHOD_DECL_PARENS),
306
                new Item(SPACE_WITHIN_METHOD_CALL_PARENS),
308
                new Item(SPACE_WITHIN_METHOD_CALL_PARENS),
307
                new Item(SPACE_WITHIN_IF_PARENS),
309
                new Item(SPACE_WITHIN_IF_PARENS),
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/Spaces.php (+11 lines)
Lines 57-61 Link Here
57
}
57
}
58
58
59
}
59
}
60
61
public function anonymousClassExample($arg) {
62
    $instance = new class ($arg) extends Anonymous {
63
        public function __construct($arg) {
64
        }
65
        public function anon() {
66
            echo "anonymous";
67
        }
68
    };
69
    return $instance;
70
}
60
}
71
}
61
?>
72
?>
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClass.php (+24 lines)
Line 0 Link Here
1
<?php
2
var_dump(new class($i) {
3
    public function __construct($i) {
4
        $this->i = $i;
5
    }
6
});
7
8
(new class extends BaseClass {
9
public function main() {
10
}
11
})->main();
12
13
class MyClass extends BaseClass {
14
    private function getInstance() {
15
return new class() extends MyClass implements MyInterface {
16
            public function test() {
17
        }
18
        };
19
    }
20
}
21
22
$anonClass = new class {
23
use Foo;
24
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClass.php.formatted (+33 lines)
Line 0 Link Here
1
<?php
2
3
var_dump(new class($i) {
4
5
    public function __construct($i) {
6
        $this->i = $i;
7
    }
8
});
9
10
(new class extends BaseClass {
11
12
    public function main() {
13
        
14
    }
15
})->main();
16
17
class MyClass extends BaseClass {
18
19
    private function getInstance() {
20
        return new class() extends MyClass implements MyInterface {
21
22
            public function test() {
23
                
24
            }
25
        };
26
    }
27
28
}
29
30
$anonClass = new class {
31
32
    use Foo;
33
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_01.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
    public function test() {
4
    }
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_01.php.formatted (+9 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class
4
{
5
6
    public function test() {
7
        
8
    }
9
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_02.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class     {
3
    public function test() {
4
    }
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_02.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class     {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_03.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
    public function test() {
4
    }
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_03.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_04.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
    public function test() {
4
    }
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/anonymousClassBP_04.php.formatted (+9 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class
4
    {
5
6
    public function test() {
7
        
8
    }
9
    };
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass01.php (+31 lines)
Line 0 Link Here
1
<?php
2
$instance1 = new class {
3
   public function test() {
4
       echo "{}::test() called\n";
5
   }
6
7
   // something
8
   final public function moreTesting() {
9
       echo "{}::moreTesting() called\n";
10
   }
11
};
12
$instance2 = new class extends BaseClass {
13
    private $field1;
14
    var $field2;
15
    public function method1() {
16
    }
17
};
18
19
20
21
22
23
24
$instance3 = new class extends BaseClass {
25
26
27
28
29
    
30
    public $field2 = 22;
31
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass01.php.formatted (+32 lines)
Line 0 Link Here
1
<?php
2
3
$instance1 = new class {
4
5
    public function test() {
6
        echo "{}::test() called\n";
7
    }
8
9
    // something
10
    final public function moreTesting() {
11
        echo "{}::moreTesting() called\n";
12
    }
13
};
14
$instance2 = new class extends BaseClass {
15
16
    private $field1;
17
    var $field2;
18
19
    public function method1() {
20
        
21
    }
22
};
23
24
25
26
27
28
29
$instance3 = new class extends BaseClass {
30
31
    public $field2 = 22;
32
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass02.php (+15 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class               {
4
5
    // property declaration
6
    public $var = 'a value';
7
8
    // method declaration
9
    public function displayVar()
10
11
12
    {
13
        echo $this->var;
14
    }
15
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass02.php.formatted (+15 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class               {
4
5
    // property declaration
6
    public $var = 'a value';
7
8
    // method declaration
9
    public function displayVar()
10
11
12
    {
13
        echo $this->var;
14
    }
15
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass03.php (+59 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function ifExample ($a, $b) {
6
        if (convert($a) > $b) {
7
            echo "a is bigger than b";
8
        } elseif ($a == $b) {
9
            echo $a." is equal to ".$b;
10
        } else {
11
            echo $this->property;
12
        }
13
    }
14
15
public function forExample() {
16
    for ($i = 1; $i <= 10; $i++) {
17
    echo $i;
18
}
19
}
20
21
public function foreachEample() {
22
$arr = array(1, 2, 3, 4);
23
foreach ($arr as &$value) {
24
    $value = $value * 2;
25
}
26
}
27
28
public function whileExample() {
29
$i = 1;
30
        while ($i <= 10) {
31
            echo $i++;
32
        }
33
}
34
35
public function doWhileExample($i) {
36
do {
37
    echo $i--;
38
} while ($i > 0);
39
}
40
41
public function switchExample() {
42
switch ($i) {
43
    case 0:
44
        echo "i equals 0";
45
        break;
46
    case 1:
47
        echo "i equals 1";
48
        break;
49
}
50
}
51
public function tryExample() {
52
    try {
53
    echo inverse(5) . "\n";
54
} catch (Exception $e) {
55
    echo 'Caught exception: '.  $e->getMessage(). "\n";
56
}
57
58
}
59
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/AnonymousClass03.php.formatted (+67 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class
4
{
5
6
    public function ifExample($a, $b)
7
    {
8
        if (convert($a) > $b) {
9
            echo "a is bigger than b";
10
        } elseif ($a == $b) {
11
            echo $a . " is equal to " . $b;
12
        } else {
13
            echo $this->property;
14
        }
15
    }
16
17
    public function forExample()
18
    {
19
        for ($i = 1; $i <= 10; $i++) {
20
            echo $i;
21
        }
22
    }
23
24
    public function foreachEample()
25
    {
26
        $arr = array(1, 2, 3, 4);
27
        foreach ($arr as &$value) {
28
            $value = $value * 2;
29
        }
30
    }
31
32
    public function whileExample()
33
    {
34
        $i = 1;
35
        while ($i <= 10) {
36
            echo $i++;
37
        }
38
    }
39
40
    public function doWhileExample($i)
41
    {
42
        do {
43
            echo $i--;
44
        } while ($i > 0);
45
    }
46
47
    public function switchExample()
48
    {
49
        switch ($i) {
50
            case 0:
51
                echo "i equals 0";
52
                break;
53
            case 1:
54
                echo "i equals 1";
55
                break;
56
        }
57
    }
58
59
    public function tryExample()
60
    {
61
        try {
62
            echo inverse(5) . "\n";
63
        } catch (Exception $e) {
64
            echo 'Caught exception: ' . $e->getMessage() . "\n";
65
        }
66
    }
67
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass01.php (+9 lines)
Line 0 Link Here
1
<?php
2
var_dump(new class {
3
// property declaration
4
public $var = 'a default value';
5
// method declaration
6
public function displayVar() {
7
echo $this->var;
8
}
9
});
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass01.php.formatted (+12 lines)
Line 0 Link Here
1
<?php
2
3
var_dump(new class {
4
5
// property declaration
6
    public $var = 'a default value';
7
8
// method declaration
9
    public function displayVar() {
10
        echo $this->var;
11
    }
12
});
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass02.php (+25 lines)
Line 0 Link Here
1
<?php
2
3
4
5
6
7
8
/**
9
 * This is a comment
10
 */
11
12
13
14
15
16
17
return new class {
18
// property declaration
19
public $var = 'a default value';
20
// method declaration
21
public function displayVar() {
22
echo $this->var;
23
}
24
};
25
?>
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass02.php.formatted (+16 lines)
Line 0 Link Here
1
<?php
2
3
/**
4
 * This is a comment
5
 */
6
return new class {
7
8
// property declaration
9
    public $var = 'a default value';
10
11
// method declaration
12
    public function displayVar() {
13
        echo $this->var;
14
    }
15
};
16
?>
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass03.php (+8 lines)
Line 0 Link Here
1
<?php
2
// Lots
3
// of
4
// interesting
5
// comments and white space
6
namespace Foo;
7
return new class Bar {
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass03.php.formatted (+12 lines)
Line 0 Link Here
1
<?php
2
3
// Lots
4
// of
5
// interesting
6
// comments and white space
7
8
namespace Foo;
9
10
return new class Bar {
11
    
12
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass04.php (+19 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
protected $name, $price, $qty, $total;
4
public function __construct($iName, $iPrice, $iQty) {
5
$this->name = $iName;
6
$this->price = $iPrice;
7
$this->qty = $iQty;
8
$this->calculate();
9
}
10
protected function calculate() {
11
$this->price = number_format($this->price, 2);
12
$this->total = number_format(($this->price * $this->qty), 2);
13
}
14
public function __toString() {
15
return "You ordered ($this->qty) '$this->name'" . ($this->qty == 1 ? "" : "s") .
16
" at \$$this->price, for a total of: \$$this->total.";
17
}
18
};
19
echo (new Item("Widget 22", 4.90, 2));
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass04.php.formatted (+24 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    protected $name, $price, $qty, $total;
6
7
    public function __construct($iName, $iPrice, $iQty) {
8
        $this->name = $iName;
9
        $this->price = $iPrice;
10
        $this->qty = $iQty;
11
        $this->calculate();
12
    }
13
14
    protected function calculate() {
15
        $this->price = number_format($this->price, 2);
16
        $this->total = number_format(($this->price * $this->qty), 2);
17
    }
18
19
    public function __toString() {
20
        return "You ordered ($this->qty) '$this->name'" . ($this->qty == 1 ? "" : "s") .
21
                " at \$$this->price, for a total of: \$$this->total.";
22
    }
23
};
24
echo (new Item("Widget 22", 4.90, 2));
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass05.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass05.php.formatted (+7 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
    public function test() {
5
        
6
    }
7
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass06.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass06.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass07.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass07.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
    public function test() {
5
        
6
    }
7
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass08.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass08.php.formatted (+7 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
    public function test() {
5
        
6
    }
7
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass09.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass09.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass10.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass10.php.formatted (+7 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
    public function test() {
5
        
6
    }
7
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass11.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass11.php.formatted (+7 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
    public function test() {
5
        
6
    }
7
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass12.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass12.php.formatted (+9 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
9
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass13.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class { // test
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass13.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class { // test
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass14.php (+4 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {}
4
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass14.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass15.php (+4 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test(){ }
4
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass15.php.formatted (+8 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class {
4
5
    public function test() {
6
        
7
    }
8
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass16.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass16.php.formatted (+10 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class
4
    {
5
6
    public function test()
7
        {
8
        
9
        }
10
    };
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass17.php (+5 lines)
Line 0 Link Here
1
<?php
2
$instance = new class {
3
public function test() {
4
}
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/SimpleAnonymousClass17.php.formatted (+11 lines)
Line 0 Link Here
1
<?php
2
3
    $instance = new class
4
        {
5
6
        public function test()
7
            {
8
            
9
            }
10
        };
11
    
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceBeforeAnonymousClassParen01.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   ($a, $b) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceBeforeAnonymousClassParen01.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class($a, $b) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceBeforeAnonymousClassParen02.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   ($a, $b) extends E implements I {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceBeforeAnonymousClassParen02.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class ($a, $b) extends E implements I {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen01.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   ($a, $b) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen01.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class($a, $b) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen02.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   (  $a, $b) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen02.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class( $a, $b ) {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen03.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   () {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen03.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class() {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen04.php (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class   () {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/spaces/spaceWithinAnonymousClassParen04.php.formatted (+5 lines)
Line 0 Link Here
1
<?php
2
3
$instance = new class() {
4
    
5
};
(-)a/php.editor/test/unit/data/testfiles/formatting/wrapping/methodCallArgWithAnonymousClass01.php (+57 lines)
Line 0 Link Here
1
<?php
2
test(new class {
3
public function foo() {
4
}
5
}
6
);
7
8
test(
9
new class {
10
public function foo() {
11
}
12
}
13
);
14
15
test($arg1,
16
new class {
17
public function foo() {
18
}
19
}
20
);
21
22
test(
23
$arg1,
24
new class {
25
public function foo() {
26
}
27
}
28
);
29
30
// method
31
$test->test(new class {
32
public function foo() {
33
}
34
}
35
);
36
37
$test->test(
38
new class {
39
public function foo() {
40
}
41
}
42
);
43
44
$test->test($arg1,
45
new class {
46
public function foo() {
47
}
48
}
49
);
50
51
$test->test(
52
$arg1,
53
new class {
54
public function foo() {
55
}
56
}
57
);
(-)a/php.editor/test/unit/data/testfiles/formatting/wrapping/methodCallArgWithAnonymousClass01.php.formatted (+74 lines)
Line 0 Link Here
1
<?php
2
3
test(new class {
4
5
            public function foo() {
6
                
7
            }
8
        }
9
);
10
11
test(
12
        new class {
13
14
            public function foo() {
15
                
16
            }
17
        }
18
);
19
20
test($arg1,
21
        new class {
22
23
            public function foo() {
24
                
25
            }
26
        }
27
);
28
29
test(
30
        $arg1,
31
        new class {
32
33
            public function foo() {
34
                
35
            }
36
        }
37
);
38
39
// method
40
$test->test(new class {
41
42
            public function foo() {
43
                
44
            }
45
        }
46
);
47
48
$test->test(
49
        new class {
50
51
            public function foo() {
52
                
53
            }
54
        }
55
);
56
57
$test->test($arg1,
58
        new class {
59
60
            public function foo() {
61
                
62
            }
63
        }
64
);
65
66
$test->test(
67
        $arg1,
68
        new class {
69
70
            public function foo() {
71
                
72
            }
73
        }
74
);
(-)a/php.editor/test/unit/data/testfiles/formatting/wrapping/methodCallArgWithAnonymousClass02.php (+49 lines)
Line 0 Link Here
1
<?php
2
test(new class {
3
public function foo() {
4
}
5
});
6
7
test(
8
new class {
9
public function foo() {
10
}
11
});
12
13
test($arg1,
14
new class {
15
public function foo() {
16
}
17
});
18
19
test(
20
$arg1,
21
new class {
22
public function foo() {
23
}
24
});
25
26
// method
27
$test->test(new class {
28
public function foo() {
29
}
30
});
31
32
$test->test(
33
new class {
34
public function foo() {
35
}
36
});
37
38
$test->test($arg1,
39
new class {
40
public function foo() {
41
}
42
});
43
44
$test->test(
45
$arg1,
46
new class {
47
public function foo() {
48
}
49
});
(-)a/php.editor/test/unit/data/testfiles/formatting/wrapping/methodCallArgWithAnonymousClass02.php.formatted (+62 lines)
Line 0 Link Here
1
<?php
2
3
test(new class {
4
5
    public function foo() {
6
        
7
    }
8
});
9
10
test(
11
new class {
12
13
    public function foo() {
14
        
15
    }
16
});
17
18
test($arg1, new class {
19
20
    public function foo() {
21
        
22
    }
23
});
24
25
test(
26
$arg1, new class {
27
28
    public function foo() {
29
        
30
    }
31
});
32
33
// method
34
$test->test(new class {
35
36
    public function foo() {
37
        
38
    }
39
});
40
41
$test->test(
42
new class {
43
44
    public function foo() {
45
        
46
    }
47
});
48
49
$test->test($arg1, new class {
50
51
    public function foo() {
52
        
53
    }
54
});
55
56
$test->test(
57
$arg1, new class {
58
59
    public function foo() {
60
        
61
    }
62
});
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/indent/PHPFormatterBlankLinesTest.java (+234 lines)
Lines 186-191 Link Here
186
        reformatFileContents("testfiles/formatting/blankLines/Trait01.php", options);
186
        reformatFileContents("testfiles/formatting/blankLines/Trait01.php", options);
187
    }
187
    }
188
188
189
    public void testBLAnonymousClass01() throws Exception {
190
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
191
        options.put(FmtOptions.INITIAL_INDENT, 0);
192
        reformatFileContents("testfiles/formatting/blankLines/AnonymousClass01.php", options);
193
    }
194
189
    public void testBLClass02() throws Exception {
195
    public void testBLClass02() throws Exception {
190
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
196
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
191
        options.put(FmtOptions.INITIAL_INDENT, 0);
197
        options.put(FmtOptions.INITIAL_INDENT, 0);
Lines 206-211 Link Here
206
        reformatFileContents("testfiles/formatting/blankLines/Trait02.php", options);
212
        reformatFileContents("testfiles/formatting/blankLines/Trait02.php", options);
207
    }
213
    }
208
214
215
    public void testBLAnonymousClass02() throws Exception {
216
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
217
        options.put(FmtOptions.INITIAL_INDENT, 0);
218
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.PRESERVE_EXISTING);
219
        options.put(FmtOptions.METHOD_DECL_BRACE_PLACEMENT, CodeStyle.BracePlacement.PRESERVE_EXISTING);
220
        options.put(FmtOptions.OTHER_BRACE_PLACEMENT, CodeStyle.BracePlacement.PRESERVE_EXISTING);
221
        options.put(FmtOptions.SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, false);
222
        reformatFileContents("testfiles/formatting/blankLines/AnonymousClass02.php", options);
223
    }
224
209
    public void testBLClass03() throws Exception {
225
    public void testBLClass03() throws Exception {
210
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
226
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
211
        options.put(FmtOptions.INITIAL_INDENT, 0);
227
        options.put(FmtOptions.INITIAL_INDENT, 0);
Lines 226-231 Link Here
226
        reformatFileContents("testfiles/formatting/blankLines/Trait03.php", options);
242
        reformatFileContents("testfiles/formatting/blankLines/Trait03.php", options);
227
    }
243
    }
228
244
245
    public void testBLAnonymousClass03() throws Exception {
246
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
247
        options.put(FmtOptions.INITIAL_INDENT, 0);
248
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE);
249
        options.put(FmtOptions.METHOD_DECL_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE);
250
        options.put(FmtOptions.OTHER_BRACE_PLACEMENT, CodeStyle.BracePlacement.SAME_LINE);
251
        options.put(FmtOptions.SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, false);
252
        reformatFileContents("testfiles/formatting/blankLines/AnonymousClass03.php", options);
253
    }
254
255
229
    public void testBLFields01() throws Exception {
256
    public void testBLFields01() throws Exception {
230
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
257
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
231
        options.put(FmtOptions.SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, true);
258
        options.put(FmtOptions.SPACE_BEFORE_CLASS_DECL_LEFT_BRACE, true);
Lines 744-749 Link Here
744
        reformatFileContents("testfiles/formatting/blankLines/SimpleTrait17.php", options);
771
        reformatFileContents("testfiles/formatting/blankLines/SimpleTrait17.php", options);
745
    }
772
    }
746
773
774
    public void testBLSimpleAnonymousClass01() throws Exception {
775
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
776
        options.put(FmtOptions.INITIAL_INDENT, 0);
777
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass01.php", options);
778
    }
779
780
    public void testBLSimpleAnonymousClass02() throws Exception {
781
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
782
        options.put(FmtOptions.INITIAL_INDENT, 0);
783
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass02.php", options);
784
    }
785
786
    public void testBLSimpleAnonymousClass03() throws Exception {
787
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
788
        options.put(FmtOptions.INITIAL_INDENT, 0);
789
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass03.php", options);
790
    }
791
792
    public void testBLSimpleAnonymousClass04() throws Exception {
793
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
794
        options.put(FmtOptions.INITIAL_INDENT, 0);
795
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass04.php", options);
796
    }
797
798
    public void testBLSimpleAnonymousClass05() throws Exception {
799
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
800
        options.put(FmtOptions.INITIAL_INDENT, 0);
801
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 1);
802
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
803
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
804
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
805
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
806
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
807
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
808
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
809
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
810
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
811
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
812
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
813
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
814
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass05.php", options);
815
    }
816
817
    public void testBLSimpleAnonymousClass06() throws Exception {
818
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
819
        options.put(FmtOptions.INITIAL_INDENT, 0);
820
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
821
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 1);
822
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
823
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
824
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
825
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
826
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
827
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
828
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
829
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
830
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
831
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
832
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
833
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass06.php", options);
834
    }
835
836
    public void testBLSimpleAnonymousClass07() throws Exception {
837
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
838
        options.put(FmtOptions.INITIAL_INDENT, 0);
839
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
840
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
841
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 1);
842
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
843
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
844
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
845
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
846
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
847
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
848
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
849
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
850
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
851
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
852
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass07.php", options);
853
    }
854
855
    public void testBLSimpleAnonymousClass08() throws Exception {
856
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
857
        options.put(FmtOptions.INITIAL_INDENT, 0);
858
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
859
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
860
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
861
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 1); // ignore
862
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
863
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
864
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
865
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
866
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
867
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
868
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
869
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
870
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
871
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass08.php", options);
872
    }
873
874
    public void testBLSimpleAnonymousClass09() throws Exception {
875
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
876
        options.put(FmtOptions.INITIAL_INDENT, 0);
877
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
878
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
879
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
880
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
881
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 1);
882
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
883
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
884
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
885
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
886
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
887
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
888
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
889
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
890
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass09.php", options);
891
    }
892
893
    public void testBLSimpleAnonymousClass10() throws Exception {
894
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
895
        options.put(FmtOptions.INITIAL_INDENT, 0);
896
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
897
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
898
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
899
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
900
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
901
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 1);
902
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 0);
903
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
904
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
905
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
906
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
907
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
908
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
909
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass10.php", options);
910
    }
911
912
    public void testBLSimpleAnonymousClass11() throws Exception {
913
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
914
        options.put(FmtOptions.INITIAL_INDENT, 0);
915
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
916
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 0);
917
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 0);
918
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
919
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 0);
920
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 0);
921
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 1); // before class end is used
922
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
923
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
924
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
925
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
926
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
927
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
928
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass11.php", options);
929
    }
930
931
    public void testBLSimpleAnonymousClass12() throws Exception {
932
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
933
        options.put(FmtOptions.INITIAL_INDENT, 0);
934
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS, 0);
935
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS_HEADER, 1);
936
        options.put(FmtOptions.BLANK_LINES_BEFORE_CLASS_END, 1);
937
        options.put(FmtOptions.BLANK_LINES_AFTER_CLASS, 0);
938
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION, 1);
939
        options.put(FmtOptions.BLANK_LINES_BEFORE_FUNCTION_END, 1);
940
        options.put(FmtOptions.BLANK_LINES_AFTER_FUNCTION, 1);
941
        options.put(FmtOptions.BLANK_LINES_BEFORE_FIELDS, 0);
942
        options.put(FmtOptions.BLANK_LINES_AFTER_FIELDS, 0);
943
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
944
        options.put(FmtOptions.BLANK_LINES_AFTER_NAMESPACE, 0);
945
        options.put(FmtOptions.BLANK_LINES_BEFORE_USE, 0);
946
        options.put(FmtOptions.BLANK_LINES_AFTER_USE, 0);
947
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass12.php", options);
948
    }
949
950
    public void testBLSimpleAnonymousClass13() throws Exception {
951
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
952
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass13.php", options);
953
    }
954
955
    public void testBLSimpleAnonymousClass14() throws Exception {
956
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
957
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass14.php", options);
958
    }
959
960
    public void testBLSimpleAnonymousClass15() throws Exception {
961
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
962
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass15.php", options);
963
    }
964
965
    public void testBLSimpleAnonymousClass16() throws Exception {
966
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
967
        options.put(FmtOptions.INITIAL_INDENT, 0);
968
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE_INDENTED);
969
        options.put(FmtOptions.METHOD_DECL_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE_INDENTED);
970
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass16.php", options);
971
    }
972
973
    public void testBLSimpleAnonymousClass17() throws Exception {
974
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
975
        options.put(FmtOptions.INITIAL_INDENT, 4);
976
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE_INDENTED);
977
        options.put(FmtOptions.METHOD_DECL_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE_INDENTED);
978
        reformatFileContents("testfiles/formatting/blankLines/SimpleAnonymousClass17.php", options);
979
    }
980
747
    public void testBLSimpleUse01() throws Exception {
981
    public void testBLSimpleUse01() throws Exception {
748
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
982
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
749
        options.put(FmtOptions.INITIAL_INDENT, 0);
983
        options.put(FmtOptions.INITIAL_INDENT, 0);
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/indent/PHPFormatterSpacesTest.java (+33 lines)
Lines 1097-1100 Link Here
1097
        reformatFileContents("testfiles/formatting/spaces/spaceAroundReturnType12.php", options);
1097
        reformatFileContents("testfiles/formatting/spaces/spaceAroundReturnType12.php", options);
1098
    }
1098
    }
1099
1099
1100
    public void testSpacesBeforeAnonymousClassParen01() throws Exception {
1101
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1102
        reformatFileContents("testfiles/formatting/spaces/spaceBeforeAnonymousClassParen01.php", options);
1103
    }
1104
1105
    public void testSpacesBeforeAnonymousClassParen02() throws Exception {
1106
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1107
        options.put(FmtOptions.SPACE_BEFORE_ANONYMOUS_CLASS_PAREN, true);
1108
        reformatFileContents("testfiles/formatting/spaces/spaceBeforeAnonymousClassParen02.php", options);
1109
    }
1110
1111
    public void testSpacesWithinAnonymousClassParen01() throws Exception {
1112
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1113
        reformatFileContents("testfiles/formatting/spaces/spaceWithinAnonymousClassParen01.php", options);
1114
    }
1115
1116
    public void testSpacesWithinAnonymousClassParen02() throws Exception {
1117
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1118
        options.put(FmtOptions.SPACE_WITHIN_ANONYMOUS_CLASS_PARENS, true);
1119
        reformatFileContents("testfiles/formatting/spaces/spaceWithinAnonymousClassParen02.php", options);
1120
    }
1121
1122
    public void testSpacesWithinAnonymousClassParen03() throws Exception {
1123
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1124
        reformatFileContents("testfiles/formatting/spaces/spaceWithinAnonymousClassParen03.php", options);
1125
    }
1126
1127
    public void testSpacesWithinAnonymousClassParen04() throws Exception {
1128
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
1129
        options.put(FmtOptions.SPACE_WITHIN_ANONYMOUS_CLASS_PARENS, true);
1130
        reformatFileContents("testfiles/formatting/spaces/spaceWithinAnonymousClassParen04.php", options);
1131
    }
1132
1100
}
1133
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/indent/PHPFormatterTest.java (+29 lines)
Lines 671-674 Link Here
671
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
671
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
672
        reformatFileContents("testfiles/formatting/issue247047.php", options);
672
        reformatFileContents("testfiles/formatting/issue247047.php", options);
673
    }
673
    }
674
675
    public void testAnonymousClass() throws Exception {
676
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
677
        reformatFileContents("testfiles/formatting/anonymousClass.php", options);
678
    }
679
680
    public void testAnonymousClassBracePlacement_01() throws Exception {
681
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
682
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE);
683
        reformatFileContents("testfiles/formatting/anonymousClassBP_01.php", options);
684
    }
685
686
    public void testAnonymousClassBracePlacement_02() throws Exception {
687
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
688
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.PRESERVE_EXISTING);
689
        reformatFileContents("testfiles/formatting/anonymousClassBP_02.php", options);
690
    }
691
692
    public void testAnonymousClassBracePlacement_03() throws Exception {
693
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
694
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.SAME_LINE);
695
        reformatFileContents("testfiles/formatting/anonymousClassBP_03.php", options);
696
    }
697
698
    public void testAnonymousClassBracePlacement_04() throws Exception {
699
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
700
        options.put(FmtOptions.ANONYMOUS_CLASS_BRACE_PLACEMENT, CodeStyle.BracePlacement.NEW_LINE_INDENTED);
701
        reformatFileContents("testfiles/formatting/anonymousClassBP_04.php", options);
702
    }
674
}
703
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/indent/PHPFormatterWrappingTest.java (+12 lines)
Lines 78-83 Link Here
78
        reformatFileContents("testfiles/formatting/wrapping/methodCallArg05.php", options);
78
        reformatFileContents("testfiles/formatting/wrapping/methodCallArg05.php", options);
79
    }
79
    }
80
80
81
    public void testWrapMethodCallArgWithAnonymousClass01() throws Exception {
82
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
83
        options.put(FmtOptions.WRAP_METHOD_CALL_ARGS, CodeStyle.WrapStyle.WRAP_ALWAYS);
84
        reformatFileContents("testfiles/formatting/wrapping/methodCallArgWithAnonymousClass01.php", options);
85
    }
86
87
    public void testWrapMethodCallArgWithAnonymousClass02() throws Exception {
88
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
89
        options.put(FmtOptions.WRAP_METHOD_CALL_ARGS, CodeStyle.WrapStyle.WRAP_NEVER);
90
        reformatFileContents("testfiles/formatting/wrapping/methodCallArgWithAnonymousClass02.php", options);
91
    }
92
81
    public void testWrapMethodParams01() throws Exception {
93
    public void testWrapMethodParams01() throws Exception {
82
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
94
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
83
        options.put(FmtOptions.WRAP_METHOD_PARAMS, CodeStyle.WrapStyle.WRAP_ALWAYS);
95
        options.put(FmtOptions.WRAP_METHOD_PARAMS, CodeStyle.WrapStyle.WRAP_ALWAYS);

Return to bug 258883