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

(-)a/php.editor/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParser.java (-1 / +4 lines)
Lines 267-274 Link Here
267
    }
267
    }
268
268
269
    private List<PHPDocTypeNode> findTypes(String description, int startDescription, String originalComment, int originalCommentStart, boolean isReturnTag) {
269
    private List<PHPDocTypeNode> findTypes(String description, int startDescription, String originalComment, int originalCommentStart, boolean isReturnTag) {
270
        if (StringUtils.isEmpty(description)) {
271
            return Collections.emptyList();
272
        }
273
270
        List<PHPDocTypeNode> result = new ArrayList<>();
274
        List<PHPDocTypeNode> result = new ArrayList<>();
271
272
        for (String stype : getTypes(description, isReturnTag)) {
275
        for (String stype : getTypes(description, isReturnTag)) {
273
            stype = removeHTMLTags(stype);
276
            stype = removeHTMLTags(stype);
274
            int startDocNode = findStartOfDocNode(originalComment, originalCommentStart, stype, startDescription);
277
            int startDocNode = findStartOfDocNode(originalComment, originalCommentStart, stype, startDescription);
(-)a/php.editor/test/unit/data/goldenfiles/org/netbeans/modules/php/editor/parser/PHPDocCommentParserTest/testIssue257953.pass (+11 lines)
Line 0 Link Here
1
<PHPDocBlock start='3' end='9'>
2
    <Tags>
3
        <PHPDocVarTypeTag start='3' end='12' kind='param'>
4
            <Variable>
5
                <PHPDocNode start='3' end='3' value=''/>
6
            </Variable>
7
            <Types>
8
            </Types>
9
        </PHPDocVarTypeTag>
10
    </Tags>
11
</PHPDocBlock>
(-)a/php.editor/test/unit/src/org/netbeans/modules/php/editor/parser/PHPDocCommentParserTest.java (+6 lines)
Lines 342-347 Link Here
342
        perform(comment, "Issue197946");
342
        perform(comment, "Issue197946");
343
    }
343
    }
344
344
345
    public void testIssue257953() throws Exception {
346
        // types should be an empty list
347
        String comment = " * @param";
348
        perform(comment, "testIssue257953");
349
    }
350
345
    public void perform(String comment, String filename) throws Exception {
351
    public void perform(String comment, String filename) throws Exception {
346
        PHPDocCommentParser parser = new PHPDocCommentParser();
352
        PHPDocCommentParser parser = new PHPDocCommentParser();
347
        PHPDocBlock block = parser.parse(0, comment.length(), comment);
353
        PHPDocBlock block = parser.parse(0, comment.length(), comment);
(-)a/spellchecker.bindings.php/src/org/netbeans/modules/spellchecker/bindings/php/PHPTokenList.java (-3 / +14 lines)
Lines 47-52 Link Here
47
import javax.swing.text.BadLocationException;
47
import javax.swing.text.BadLocationException;
48
import javax.swing.text.Document;
48
import javax.swing.text.Document;
49
import org.netbeans.api.lexer.TokenSequence;
49
import org.netbeans.api.lexer.TokenSequence;
50
import org.netbeans.modules.php.api.util.StringUtils;
50
import org.netbeans.modules.php.editor.lexer.LexUtilities;
51
import org.netbeans.modules.php.editor.lexer.LexUtilities;
51
import org.netbeans.modules.php.editor.lexer.PHPTokenId;
52
import org.netbeans.modules.php.editor.lexer.PHPTokenId;
52
import org.netbeans.modules.php.editor.parser.PHPDocCommentParser;
53
import org.netbeans.modules.php.editor.parser.PHPDocCommentParser;
Lines 272-283 Link Here
272
        List<PHPDocTypeNode> types = docTypeTag.getTypes();
273
        List<PHPDocTypeNode> types = docTypeTag.getTypes();
273
        PHPDocTypeNode lastType = null;
274
        PHPDocTypeNode lastType = null;
274
        for (PHPDocTypeNode type : types) {
275
        for (PHPDocTypeNode type : types) {
276
            String value = type.getValue();
277
            if (StringUtils.isEmpty(value)) {
278
                continue;
279
            }
275
            if (lastType == null || lastType.getEndOffset() < type.getEndOffset()) {
280
            if (lastType == null || lastType.getEndOffset() < type.getEndOffset()) {
276
                lastType = type;
281
                lastType = type;
277
            }
282
            }
278
        }
283
        }
279
        if (lastType != null) {
284
        if (lastType != null) {
280
            currentOffsetInComment = lastType.getEndOffset();
285
            int endOffset = lastType.getEndOffset();
286
            if (currentOffsetInComment < endOffset) {
287
                currentOffsetInComment = endOffset;
288
            }
281
        }
289
        }
282
290
283
        if (docTypeTag instanceof PHPDocMethodTag) {
291
        if (docTypeTag instanceof PHPDocMethodTag) {
Lines 291-297 Link Here
291
                }
299
                }
292
            }
300
            }
293
            if (lastParam != null) {
301
            if (lastParam != null) {
294
                currentOffsetInComment = lastParam.getEndOffset();
302
                int endOffset = lastParam.getEndOffset();
303
                if (currentOffsetInComment < endOffset) {
304
                    currentOffsetInComment = endOffset;
305
                }
295
            } else {
306
            } else {
296
                // ignore method name
307
                // ignore method name
297
                PHPDocNode methodName = methodTag.getMethodName();
308
                PHPDocNode methodName = methodTag.getMethodName();
Lines 301-307 Link Here
301
                            currentOffsetInComment,
312
                            currentOffsetInComment,
302
                            LetterType.MethodName
313
                            LetterType.MethodName
303
                    );
314
                    );
304
                    if (data.first().equals(methodName.getValue())) {
315
                    if (data != null && data.first().equals(methodName.getValue())) {
305
                        currentOffsetInComment = getCurrentOffsetInComment(data);
316
                        currentOffsetInComment = getCurrentOffsetInComment(data);
306
                    }
317
                    }
307
                }
318
                }
(-)a/spellchecker.bindings.php/test/unit/src/org/netbeans/modules/spellchecker/bindings/php/PHPTokenListTest.java (+13 lines)
Lines 64-69 Link Here
64
        super(name);
64
        super(name);
65
    }
65
    }
66
66
67
    @Override
68
    protected int timeOut() {
69
        return 10000;
70
    }
71
67
    public void testSimpleWordBroker() throws Exception {
72
    public void testSimpleWordBroker() throws Exception {
68
        tokenListTest(
73
        tokenListTest(
69
                "  /**\n"
74
                "  /**\n"
Lines 131-136 Link Here
131
        );
136
        );
132
    }
137
    }
133
138
139
    public void testIssue257953() throws Exception {
140
        tokenListTest(
141
                "  /**\n"
142
                + " * @param\n"
143
                + " */"
144
        );
145
    }
146
134
    public void testMethodTagHandling() throws Exception {
147
    public void testMethodTagHandling() throws Exception {
135
        tokenListTest(
148
        tokenListTest(
136
                "  /**\n"
149
                "  /**\n"

Return to bug 257953