Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ public static String getSemiType(TokenSequence<PHPTokenId> 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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

namespace Test2Namespace;

class Test2Class {

public $test = "test";
public static $staticTest = "staticTest";

public function test() {
}

public static function staticTest() {
}
}

new \Test2Namespace\Test2Class()->
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

namespace Test2Namespace;

class Test2Class {

public $test = "test";
public static $staticTest = "staticTest";

public function test() {
}

public static function staticTest() {
}
}

new \Test2Namespace\Test2Class()::
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Code completion result for source line:
new \Test2Namespace\Test2Class()::|
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
METHOD staticTest() [STATIC] \Test2Namespace\Test2Class
VARIABLE ? $staticTest [STATIC] \Test2Namespace\Test2Class
CONSTANT class \Test2Namespace\Test2Cla [PUBLIC] Magic Constant
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.php.editor.completion;

import java.io.File;
import java.util.Collections;
import java.util.Map;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.modules.php.project.api.PhpSourcePath;
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;

public class PHPCodeCompletionGH8644Test extends PHPCodeCompletionTestBase {

public PHPCodeCompletionGH8644Test(String testName) {
super(testName);
}

@Override
protected Map<String, ClassPath> 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);
}
}
Loading