ICompletionContext context = getContext();
if (!(context instanceof MethodNameContext)) {
return;
}
MethodNameContext concreteContext = (MethodNameContext) context;
CompletionRequestor requestor = concreteContext
.getCompletionRequestor();
String prefix = concreteContext.getPrefix();
boolean exactName = requestor.isContextInformationMode();
IType declaringClass = concreteContext.getDeclaringClass();
String suffix = getSuffix(concreteContext);
SourceRange replaceRange = null;
if (suffix.equals("")) { //$NON-NLS-1$
replaceRange = getReplacementRange(concreteContext);
} else {
replaceRange = getReplacementRangeWithBraces(concreteContext);
}
try {
ITypeHierarchy hierarchy = getCompanion().getSuperTypeHierarchy(
declaringClass, null);
IMethod[] superClassMethods = PHPModelUtils
.getSuperTypeHierarchyMethod(declaringClass, hierarchy,
prefix, exactName, null);
for (IMethod superMethod : superClassMethods) {
if (declaringClass.getMethod(superMethod.getElementName())
.exists()) {
continue;
}
int flags = superMethod.getFlags();
if (!PHPFlags.isFinal(flags) && !PHPFlags.isPrivate(flags)
&& !PHPFlags.isStatic(flags)) {
reporter.reportMethod(superMethod, CONSTRUCTOR_SUFFIX,
replaceRange);
}
}
} catch (CoreException e) {
PHPCorePlugin.log(e);
}
PHPVersion phpVersion = concreteContext.getPhpVersion();
// Add magic methods:
Set<String> functions = new TreeSet<String>();
functions.addAll(Arrays.asList(PHPMagicMethods.getMethods(phpVersion)));