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 243744
Collapse All | Expand All

(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/CodeStyle.java (+4 lines)
Lines 444-449 Link Here
444
        return preferences.getBoolean(SPACE_BEFORE_CLOSE_PHP_TAG, getDefaultAsBoolean(SPACE_BEFORE_CLOSE_PHP_TAG));
444
        return preferences.getBoolean(SPACE_BEFORE_CLOSE_PHP_TAG, getDefaultAsBoolean(SPACE_BEFORE_CLOSE_PHP_TAG));
445
    }
445
    }
446
446
447
    public boolean spaceBetweenOpenPHPTagAndNamespace() {
448
        return preferences.getBoolean(SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE, getDefaultAsBoolean(SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE));
449
    }
450
447
    // alignment
451
    // alignment
448
    public boolean alignMultilineMethodParams() {
452
    public boolean alignMultilineMethodParams() {
449
        return preferences.getBoolean(ALIGN_MULTILINE_METHOD_PARAMS, getDefaultAsBoolean(ALIGN_MULTILINE_METHOD_PARAMS));
453
        return preferences.getBoolean(ALIGN_MULTILINE_METHOD_PARAMS, getDefaultAsBoolean(ALIGN_MULTILINE_METHOD_PARAMS));
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/FmtOptions.java (+2 lines)
Lines 179-184 Link Here
179
    public static final String SPACE_CHECK_AFTER_KEYWORDS = "spaceCheckAfterKeywords"; //NOI18N
179
    public static final String SPACE_CHECK_AFTER_KEYWORDS = "spaceCheckAfterKeywords"; //NOI18N
180
    public static final String SPACE_AFTER_SHORT_PHP_TAG = "spaceAfterShortPHPTag"; //NOI18N
180
    public static final String SPACE_AFTER_SHORT_PHP_TAG = "spaceAfterShortPHPTag"; //NOI18N
181
    public static final String SPACE_BEFORE_CLOSE_PHP_TAG = "spaceBeforeClosePHPTag"; //NOI18N
181
    public static final String SPACE_BEFORE_CLOSE_PHP_TAG = "spaceBeforeClosePHPTag"; //NOI18N
182
    public static final String SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE = "spaceBetweenOpenPHPTagAndNamespace"; //NOI18N
182
    public static final String PLACE_ELSE_ON_NEW_LINE = "placeElseOnNewLine"; //NOI18N
183
    public static final String PLACE_ELSE_ON_NEW_LINE = "placeElseOnNewLine"; //NOI18N
183
    public static final String PLACE_WHILE_ON_NEW_LINE = "placeWhileOnNewLine"; //NOI18N
184
    public static final String PLACE_WHILE_ON_NEW_LINE = "placeWhileOnNewLine"; //NOI18N
184
    public static final String PLACE_CATCH_ON_NEW_LINE = "placeCatchOnNewLine"; //NOI18N
185
    public static final String PLACE_CATCH_ON_NEW_LINE = "placeCatchOnNewLine"; //NOI18N
Lines 340-345 Link Here
340
            {SPACE_CHECK_AFTER_KEYWORDS, TRUE},
341
            {SPACE_CHECK_AFTER_KEYWORDS, TRUE},
341
            {SPACE_AFTER_SHORT_PHP_TAG, TRUE},
342
            {SPACE_AFTER_SHORT_PHP_TAG, TRUE},
342
            {SPACE_BEFORE_CLOSE_PHP_TAG, TRUE},
343
            {SPACE_BEFORE_CLOSE_PHP_TAG, TRUE},
344
            {SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE, FALSE},
343
            {ALIGN_MULTILINE_METHOD_PARAMS, FALSE}, //NOI18N
345
            {ALIGN_MULTILINE_METHOD_PARAMS, FALSE}, //NOI18N
344
            {ALIGN_MULTILINE_CALL_ARGS, FALSE}, //NOI18N
346
            {ALIGN_MULTILINE_CALL_ARGS, FALSE}, //NOI18N
345
            {ALIGN_MULTILINE_IMPLEMENTS, FALSE}, //NOI18N
347
            {ALIGN_MULTILINE_IMPLEMENTS, FALSE}, //NOI18N
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/TokenFormatter.java (-1 / +9 lines)
Lines 148-153 Link Here
148
        public boolean spaceAfterTypeCast;
148
        public boolean spaceAfterTypeCast;
149
        public boolean spaceAfterShortTag;
149
        public boolean spaceAfterShortTag;
150
        public boolean spaceBeforeClosePHPTag;
150
        public boolean spaceBeforeClosePHPTag;
151
        public boolean spaceBetweenOpenPHPTagAndNamespace;
151
        public boolean placeElseOnNewLine;
152
        public boolean placeElseOnNewLine;
152
        public boolean placeWhileOnNewLine;
153
        public boolean placeWhileOnNewLine;
153
        public boolean placeCatchOnNewLine;
154
        public boolean placeCatchOnNewLine;
Lines 281-286 Link Here
281
            spaceAfterTypeCast = codeStyle.spaceAfterTypeCast();
282
            spaceAfterTypeCast = codeStyle.spaceAfterTypeCast();
282
            spaceAfterShortTag = codeStyle.spaceAfterShortPHPTag();
283
            spaceAfterShortTag = codeStyle.spaceAfterShortPHPTag();
283
            spaceBeforeClosePHPTag = codeStyle.spaceBeforeClosePHPTag();
284
            spaceBeforeClosePHPTag = codeStyle.spaceBeforeClosePHPTag();
285
            spaceBetweenOpenPHPTagAndNamespace = codeStyle.spaceBetweenOpenPHPTagAndNamespace();
284
286
285
            placeElseOnNewLine = codeStyle.placeElseOnNewLine();
287
            placeElseOnNewLine = codeStyle.placeElseOnNewLine();
286
            placeWhileOnNewLine = codeStyle.placeWhileOnNewLine();
288
            placeWhileOnNewLine = codeStyle.placeWhileOnNewLine();
Lines 700-706 Link Here
700
                                            countSpaces = indent;
702
                                            countSpaces = indent;
701
                                        } else {
703
                                        } else {
702
                                            if (newLines == 0) {
704
                                            if (newLines == 0) {
703
                                                countSpaces = 1; // one space before OPEN_TAG and NS_DECLARATION - probably in one line
705
                                                if (docOptions.spaceBetweenOpenPHPTagAndNamespace) {
706
                                                    countSpaces = 1; // one space before OPEN_TAG and NS_DECLARATION - probably in one line  
707
                                                } else {
708
                                                    // for PSR-2
709
                                                    newLines = 1;
710
                                                    countSpaces = indent;
711
                                                }
704
                                            }
712
                                            }
705
                                            countSpaces = Math.max(indent, countSpaces);
713
                                            countSpaces = Math.max(indent, countSpaces);
706
                                        }
714
                                        }
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/Bundle.properties (+1 lines)
Lines 150-155 Link Here
150
LBL_spaceCheckAfterKeywords=After Keywords
150
LBL_spaceCheckAfterKeywords=After Keywords
151
LBL_spaceAfterShortPHPTag=After Short PHP Tag
151
LBL_spaceAfterShortPHPTag=After Short PHP Tag
152
LBL_spaceBeforeClosePHPTag=Before Close PHP Tag
152
LBL_spaceBeforeClosePHPTag=Before Close PHP Tag
153
LBL_spaceBetweenOpenPHPTagAndNamespace=Between Open PHP Tag and Namespace
153
154
154
LBL_bp_If="&if", "else", "elseif"
155
LBL_bp_If="&if", "else", "elseif"
155
LBL_bp_FOR="&for", "foreach"
156
LBL_bp_FOR="&for", "foreach"
(-)a/php.editor/src/org/netbeans/modules/php/editor/indent/ui/FmtSpaces.java (-1 / +2 lines)
Lines 323-329 Link Here
323
                new Item(SPACE_AFTER_TYPE_CAST),
323
                new Item(SPACE_AFTER_TYPE_CAST),
324
                new Item(SPACE_CHECK_AFTER_KEYWORDS),
324
                new Item(SPACE_CHECK_AFTER_KEYWORDS),
325
                new Item(SPACE_AFTER_SHORT_PHP_TAG),
325
                new Item(SPACE_AFTER_SHORT_PHP_TAG),
326
                new Item(SPACE_BEFORE_CLOSE_PHP_TAG))
326
                new Item(SPACE_BEFORE_CLOSE_PHP_TAG),
327
                new Item(SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE))
327
328
328
        };
329
        };
329
330
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/issue243744.php (+8 lines)
Line 0 Link Here
1
<?php
2
3
namespace Foo;
4
5
class ClassName {
6
7
}
8
(-)a/php.editor/test/unit/data/testfiles/formatting/blankLines/issue243744.php.formatted (+6 lines)
Line 0 Link Here
1
<?php
2
namespace Foo;
3
4
class ClassName {
5
    
6
}
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/indent/PHPFormatterBlankLinesTest.java (+8 lines)
Lines 891-896 Link Here
891
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
891
        HashMap<String, Object> options = new HashMap<String, Object>(FmtOptions.getDefaults());
892
        options.put(FmtOptions.BLANK_LINES_AFTER_OPEN_PHP_TAG, 0);
892
        options.put(FmtOptions.BLANK_LINES_AFTER_OPEN_PHP_TAG, 0);
893
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
893
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
894
        options.put(FmtOptions.SPACE_BETWEEN_OPEN_PHP_TAG_AND_NAMESPACE, true);
894
        reformatFileContents("testfiles/formatting/blankLines/issue235710_01.php", options);
895
        reformatFileContents("testfiles/formatting/blankLines/issue235710_01.php", options);
895
    }
896
    }
896
897
Lines 955-958 Link Here
955
        reformatFileContents("testfiles/formatting/blankLines/issue235972_02.php", options);
956
        reformatFileContents("testfiles/formatting/blankLines/issue235972_02.php", options);
956
    }
957
    }
957
958
959
    public void testIssue243744() throws Exception {
960
        HashMap<String, Object> options = new HashMap<>(FmtOptions.getDefaults());
961
        options.put(FmtOptions.BLANK_LINES_AFTER_OPEN_PHP_TAG, 0);
962
        options.put(FmtOptions.BLANK_LINES_BEFORE_NAMESPACE, 0);
963
        reformatFileContents("testfiles/formatting/blankLines/issue243744.php", options);
964
    }
965
958
}
966
}

Return to bug 243744