TraitAliasStatement statement = (TraitAliasStatement) traitStatement;
if (statement.getAlias().getTraitMethod() instanceof FullyQualifiedTraitMethodReference) {
FullyQualifiedTraitMethodReference reference = (FullyQualifiedTraitMethodReference) statement
.getAlias().getTraitMethod();
IEvaluatedType type = PHPClassType.fromTraitName(
PHPModelUtils.getFullName(reference
.getClassName()), sourceModule,
traitStatement.getStart());
IType[] modelElements = PHPTypeInferenceUtils
.getModelElements(type, context,
traitStatement.getStart(), statement
.getAST().getBindingResolver()
.getModelAccessCache());
if (modelElements != null && modelElements.length > 0) {
for (IType iType : modelElements) {
boolean shouldBreak = false;
try {
IModelElement[] children = iType
.getChildren();
for (IModelElement iModelElement : children) {
if (iModelElement.getElementName()
.equals(reference
.getFunctionName()
.getName())
&& (iModelElement instanceof IMethod)) {
highlight(reference
.getFunctionName());
shouldBreak = true;
break;
}
}
} catch (ModelException e) {
e.printStackTrace();
}
if (shouldBreak) {
break;
}
}
}
} else {
Identifier method = (Identifier) statement.getAlias()
.getTraitMethod();
List<NamespaceName> traitList = node.getTraitList();
for (NamespaceName namespaceName : traitList) {
boolean shouldBreak = false;
IEvaluatedType type = PHPClassType.fromTraitName(
PHPModelUtils.getFullName(namespaceName),
sourceModule, traitStatement.getStart());
IType[] modelElements = PHPTypeInferenceUtils
.getModelElements(type, context,
traitStatement.getStart(),
statement.getAST()
.getBindingResolver()
.getModelAccessCache());
if (modelElements != null
&& modelElements.length > 0) {
for (IType iType : modelElements) {
try {
IModelElement[] children = iType
.getChildren();
for (IModelElement iModelElement : children) {
if (iModelElement.getElementName()
.equals(method.getName())
&& (iModelElement instanceof IMethod)) {
highlight(method);
shouldBreak = true;
break;
}
}
} catch (ModelException e) {
e.printStackTrace();
}
if (shouldBreak) {
break;
}
}
}
if (shouldBreak) {
break;
}
}
}
} else if (traitStatement instanceof TraitPrecedenceStatement) {
TraitPrecedenceStatement statement = (TraitPrecedenceStatement) traitStatement;
FullyQualifiedTraitMethodReference reference = statement
.getPrecedence().getMethodReference();
IEvaluatedType type = PHPClassType
.fromTraitName(PHPModelUtils.getFullName(reference
.getClassName()), sourceModule,
traitStatement.getStart());
IType[] modelElements = PHPTypeInferenceUtils
.getModelElements(type, context,