aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2013-11-22 07:01:23 (EST)
committerDawid Pakuła2013-11-22 07:01:23 (EST)
commit4aab117d5a332d90acf15c9009d797ba9e2f479a (patch)
tree902541cbf9a7e8d58aa6d1ffa0d190711cbbc2de
parent83287f72a63a0eee254210e78accc45e071a18f3 (diff)
downloadorg.eclipse.pdt-4aab117d5a332d90acf15c9009d797ba9e2f479a.zip
org.eclipse.pdt-4aab117d5a332d90acf15c9009d797ba9e2f479a.tar.gz
org.eclipse.pdt-4aab117d5a332d90acf15c9009d797ba9e2f479a.tar.bz2
Bug 422306 - Completion interfaces inside PHPDocrefs/changes/17/18717/1
Allow Interfaces in suggestions after @return tag Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422306 Change-Id: Ibaebf4564bd0c9170669c1efb153699149f573a0 Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/PHPDocReturnTypeStrategy.java12
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc10.pdtt16
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc5.pdtt1
3 files changed, 26 insertions, 3 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/PHPDocReturnTypeStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/PHPDocReturnTypeStrategy.java
index dc83b55..edd0c74 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/PHPDocReturnTypeStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/PHPDocReturnTypeStrategy.java
@@ -4,13 +4,14 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Zend Technologies
*******************************************************************************/
package org.eclipse.php.internal.core.codeassist.strategies;
+import org.eclipse.dltk.ast.Modifiers;
import org.eclipse.dltk.internal.core.SourceRange;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.php.core.codeassist.ICompletionContext;
@@ -23,7 +24,7 @@ import org.eclipse.php.internal.core.codeassist.contexts.PHPDocTagContext;
*
* @author michael
*/
-public class PHPDocReturnTypeStrategy extends GlobalClassesStrategy {
+public class PHPDocReturnTypeStrategy extends GlobalTypesStrategy {
private static final String[] ALL_TYPE = new String[] { "array", "array", //$NON-NLS-1$ //$NON-NLS-2$
"mixed", "void", "integer", "int", "string", "float", "double", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
@@ -31,7 +32,12 @@ public class PHPDocReturnTypeStrategy extends GlobalClassesStrategy {
private static final String EMPTY = ""; //$NON-NLS-1$
public PHPDocReturnTypeStrategy(ICompletionContext context) {
- super(context);
+ super(context, 0, Modifiers.AccNameSpace);
+ }
+
+ public PHPDocReturnTypeStrategy(ICompletionContext context, int trueFlag,
+ int falseFlag) {
+ super(context, trueFlag, falseFlag);
}
public void apply(ICompletionReporter reporter) throws BadLocationException {
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc10.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc10.pdtt
new file mode 100644
index 0000000..2a67172
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc10.pdtt
@@ -0,0 +1,16 @@
+--TEST--
+Test PHPDoc Function Return Type
+--FILE--
+<?php
+interface TestInterface1{
+}
+class T2{
+ /**
+ * @return Test|
+ */
+ function test(){
+ }
+}
+?>
+--EXPECT--
+type(TestInterface1)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc5.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc5.pdtt
index a5eb4ff..5f6ae0f 100644
--- a/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc5.pdtt
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php5/testPHPDoc5.pdtt
@@ -9,6 +9,7 @@ Test PHPDoc Function Return Type
function foo() {}
?>
--EXPECT--
+type(ArrayAccess)
type(ArrayObject)
type(ArrayIterator)
keyword(array) \ No newline at end of file