forked from apache/netbeans
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NETBEANS-1859] PHP autocompletion does only get fully qualified retu…
…rned objects - Get fully qualified types from return types of functions
- Loading branch information
Showing
9 changed files
with
152 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
php/php.editor/test/unit/data/testfiles/completion/lib/nb1859/nb1859_01.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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 TestNamespace; | ||
|
||
class TestClass { | ||
|
||
public $test = "test"; | ||
public static $staticTest = "staticTest"; | ||
|
||
public function test() { | ||
} | ||
|
||
public static function staticTest() { | ||
} | ||
} | ||
|
||
function newTestClass(): TestClass { | ||
return new TestClass(); | ||
} | ||
|
||
namespace TestNamespace2; | ||
|
||
class TestClass { | ||
|
||
public $test2 = "test2"; | ||
public static $staticTest2 = "staticTest2"; | ||
|
||
public function test2() { | ||
} | ||
|
||
public static function staticTest2() { | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
php/php.editor/test/unit/data/testfiles/completion/lib/nb1859/nb1859_02.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?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. | ||
*/ | ||
|
||
echo \TestNamespace\newTestClass()-> | ||
echo \TestNamespace\newTestClass():: |
7 changes: 7 additions & 0 deletions
7
...it/data/testfiles/completion/lib/nb1859/nb1859_02.php.testNamespaceFunction_01.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Code completion result for source line: | ||
echo \TestNamespace\newTestClass()->| | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
METHOD staticTest() [STATIC] \TestNamespace\TestClass | ||
METHOD test() [PUBLIC] \TestNamespace\TestClass | ||
VARIABLE ? test [PUBLIC] \TestNamespace\TestClass |
6 changes: 6 additions & 0 deletions
6
...it/data/testfiles/completion/lib/nb1859/nb1859_02.php.testNamespaceFunction_02.completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Code completion result for source line: | ||
echo \TestNamespace\newTestClass()::| | ||
(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) | ||
------------------------------------ | ||
METHOD staticTest() [STATIC] \TestNamespace\TestClass | ||
VARIABLE ? $staticTest [STATIC] \TestNamespace\TestClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionNb1859Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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 PHPCodeCompletionNb1859Test extends PHPCodeCompletionTestBase { | ||
|
||
public PHPCodeCompletionNb1859Test(String testName) { | ||
super(testName); | ||
} | ||
|
||
public void testNamespaceFunction_01() throws Exception { | ||
checkCompletion("testfiles/completion/lib/nb1859/nb1859_02.php", "echo \\TestNamespace\\newTestClass()->^", false); | ||
} | ||
|
||
public void testNamespaceFunction_02() throws Exception { | ||
checkCompletion("testfiles/completion/lib/nb1859/nb1859_02.php", "echo \\TestNamespace\\newTestClass()::^", false); | ||
} | ||
|
||
@Override | ||
protected Map<String, ClassPath> createClassPathsForTest() { | ||
return Collections.singletonMap( | ||
PhpSourcePath.SOURCE_CP, | ||
ClassPathSupport.createClassPath(new FileObject[] { | ||
FileUtil.toFileObject(new File(getDataDir(), "/testfiles/completion/lib/nb1859")) | ||
}) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters