diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java index f845c0152db3..af4ff86f646f 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java @@ -1470,7 +1470,7 @@ public static String getSemiType(TokenSequence tokenSequence, State case FUNCTION: state = State.INVALID; if (isString(token)) { - metaAll.insert(0, token.text().toString()); + metaAll.insert(0, fetchPossibleClassName(tokenSequence)); if (anchor == -1) { anchor = tokenSequence.offset(); } diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php new file mode 100644 index 000000000000..547a110b69d3 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php @@ -0,0 +1,35 @@ + diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php.testGH8644_01.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php.testGH8644_01.completion new file mode 100644 index 000000000000..d99da3e7fd3c --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_01.php.testGH8644_01.completion @@ -0,0 +1,6 @@ +Code completion result for source line: +new \Test2Namespace\Test2Class()->| +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD staticTest() [STATIC] \Test2Namespace\Test2Class +METHOD test() [PUBLIC] \Test2Namespace\Test2Class +VARIABLE ? test [PUBLIC] \Test2Namespace\Test2Class diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_02.php b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_02.php new file mode 100644 index 000000000000..5b1b08dd3414 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/gh8644/gh8644_02.php @@ -0,0 +1,35 @@ + createClassPathsForTest() { + return Collections.singletonMap( + PhpSourcePath.SOURCE_CP, + ClassPathSupport.createClassPath(new FileObject[] { + FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/gh8644")) + }) + ); + } + + public void testGH8644_01() throws Exception { + checkCompletion("testfiles/completion/lib/gh8644/gh8644_01.php", "new \\Test2Namespace\\Test2Class()->^", false); + } + + public void testGH8644_02() throws Exception { + checkCompletion("testfiles/completion/lib/gh8644/gh8644_02.php", "new \\Test2Namespace\\Test2Class()::^", false); + } +}