Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.php.composer.api/src/org/eclipse/php/composer/api/collection/ComposerPackages.java6
-rw-r--r--plugins/org.eclipse.php.core/Resources/language/generate.php17
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/TraitUseStatement.java1
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/TypeReferenceEvaluator.java14
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/ClassHighlighting.java13
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java167
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549308_01.pdtt31
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_02.pdtt31
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_03.pdtt34
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.03.pdtt1
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.04.pdtt1
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.05.pdtt46
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.06.pdtt90
-rw-r--r--tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php54/deprecated.pdtt119
14 files changed, 532 insertions, 39 deletions
diff --git a/plugins/org.eclipse.php.composer.api/src/org/eclipse/php/composer/api/collection/ComposerPackages.java b/plugins/org.eclipse.php.composer.api/src/org/eclipse/php/composer/api/collection/ComposerPackages.java
index 3d8893a95..46fb53079 100644
--- a/plugins/org.eclipse.php.composer.api/src/org/eclipse/php/composer/api/collection/ComposerPackages.java
+++ b/plugins/org.eclipse.php.composer.api/src/org/eclipse/php/composer/api/collection/ComposerPackages.java
@@ -32,6 +32,8 @@ import org.eclipse.php.composer.api.json.ParseException;
*/
public class ComposerPackages extends AbstractJsonArray<ComposerPackage> {
+ private static String PACKAGES = "packages";
+
public ComposerPackages() {
}
@@ -54,8 +56,12 @@ public class ComposerPackages extends AbstractJsonArray<ComposerPackage> {
@Override
@SuppressWarnings("rawtypes")
protected void doParse(Object obj) {
+ if (obj instanceof LinkedHashMap && ((LinkedHashMap) obj).containsKey(PACKAGES)) {
+ obj = ((LinkedHashMap) obj).get(PACKAGES);
+ }
clear();
if (obj instanceof LinkedHashMap) {
+
add(new ComposerPackage(obj));
} else if (obj instanceof LinkedList) {
LinkedList array = (LinkedList) obj;
diff --git a/plugins/org.eclipse.php.core/Resources/language/generate.php b/plugins/org.eclipse.php.core/Resources/language/generate.php
index b881744bf..11cd1018d 100644
--- a/plugins/org.eclipse.php.core/Resources/language/generate.php
+++ b/plugins/org.eclipse.php.core/Resources/language/generate.php
@@ -578,7 +578,7 @@ function print_extension ($extRef) {
/**
* Prints ReflectionClass in format of PHP code
* @param $classRef ReflectionClass object
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
*/
function print_class ($classRef, $tabs = 0) {
global $processedClasses;
@@ -707,7 +707,7 @@ function print_class ($classRef, $tabs = 0) {
/**
* Prints ReflectionProperty in format of PHP code
* @param $propertyRef ReflectionProperty object
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
*/
function print_property ($propertyRef, $tabs = 0) {
print_doccomment ($propertyRef, $tabs);
@@ -840,7 +840,7 @@ function print_parameters_ref ($paramsRef) {
/**
* Prints constants in format of PHP code
* @param $constants array containing constants, where key is a name of constant
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
*/
function print_constants ($constants, $tabs = 0) {
foreach ($constants as $name => $value) {
@@ -900,7 +900,7 @@ function escape_const_value ($value) {
/**
* Prints class constants in format of PHP code
* @param $constants array containing constants, where key is a name of constant
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
*/
function print_class_constants ($constants, $tabs = 0) {
foreach ($constants as $name => $value) {
@@ -926,7 +926,7 @@ function print_modifiers ($ref, $excludeModifierKeywords = array()) {
/**
* Makes PHP Manual URL from the given ID
- * @param $id PHP Element ID
+ * @param $id string PHP Element ID
* @return string URL
*/
function make_url ($id) {
@@ -936,7 +936,7 @@ function make_url ($id) {
/**
* Prints PHPDOC comment before specified reflection object
* @param $ref Reflection some reflection object
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
*/
function print_doccomment ($ref, $tabs = 0) {
global $functionsDoc;
@@ -1079,7 +1079,7 @@ function xml_to_phpdoc ($str) {
/**
* Converts newlines to PHPDOC prefixes in the given string
* @param $str string
- * @param $tabs integer[optional] number of tabs for indentation
+ * @param $tabs integer [optional] number of tabs for indentation
* @return string PHPDOC string
*/
function newline_to_phpdoc ($str, $tabs = 0) {
@@ -1122,7 +1122,7 @@ function begin_file_output() {
/**
* Ends outputing, and dumps the output to the specified file
- * @param $filename File to dump the output
+ * @param $filename string File to dump the output
*/
function finish_file_output($filename) {
//if (file_exists ($filename)) {
@@ -1196,7 +1196,6 @@ function load_entities()
{
global $phpdocDir;
$result = array();
- $needExpand = array();
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($phpdocDir));
foreach ($iterator as $file) {
if (! $file->isFile() || !in_array($file->getExtension(), array("xml", "ent"))) {
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/TraitUseStatement.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/TraitUseStatement.java
index f7de83963..0dad80bb8 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/TraitUseStatement.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/TraitUseStatement.java
@@ -40,7 +40,6 @@ public class TraitUseStatement extends Statement {
super(start, end);
assert traitList != null;
- assert tsList != null;
this.traitList = traitList;
this.tsList = tsList;
}
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/TypeReferenceEvaluator.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/TypeReferenceEvaluator.java
index 4c4bd9be4..4f120e0bc 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/TypeReferenceEvaluator.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/TypeReferenceEvaluator.java
@@ -29,6 +29,7 @@ import org.eclipse.dltk.ast.references.SimpleReference;
import org.eclipse.dltk.ast.references.TypeReference;
import org.eclipse.dltk.core.*;
import org.eclipse.dltk.evaluation.types.AmbiguousType;
+import org.eclipse.dltk.evaluation.types.MultiTypeType;
import org.eclipse.dltk.evaluation.types.UnknownType;
import org.eclipse.dltk.internal.core.ImportDeclaration;
import org.eclipse.dltk.ti.GoalState;
@@ -186,9 +187,9 @@ public class TypeReferenceEvaluator extends GoalEvaluator {
elementType = ((FullyQualifiedReference) typeReference).getElementType();
} else {
fullyQualifiedName = typeReference.getName();
+ fullyQualifiedName = PHPEvaluationUtils.extractArrayType(fullyQualifiedName);
- elementName = PHPEvaluationUtils.extractArrayType(fullyQualifiedName);
- elementName = PHPModelUtils.extractElementName(elementName);
+ elementName = PHPModelUtils.extractElementName(fullyQualifiedName);
}
ISourceModule sourceModule = ((ISourceModuleContext) context).getSourceModule();
int offset = typeReference.sourceStart();
@@ -239,7 +240,8 @@ public class TypeReferenceEvaluator extends GoalEvaluator {
parentNamespace = extractedNamespace;
// See also code from PHPClassType.fromTypeName(...) and
// PHPClassType.fromTraitName(...)
- elementName = PHPModelUtils.getRealName(extractedNamespace, fullyQualifiedName, sourceModule, offset, elementName);
+ elementName = PHPModelUtils.getRealName(extractedNamespace, fullyQualifiedName, sourceModule, offset,
+ elementName);
}
if (PHPModelUtils.isInUseTraitStatement(((ISourceModuleContext) context).getRootNode(),
typeReference.sourceStart())) {
@@ -261,6 +263,12 @@ public class TypeReferenceEvaluator extends GoalEvaluator {
result = new PHPClassType(elementName);
}
}
+ if (PHPEvaluationUtils.isArrayType(typeReference.getName())) {
+ // XXX Quick Fix for bug 549308
+ MultiTypeType tmp = new MultiTypeType();
+ tmp.addType(result);
+ result = tmp;
+ }
}
return IGoal.NO_GOALS;
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/ClassHighlighting.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/ClassHighlighting.java
index 16eb98f24..dbe46ab5f 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/ClassHighlighting.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/ClassHighlighting.java
@@ -21,9 +21,9 @@ import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticApply;
import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticHighlighting;
public class ClassHighlighting extends AbstractSemanticHighlighting {
- private final static String SELF = "self"; //$NON-NLS-1$
- private final static String PARENT = "parent"; //$NON-NLS-1$
- private final static String CLASS = "class"; //$NON-NLS-1$
+ public final static String SELF = "self"; //$NON-NLS-1$
+ public final static String PARENT = "parent"; //$NON-NLS-1$
+ public final static String CLASS = "class"; //$NON-NLS-1$
protected class ClassApply extends AbstractSemanticApply {
@@ -85,6 +85,7 @@ public class ClassHighlighting extends AbstractSemanticHighlighting {
highlightNamespaceType((NamespaceName) name, true);
} else if (name instanceof Identifier) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=496045
+ // See also DeprecatedHighlighting#visit(ClassName)
if (SELF.equalsIgnoreCase(((Identifier) name).getName())
|| CLASS.equalsIgnoreCase(((Identifier) name).getName())
|| PARENT.equalsIgnoreCase(((Identifier) name).getName())) {
@@ -194,6 +195,9 @@ public class ClassHighlighting extends AbstractSemanticHighlighting {
return true;
}
+ /**
+ * @see DeprecatedHighlighting#highlightStatic(StaticDispatch)
+ */
private void highlightStatic(StaticDispatch dispatch) {
Expression className = dispatch.getClassName();
if (className instanceof NamespaceName) {
@@ -210,6 +214,9 @@ public class ClassHighlighting extends AbstractSemanticHighlighting {
highlightNamespaceType(name, false);
}
+ /**
+ * @see DeprecatedHighlighting#highlightLastNamespaceSegment(NamespaceName)
+ */
private void highlightNamespaceType(NamespaceName name, boolean excludeSelf) {
List<Identifier> segments = name.segments();
if (segments.size() > 0) {
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
index abd5d3469..82824d341 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/editor/highlighters/DeprecatedHighlighting.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 Zend Corporation and IBM Corporation.
+ * Copyright (c) 2006-2019 Zend Corporation and IBM Corporation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
@@ -24,7 +24,12 @@ import org.eclipse.php.internal.ui.Logger;
import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticApply;
import org.eclipse.php.internal.ui.editor.highlighter.AbstractSemanticHighlighting;
import org.eclipse.php.internal.ui.editor.highlighter.ModelUtils;
+import org.eclipse.php.internal.ui.editor.highlighters.ClassHighlighting.ClassApply;
+/**
+ * @see ClassHighlighting because the DeprecatedHighlighting class highlights
+ * (mostly) same elements as the ClassHighlighting class
+ */
public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
protected class DeprecatedApply extends AbstractSemanticApply {
@@ -57,26 +62,34 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
}
@Override
- public boolean visit(ClassName classConst) {
- if (classConst.getName() instanceof Identifier) {
+ public boolean visit(ClassDeclaration clazz) {
+ Expression superClass = clazz.getSuperClass();
+ if (superClass instanceof Identifier) {
+ highlightWhenIdentifierIsDeprecated((Identifier) superClass);
+ }
+ for (Identifier identifier : clazz.interfaces()) {
+ highlightWhenIdentifierIsDeprecated(identifier);
+ }
+ return true;
+ }
- String className = ((Identifier) classConst.getName()).getName();
- IModelAccessCache cache = classConst.getAST().getBindingResolver().getModelAccessCache();
- try {
- IType[] types = PHPModelUtils.getTypes(className, getSourceModule(), classConst.getStart(), cache,
- new NullProgressMonitor());
- if (types != null) {
- for (IType type : types) {
- if (ModelUtils.isDeprecated(type)) {
- highlight(classConst);
- break;
- }
- }
- }
- } catch (ModelException e) {
- Logger.logException(e);
- }
+ @Override
+ public boolean visit(TraitDeclaration trait) {
+ Expression superClass = trait.getSuperClass();
+ if (superClass instanceof Identifier) {
+ highlightWhenIdentifierIsDeprecated((Identifier) superClass);
+ }
+ for (Identifier identifier : trait.interfaces()) {
+ highlightWhenIdentifierIsDeprecated(identifier);
+ }
+ return true;
+ }
+ @Override
+ public boolean visit(ClassName className) {
+ Expression classNode = className.getName();
+ if (classNode instanceof Identifier) {
+ highlightWhenIdentifierIsDeprecated((Identifier) classNode);
}
return true;
}
@@ -86,7 +99,7 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
ITypeBinding type = staticConstantAccess.getClassName().resolveTypeBinding();
if (type != null && ModelUtils.isDeprecated(type.getPHPElement())) {
- highlight(staticConstantAccess.getClassName());
+ highlightStatic(staticConstantAccess);
}
String fieldName = staticConstantAccess.getConstant().getName();
@@ -106,11 +119,40 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
}
@Override
+ public boolean visit(TraitUseStatement node) {
+ List<NamespaceName> traitList = node.getTraitList();
+ for (NamespaceName namespaceName : traitList) {
+ highlightWhenIdentifierIsDeprecated(namespaceName, true);
+ }
+ List<TraitStatement> tsList = node.getTsList();
+ for (TraitStatement traitStatement : tsList) {
+ if (traitStatement instanceof TraitAliasStatement) {
+ TraitAliasStatement statement = (TraitAliasStatement) traitStatement;
+ if (statement.getAlias().getTraitMethod() instanceof FullyQualifiedTraitMethodReference) {
+ FullyQualifiedTraitMethodReference reference = (FullyQualifiedTraitMethodReference) statement
+ .getAlias().getTraitMethod();
+ highlightWhenIdentifierIsDeprecated(reference.getClassName(), true);
+ }
+
+ } else if (traitStatement instanceof TraitPrecedenceStatement) {
+ TraitPrecedenceStatement statement = (TraitPrecedenceStatement) traitStatement;
+ FullyQualifiedTraitMethodReference reference = statement.getPrecedence().getMethodReference();
+ highlightWhenIdentifierIsDeprecated(reference.getClassName(), true);
+ traitList = statement.getPrecedence().getTrList();
+ for (NamespaceName namespaceName : traitList) {
+ highlightWhenIdentifierIsDeprecated(namespaceName, true);
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
public boolean visit(CatchClause catchStatement) {
catchStatement.getClassNames().stream().forEach(e -> {
ITypeBinding type = e.resolveTypeBinding();
if (type != null && ModelUtils.isDeprecated(type.getPHPElement())) {
- highlight(e);
+ highlightIdentifier(e);
}
});
return true;
@@ -121,7 +163,7 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
ITypeBinding type = staticFieldAccess.getClassName().resolveTypeBinding();
if (type != null && ModelUtils.isDeprecated(type.getPHPElement())) {
- highlight(staticFieldAccess.getClassName());
+ highlightStatic(staticFieldAccess);
}
String fieldName = null;
@@ -173,7 +215,7 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
ITypeBinding type = methodInvocation.getClassName().resolveTypeBinding();
if (type != null && ModelUtils.isDeprecated(type.getPHPElement())) {
- highlight(methodInvocation.getClassName());
+ highlightStatic(methodInvocation);
}
IMethod method = ModelUtils.getMethod(methodInvocation);
@@ -224,6 +266,85 @@ public class DeprecatedHighlighting extends AbstractSemanticHighlighting {
return Messages.DeprecatedHighlighting_0;
}
+ /**
+ * @see ClassApply#highlightStatic(StaticDispatch)
+ */
+ private void highlightStatic(StaticDispatch dispatch) {
+ highlightIdentifier(dispatch.getClassName());
+ }
+
+ private void highlightIdentifier(ASTNode node) {
+ if (node instanceof Identifier) {
+ Identifier identifier = (Identifier) node;
+ String typeName = identifier.getName();
+ // SemanticHighlightingPresenter.updatePresentation() sorts the
+ // "highlighting" areas by ascending position.
+ // Any fully-qualified class name highlighting will always be
+ // rendered before its class name highlighting (when their start
+ // positions differ)...
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=496045
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=549957
+ // See also ClassHighlighting#visit(ClassInstanceCreation)
+ // and DeprecatedHighlighting#highlightStatic(StaticDispatch).
+ if (!(ClassHighlighting.SELF.equalsIgnoreCase(typeName)
+ || ClassHighlighting.CLASS.equalsIgnoreCase(typeName)
+ || ClassHighlighting.PARENT.equalsIgnoreCase(typeName))) {
+ // We want to highlight all NamespaceName segments, so don't do
+ // this.highlight(identifier) that will only highlight last
+ // NamespaceName segment.
+ super.highlight(identifier);
+ }
+ if (node instanceof NamespaceName) {
+ // ...so we must render again the class name's
+ // "Deprecated Highlighting" on top of the
+ // class name's "Class Highlighting".
+ highlightLastNamespaceSegment((NamespaceName) node);
+ }
+ } else {
+ super.highlight(node);
+ }
+ }
+
+ /**
+ * @see ClassApply#highlightNamespaceType(NamespaceName, boolean)
+ */
+ private void highlightLastNamespaceSegment(NamespaceName name) {
+ List<Identifier> segments = name.segments();
+ if (segments.size() > 0) {
+ Identifier segment = segments.get(segments.size() - 1);
+
+ if (segments.size() > 1 || name.isGlobal()) {
+ super.highlight(segment);
+ }
+ }
+ }
+
+ private void highlightWhenIdentifierIsDeprecated(Identifier identifier) {
+ highlightWhenIdentifierIsDeprecated(identifier, false);
+ }
+
+ private void highlightWhenIdentifierIsDeprecated(Identifier identifier, boolean isTrait) {
+ String typeName = identifier.getName();
+ IModelAccessCache cache = identifier.getAST().getBindingResolver().getModelAccessCache();
+ try {
+ IType[] types = isTrait
+ ? PHPModelUtils.getTraits(typeName, getSourceModule(), identifier.getStart(), cache,
+ new NullProgressMonitor())
+ : PHPModelUtils.getTypes(typeName, getSourceModule(), identifier.getStart(), cache,
+ new NullProgressMonitor());
+ if (types != null) {
+ for (IType type : types) {
+ if (ModelUtils.isDeprecated(type)) {
+ highlightIdentifier(identifier);
+ break;
+ }
+ }
+ }
+ } catch (ModelException e) {
+ Logger.logException(e);
+ }
+ }
+
@Override
protected AbstractSemanticHighlighting highlight(ASTNode node) {
if (node instanceof NamespaceName) {
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549308_01.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549308_01.pdtt
new file mode 100644
index 000000000..7beec4c70
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549308_01.pdtt
@@ -0,0 +1,31 @@
+--TEST--
+Fix bug 549308
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=true
+--FILE--
+<?php
+namespace App\Tmp;
+
+use App\Foo;
+
+class Bar
+{
+ public function test()
+ {
+ /* @var Foo[] $list */
+ $list = $this->getList();
+
+ foreach ($list as $item) {
+ $item->|
+ }
+ }
+}
+--FILE0--
+<?php
+namespace App;
+final class Foo
+{
+ public function getText() {}
+}
+--EXPECT--
+method(getText)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_02.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_02.pdtt
new file mode 100644
index 000000000..0c719e290
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_02.pdtt
@@ -0,0 +1,31 @@
+--TEST--
+Fix bug 549308
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=true
+--FILE--
+<?php
+namespace App2\Tmp;
+
+use App2\Foo2;
+
+class Bar2
+{
+ public function test()
+ {
+ /* @var Foo2[] $list */
+ $list;
+
+ foreach ($list as $item) {
+ $item->|
+ }
+ }
+}
+--FILE0--
+<?php
+namespace App2;
+final class Foo2
+{
+ public function getText() {}
+}
+--EXPECT--
+method(getText)
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_03.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_03.pdtt
new file mode 100644
index 000000000..2fbd5f4f7
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549309_03.pdtt
@@ -0,0 +1,34 @@
+--TEST--
+Fix bug 549308
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=true
+--FILE--
+<?php
+namespace App3\Tmp;
+
+use App3\Foo3;
+
+class Bar3
+{
+ private function getList() {
+ return array(new Foo3());
+ }
+
+ public function test()
+ {
+ $list = $this->getList();
+
+ foreach ($list as $item) {
+ $item->|
+ }
+ }
+}
+--FILE0--
+<?php
+namespace App3;
+final class Foo3
+{
+ public function getText() {}
+}
+--EXPECT--
+method(getText)
diff --git a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.03.pdtt b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.03.pdtt
index 54b820c80..20c3472f1 100644
--- a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.03.pdtt
+++ b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.03.pdtt
@@ -72,6 +72,7 @@ highlight(F)
highlight(index)
highlight(\App\Entity\A)
highlight(A)
+highlight(A)
highlight(index)
highlight(index)
highlight(index) \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.04.pdtt b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.04.pdtt
index f2c18bfe9..891d74681 100644
--- a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.04.pdtt
+++ b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.04.pdtt
@@ -34,5 +34,6 @@ class B extends \Exception {
}
--EXPECT--
org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting:
+highlight(\App\Entity\F)
highlight(F)
highlight(B) \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.05.pdtt b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.05.pdtt
new file mode 100644
index 000000000..badfcc069
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.05.pdtt
@@ -0,0 +1,46 @@
+--TEST--
+Bug 549957 - Deprecated class highlighting doesn't work on class instantiation
+--FILE--
+<?php
+namespace A\B
+{
+
+ /**
+ *
+ * @deprecated
+ */
+ class myClass
+ {
+ }
+ new myClass();
+ new \A\B\myClass();
+}
+namespace
+{
+
+ /**
+ *
+ * @deprecated
+ */
+ class myClass2
+ {
+ }
+ new myClass2();
+ new \myClass2();
+ new A\B\myClass();
+ new \A\B\myClass();
+}
+--EXPECT--
+org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting:
+highlight(myClass)
+highlight(myClass2)
+highlight(myClass)
+highlight(\A\B\myClass)
+highlight(myClass)
+highlight(myClass2)
+highlight(\myClass2)
+highlight(myClass2)
+highlight(A\B\myClass)
+highlight(myClass)
+highlight(\A\B\myClass)
+highlight(myClass) \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.06.pdtt b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.06.pdtt
new file mode 100644
index 000000000..b977097ff
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php53/deprecated.06.pdtt
@@ -0,0 +1,90 @@
+--TEST--
+Bug 549957 - Deprecated class highlighting doesn't work on class instantiation
+--FILE--
+<?php
+namespace A\B;
+
+/**
+ *
+ * @deprecated
+ */
+class myClass3
+{
+
+ /**
+ *
+ * @return integer
+ * @deprecated
+ */
+ public function foo1()
+ {
+ return 1;
+ }
+}
+
+/**
+ *
+ * @deprecated
+ */
+class myClass4 extends myClass3
+{
+
+ /**
+ *
+ * @var integer
+ * @deprecated
+ */
+ public static $a = 1;
+
+ /**
+ *
+ * @return integer
+ * @deprecated
+ */
+ public function foo1()
+ {
+ return self::$a;
+ }
+
+ /**
+ *
+ * @return integer
+ * @deprecated
+ */
+ public function foo2()
+ {
+ new parent();
+ myClass3::foo1();
+ \A\B\myClass3::foo1();
+ parent::foo1();
+ return self::foo1();
+ }
+}
+
+/**
+ *
+ * @deprecated
+ */
+class myClass5 extends \A\B\myClass3
+{
+}
+--EXPECT--
+org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting:
+highlight(myClass3)
+highlight(foo1)
+highlight(myClass4)
+highlight($a)
+highlight(foo1)
+highlight(foo2)
+highlight(myClass5)
+highlight(myClass3)
+highlight($a)
+highlight(myClass3)
+highlight(foo1)
+highlight(\A\B\myClass3)
+highlight(myClass3)
+highlight(foo1)
+highlight(foo1)
+highlight(foo1)
+highlight(\A\B\myClass3)
+highlight(myClass3) \ No newline at end of file
diff --git a/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php54/deprecated.pdtt b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php54/deprecated.pdtt
new file mode 100644
index 000000000..5a408f892
--- /dev/null
+++ b/tests/org.eclipse.php.ui.tests/workspace/semantic_highlighting/php54/deprecated.pdtt
@@ -0,0 +1,119 @@
+--TEST--
+No bug - Add Deprecation highlighting on class&trait inheritance and use trait statements
+--FILE--
+<?php
+namespace C\D;
+
+/**
+ *
+ * @deprecated
+ */
+trait A
+{
+
+ /**
+ *
+ * @deprecated
+ */
+ public function smallTalk()
+ {
+ echo 'a';
+ }
+
+ /**
+ *
+ * @deprecated
+ */
+ public function bigTalk()
+ {
+ echo 'A';
+ }
+}
+
+/**
+ *
+ * @deprecated
+ */
+trait B
+{
+
+ /**
+ *
+ * @deprecated
+ */
+ public function smallTalk()
+ {
+ echo 'b';
+ }
+
+ /**
+ *
+ * @deprecated
+ */
+ public function bigTalk()
+ {
+ echo 'B';
+ }
+}
+
+/**
+ *
+ * @deprecated
+ */
+class Talker
+{
+ use \C\D\A, \C\D\B {
+ \C\D\B::smallTalk insteadof \C\D\A;
+ \C\D\A::bigTalk insteadof \C\D\B;
+ }
+}
+
+/**
+ *
+ * @deprecated
+ */
+class Aliased_Talker
+{
+ use \C\D\A, \C\D\B {
+ \C\D\B::smallTalk insteadof \C\D\A;
+ \C\D\A::bigTalk insteadof \C\D\B;
+ \C\D\B::bigTalk as talk;
+ }
+}
+?>
+--EXPECT--
+org.eclipse.php.internal.ui.editor.highlighters.DeprecatedHighlighting:
+highlight(A)
+highlight(smallTalk)
+highlight(bigTalk)
+highlight(B)
+highlight(smallTalk)
+highlight(bigTalk)
+highlight(Talker)
+highlight(Aliased_Talker)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\A)
+highlight(A)
+highlight(\C\D\B)
+highlight(B)
+highlight(\C\D\B)
+highlight(B) \ No newline at end of file

Back to the top