private void collectSuperClasses(IScriptProject project, String typeName, Set superClassSet) {

    Set typeSet = new HashSet();
    searchTypeDeclarations(project, typeName, typeSet);

    if (typeSet.isEmpty() != true) {
      IType itype;
      String[] superClasses;
      for (Iterator typeIter = typeSet.iterator(); typeIter.hasNext(); ) {
        itype = (IType) typeIter.next();
        if (itype.exists()) {
          try {
            superClasses = itype.getSuperClasses();
            if (superClasses != null) {
              for (int cnt = 0, max = superClasses.length; cnt < max; cnt++) {
                if (!superClassSet.contains(superClasses[cnt])) {
                  superClassSet.add(superClasses[cnt]);

                  collectSuperClasses(project, superClasses[cnt], superClassSet);
                }
              }
            }
          } catch (ModelException mxcn) {
            mxcn.printStackTrace();
          }
        }
      }
    }
  }
  private IHyperlink getControllerlink(ViewPath viewPath, IRegion wordRegion) {

    IType controller =
        SymfonyModelAccess.getDefault()
            .findController(
                viewPath.getBundle(), viewPath.getController(), input.getScriptProject());

    if (controller != null) {

      String tpl = viewPath.getTemplate();

      // try to open a corresponding action
      try {
        String action = tpl.substring(0, tpl.indexOf("."));

        if (action.length() > 0) {
          IMethod method = controller.getMethod(action + "Action");
          return new ModelElementHyperlink(wordRegion, method, new OpenAction(editor));
        }
      } catch (Exception e) {
        // ignore and open the controller
      }

      return new ModelElementHyperlink(wordRegion, controller, new OpenAction(editor));
    }

    return null;
  }
  /**
   * Search for magic variables using the @property tag
   *
   * @param types
   * @param variableName
   * @param cache
   */
  private void resolveMagicClassVariableDeclaration(
      IType[] types, String variableName, IModelAccessCache cache) {
    for (IType type : types) {
      resolveMagicClassVariableDeclaration(variableName, type, cache);
      try {
        if (evaluated.isEmpty()
            && type.getSuperClasses() != null
            && type.getSuperClasses().length > 0) {

          ITypeHierarchy hierarchy = null;
          if (cache != null) {
            hierarchy = cache.getSuperTypeHierarchy(type, null);
          }
          IType[] superClasses = PHPModelUtils.getSuperClasses(type, hierarchy);

          for (int i = 0; i < superClasses.length /* && evaluated.isEmpty() */; i++) {
            IType superClass = superClasses[i];
            resolveMagicClassVariableDeclaration(variableName, superClass, cache);
          }
        }
      } catch (ModelException e) {
        e.printStackTrace();
      }
    }
  }
Example #4
0
  public void apply(ICompletionReporter reporter) throws BadLocationException {

    ICompletionContext context = getContext();
    AbstractCompletionContext abstractContext = (AbstractCompletionContext) context;
    if (abstractContext.getPrefixWithoutProcessing().trim().length() == 0) {
      return;
    }
    SourceRange replacementRange = getReplacementRange(abstractContext);

    IType[] types = getTypes(abstractContext);
    // now we compute type suffix in PHPCompletionProposalCollector
    String suffix = ""; // $NON-NLS-1$
    String nsSuffix = getNSSuffix(abstractContext);

    for (IType type : types) {
      try {
        int flags = type.getFlags();
        reporter.reportType(
            type,
            PHPFlags.isNamespace(flags) ? nsSuffix : suffix,
            replacementRange,
            getExtraInfo());
      } catch (ModelException e) {
        PHPCorePlugin.log(e);
      }
    }
    addAlias(reporter, suffix);
  }
  protected void getGoalFromStaticDeclaration(
      String variableName, final List<IGoal> subGoals, final IType declaringType, IType realType)
      throws ModelException {
    ISourceModule sourceModule = declaringType.getSourceModule();
    ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceModule);
    TypeDeclaration typeDeclaration =
        PHPModelUtils.getNodeByClass(moduleDeclaration, declaringType);

    // try to search declarations of type "self::$var =" or
    // "$this->var ="
    ClassDeclarationSearcher searcher;
    if (realType != null) {
      searcher =
          new ClassDeclarationSearcher(
              sourceModule, typeDeclaration, 0, 0, variableName, realType, declaringType);
    } else {
      searcher = new ClassDeclarationSearcher(sourceModule, typeDeclaration, 0, 0, variableName);
    }
    try {
      moduleDeclaration.traverse(searcher);
      Map<ASTNode, IContext> staticDeclarations = searcher.getStaticDeclarations();
      for (ASTNode node : staticDeclarations.keySet()) {
        IContext context = staticDeclarations.get(node);
        if (context instanceof MethodContext) {
          MethodContext methodContext = (MethodContext) context;
          methodContext.setCurrentType(realType);
        }
        subGoals.add(new ExpressionTypeGoal(context, node));
      }
    } catch (Exception e) {
      if (DLTKCore.DEBUG) {
        e.printStackTrace();
      }
    }
  }
  /**
   * Returns all of the openables defined in the region of this type hierarchy. Returns a map from
   * IJavaProject to ArrayList of Openable
   */
  private HashMap determineOpenablesInRegion(IProgressMonitor monitor) {

    try {
      HashMap allOpenables = new HashMap();
      IModelElement[] roots = ((RegionBasedTypeHierarchy) this.hierarchy).region.getElements();
      int length = roots.length;
      if (monitor != null) {
        monitor.beginTask("", length); // $NON-NLS-1$
      }
      for (int i = 0; i < length; i++) {
        IModelElement root = roots[i];
        IScriptProject javaProject = root.getScriptProject();
        ArrayList openables = (ArrayList) allOpenables.get(javaProject);
        if (openables == null) {
          openables = new ArrayList();
          allOpenables.put(javaProject, openables);
        }
        switch (root.getElementType()) {
          case IModelElement.SCRIPT_PROJECT:
            injectAllOpenablesForJavaProject((IScriptProject) root, openables);
            break;
          case IModelElement.PROJECT_FRAGMENT:
            injectAllOpenablesForPackageFragmentRoot((IProjectFragment) root, openables);
            break;
          case IModelElement.SCRIPT_FOLDER:
            injectAllOpenablesForPackageFragment((IScriptFolder) root, openables);
            break;
          case IModelElement.SOURCE_MODULE:
            openables.add(root);
            break;
          case IModelElement.TYPE:
            IType type = (IType) root;
            openables.add(type.getSourceModule());
            break;
          default:
            break;
        }
        worked(monitor, 1);
      }
      return allOpenables;
    } finally {
      if (monitor != null) {
        monitor.done();
      }
    }
  }
Example #7
0
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   ModelClassType other = (ModelClassType) obj;
   if (fClass == null) {
     if (other.fClass != null) return false;
   } else if (!fClass.equals(other.fClass)) return false;
   return true;
 }
  public void apply(ICompletionReporter reporter) throws BadLocationException {
    ICompletionContext context = getContext();
    if (!(context instanceof NamespaceMemberContext)) {
      return;
    }

    NamespaceMemberContext concreteContext = (NamespaceMemberContext) context;
    String prefix = concreteContext.getPrefix();
    String suffix = getSuffix(concreteContext);
    ISourceRange replaceRange = getReplacementRange(concreteContext);

    for (IType ns : concreteContext.getNamespaces()) {
      try {
        for (IMethod method : ns.getMethods()) {
          if (StringUtils.startsWithIgnoreCase(method.getElementName(), prefix)) {
            reporter.reportMethod(method, suffix, replaceRange);
          }
        }
      } catch (ModelException e) {
        PHPCorePlugin.log(e);
      }
    }
  }
 private static Integer[] createOffsetArray(IType[] types) throws ModelException {
   List result = new ArrayList();
   for (int i = 0; i < types.length; i++) {
     IType iType = types[i];
     addOffset(result, iType.getNameRange().getOffset());
     addOffset(result, iType.getSourceRange().getOffset() + iType.getSourceRange().getLength());
     addMemberOffsetList(result, iType.getMethods());
     addMemberOffsetList(result, iType.getFields());
     // addMemberOffsetList(result, iType.getInitializers());
   }
   return (Integer[]) result.toArray(new Integer[result.size()]);
 }
  public IGoal[] init() {
    ClassVariableDeclarationGoal typedGoal = (ClassVariableDeclarationGoal) goal;
    IType[] types = typedGoal.getTypes();

    if (types == null) {
      TypeContext context = (TypeContext) typedGoal.getContext();
      types = PHPTypeInferenceUtils.getModelElements(context.getInstanceType(), context);
    }
    if (types == null) {
      return null;
    }

    IContext context = typedGoal.getContext();
    IModelAccessCache cache = null;
    if (context instanceof IModelCacheContext) {
      cache = ((IModelCacheContext) context).getCache();
    }

    String variableName = typedGoal.getVariableName();

    final List<IGoal> subGoals = new LinkedList<IGoal>();
    for (final IType type : types) {
      try {
        ITypeHierarchy hierarchy = null;
        if (cache != null) {
          hierarchy = cache.getSuperTypeHierarchy(type, null);
        }
        IField[] fields =
            PHPModelUtils.getTypeHierarchyField(type, hierarchy, variableName, true, null);
        Map<IType, IType> fieldDeclaringTypeSet = new HashMap<IType, IType>();
        for (IField field : fields) {
          IType declaringType = field.getDeclaringType();
          if (declaringType != null) {
            fieldDeclaringTypeSet.put(declaringType, type);
            ISourceModule sourceModule = declaringType.getSourceModule();
            ModuleDeclaration moduleDeclaration =
                SourceParserUtil.getModuleDeclaration(sourceModule);
            TypeDeclaration typeDeclaration =
                PHPModelUtils.getNodeByClass(moduleDeclaration, declaringType);

            if (typeDeclaration != null && field instanceof SourceRefElement) {
              SourceRefElement sourceRefElement = (SourceRefElement) field;
              ISourceRange sourceRange = sourceRefElement.getSourceRange();

              ClassDeclarationSearcher searcher =
                  new ClassDeclarationSearcher(
                      sourceModule,
                      typeDeclaration,
                      sourceRange.getOffset(),
                      sourceRange.getLength(),
                      null,
                      type,
                      declaringType);
              try {
                moduleDeclaration.traverse(searcher);
                if (searcher.getResult() != null) {
                  subGoals.add(new ExpressionTypeGoal(searcher.getContext(), searcher.getResult()));
                }
              } catch (Exception e) {
                if (DLTKCore.DEBUG) {
                  e.printStackTrace();
                }
              }
            }
          }
        }

        if (subGoals.size() == 0) {
          getGoalFromStaticDeclaration(variableName, subGoals, type, null);
        }
        fieldDeclaringTypeSet.remove(type);
        if (subGoals.size() == 0 && !fieldDeclaringTypeSet.isEmpty()) {
          for (Iterator iterator = fieldDeclaringTypeSet.keySet().iterator();
              iterator.hasNext(); ) {
            IType fieldDeclaringType = (IType) iterator.next();
            getGoalFromStaticDeclaration(
                variableName,
                subGoals,
                fieldDeclaringType,
                fieldDeclaringTypeSet.get(fieldDeclaringType));
          }
        }
      } catch (CoreException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
      }
    }

    resolveMagicClassVariableDeclaration(types, variableName, cache);

    return subGoals.toArray(new IGoal[subGoals.size()]);
  }
  @Override
  public void apply(ICompletionReporter reporter) throws BadLocationException {

    ViewPathArgumentContext context = (ViewPathArgumentContext) getContext();
    CompletionRequestor req = context.getCompletionRequestor();

    if (req.getClass() == PHPCompletionProposalCollector.class) {
      return;
    }

    if (workaroundCount == 0) {
      workaroundCount++;

    } else {
      workaroundCount = 0;
      return;
    }

    SymfonyModelAccess model = SymfonyModelAccess.getDefault();
    ISourceModule module = context.getSourceModule();
    ViewPath viewPath = context.getViewPath();

    String bundle = viewPath.getBundle();
    String controller = viewPath.getController();
    String template = viewPath.getTemplate();
    SourceRange range = getReplacementRange(context);
    IDLTKSearchScope projectScope =
        SearchEngine.createSearchScope(context.getSourceModule().getScriptProject());

    String prefix = context.getPrefix();

    // complete the bundle part
    if (bundle == null && controller == null && template == null) {

      List<Bundle> bundles = model.findBundles(context.getSourceModule().getScriptProject());

      for (Bundle b : bundles) {

        IType[] bundleTypes =
            PhpModelAccess.getDefault()
                .findTypes(b.getElementName(), MatchRule.EXACT, 0, 0, projectScope, null);

        if (bundleTypes.length == 1) {

          ModelElement bType = (ModelElement) bundleTypes[0];

          if (CodeAssistUtils.startsWithIgnoreCase(bType.getElementName(), prefix)) {
            Bundle bundleType = new Bundle(bType, b.getElementName());
            reporter.reportType(bundleType, ":", range);
          }
        }
      }

      // complete the controller part: "Bundle:|
    } else if (controller == null && template == null) {

      IType[] controllers = model.findBundleControllers(bundle, module.getScriptProject());

      if (controllers != null) {
        for (IType ctrl : controllers) {

          String name = ctrl.getElementName().replace("Controller", "");
          if (!name.endsWith("\\")) {
            Controller con = new Controller((ModelElement) ctrl, name);
            reporter.reportType(con, ":", range);
          }
        }
      }

      // complete template path: "Bundle:Controller:|
    } else if (bundle != null && controller != null && template == null) {

      IModelElement[] templates =
          model.findTemplates(bundle, controller, module.getScriptProject());

      if (templates != null) {
        for (IModelElement tpl : templates) {

          if (CodeAssistUtils.startsWithIgnoreCase(tpl.getElementName(), prefix)) {
            Template t = new Template((ModelElement) tpl, tpl.getElementName());
            reporter.reportType(t, "", range);
          }
        }
      }

      // project root: "::|
    } else if (bundle == null && controller == null && template != null) {

      IModelElement[] templates = model.findRootTemplates(module.getScriptProject());

      if (templates != null) {
        for (IModelElement tpl : templates) {

          if (CodeAssistUtils.startsWithIgnoreCase(tpl.getElementName(), prefix)) {
            Template t = new Template((ModelElement) tpl, tpl.getElementName());
            reporter.reportType(t, "", range);
          }
        }
      }

      // bundle root: "AcmeDemoBundle::|
    } else if (bundle != null && controller == null && template != null) {

      IModelElement[] templates = model.findBundleRootTemplates(bundle, module.getScriptProject());

      if (templates != null) {
        for (IModelElement tpl : templates) {

          if (CodeAssistUtils.startsWithIgnoreCase(tpl.getElementName(), prefix)) {
            Template t = new Template((ModelElement) tpl, tpl.getElementName());
            reporter.reportType(t, "", range);
          }
        }
      }
    }
  }
Example #12
0
 public String getTypeName() {
   if (fClass != null) {
     return "class:" + fClass.getElementName(); // $NON-NLS-1$
   }
   return "class: !!unknown!!"; //$NON-NLS-1$
 }
Example #13
0
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((fClass == null) ? 0 : fClass.hashCode());
   return result;
 }
 /**
  * Get Record type def from {@link ISourceModule} <br>
  * DLTK Model => AST
  */
 public static TypeDef getTypeDef(IType type) {
   LuaSourceRoot luaSourceRoot = getLuaSourceRoot(type.getSourceModule());
   LuaFileAPI fileapi = luaSourceRoot.getFileapi();
   return fileapi.getTypes().get(type.getElementName());
 }
  /**
   * Get IMember from Item <br>
   * AST => DLTK Model
   */
  public static IMember getIMember(ISourceModule sourceModule, Item item) {
    LuaASTNode parent = item.getParent();
    if (LuaASTUtils.isTypeField(item)) {
      // support record field
      IType iType = getIType(sourceModule, (RecordTypeDef) parent);
      if (iType != null) {
        try {
          for (IModelElement child : iType.getChildren()) {
            if (child.getElementName().equals(item.getName()) && child instanceof IMember)
              return (IMember) child;
          }
        } catch (ModelException e) {
          Activator.logWarning(
              "unable to get IMember corresponding to the given item " + item, e); // $NON-NLS-1$
        }
      }
    } else if (LuaASTUtils.isLocal(item)) {
      // TODO retrieve local var which are in the model (so the local var in the first block)
      // support local variable
      // ------------------------------------------------------------------------------------

      // manage method
      TypeDef resolvedtype = LuaASTUtils.resolveTypeLocaly(sourceModule, item);
      if (resolvedtype != null && resolvedtype instanceof FunctionTypeDef) {
        FunctionTypeDef functionResolvedType = (FunctionTypeDef) resolvedtype;
        String[] parametersName = new String[functionResolvedType.getParameters().size()];
        for (int i = 0; i < parametersName.length; i++) {
          parametersName[i] = functionResolvedType.getParameters().get(i).getName();
        }
        return new FakeMethod(
            sourceModule,
            item.getName(),
            item.sourceStart(),
            item.getName().length(),
            parametersName,
            Declaration.AccPrivate,
            item);
      }
      // manage field
      return new FakeField(
          sourceModule,
          item.getName(),
          item.sourceStart(),
          item.getName().length(),
          Declaration.AccPrivate,
          item);
    } else if (LuaASTUtils.isGlobal(item)) {
      // support global var
      try {
        for (IModelElement child : sourceModule.getChildren()) {
          if (child.getElementName().equals(item.getName()) && child instanceof IMember)
            return (IMember) child;
        }
      } catch (ModelException e) {
        Activator.logWarning(
            "unable to get IMember corresponding to the given item " + item, e); // $NON-NLS-1$
      }
    } else if (LuaASTUtils.isUnresolvedGlobal(item)) {
      return new FakeField(
          sourceModule,
          item.getName(),
          item.sourceStart(),
          item.getName().length(),
          Declaration.AccGlobal,
          item);
    }
    return null;
  }
 /**
  * This implementation builds only supertype hierarchy for the given focus type.
  *
  * @see HierarchyScope#createHierarchy(IType, WorkingCopyOwner, IProgressMonitor)
  */
 protected ITypeHierarchy createHierarchy(
     IType focusType, WorkingCopyOwner owner, IProgressMonitor monitor) throws ModelException {
   return focusType.newSupertypeHierarchy(owner, monitor);
 }
  private void initRelativeNamespace(ISourceModule sourceModule, int offset, String lastWord) {
    String nsName = lastWord;
    String fullName = lastWord;
    nsPrefix = null;
    if (lastWord.lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
      nsPrefix =
          lastWord.substring(0, lastWord.lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR));
      nsName = nsName.substring(0, nsName.lastIndexOf(NamespaceReference.NAMESPACE_SEPARATOR) + 1);

      try {
        namespaces = PHPModelUtils.getNamespaceOf(nsName, sourceModule, offset, null, null);
      } catch (ModelException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
      }
    } else {
      namespaces = PhpModelAccess.NULL_TYPES;
    }
    if (lastWord.startsWith(NamespaceReference.NAMESPACE_DELIMITER)) {
      nsPrefix = null;
    } else {

      currentNS = null;
      try {
        IModelElement enclosingElement = getEnclosingElement();
        if (enclosingElement != null) {
          IType type = (IType) enclosingElement.getAncestor(IModelElement.TYPE);
          if (type != null && type.getParent() instanceof IType) {
            type = (IType) type.getParent();
          }
          if (type != null && (PHPFlags.isNamespace(type.getFlags()))) {
            currentNS = type;
            fullName =
                NamespaceReference.NAMESPACE_SEPARATOR
                    + currentNS.getElementName()
                    + NamespaceReference.NAMESPACE_SEPARATOR
                    + lastWord;
          } else {

          }
        }
      } catch (ModelException e1) {
        e1.printStackTrace();
      }
      if (currentNS != null) {
        if (nsPrefix == null) {
          nsPrefix = currentNS.getElementName();
        } else {
          nsPrefix = currentNS.getElementName() + NamespaceReference.NAMESPACE_SEPARATOR + nsPrefix;
        }
      }
    }

    IDLTKSearchScope scope = SearchEngine.createSearchScope(sourceModule.getScriptProject());
    if (fullName.startsWith(NamespaceReference.NAMESPACE_DELIMITER)) {
      fullName = fullName.substring(1);
    }
    possibleNamespaces =
        PhpModelAccess.getDefault()
            .findNamespaces(null, fullName, MatchRule.PREFIX, 0, 0, scope, null);
  }
Example #18
0
  /**
   * Adds the self function with the relevant data to the proposals array
   *
   * @param context
   * @param reporter
   * @throws BadLocationException
   */
  protected void addSelf(AbstractCompletionContext context, ICompletionReporter reporter)
      throws BadLocationException {

    String prefix = context.getPrefix();
    SourceRange replaceRange = getReplacementRange(context);

    if (CodeAssistUtils.startsWithIgnoreCase("self", prefix)) {
      if (!context.getCompletionRequestor().isContextInformationMode()
          || prefix.length() == 4) { // "self".length()

        String suffix = getSuffix(context);

        // get the class data for "self". In case of null, the self
        // function will not be added
        IType selfClassData =
            CodeAssistUtils.getSelfClassData(context.getSourceModule(), context.getOffset());
        if (selfClassData != null) {
          try {
            IMethod ctor = null;
            for (IMethod method : selfClassData.getMethods()) {
              if (method.isConstructor()) {
                ctor = method;
                break;
              }
            }
            if (ctor != null) {
              ISourceRange sourceRange = selfClassData.getSourceRange();
              FakeMethod ctorMethod =
                  new FakeMethod(
                      (ModelElement) selfClassData,
                      "self",
                      sourceRange.getOffset(),
                      sourceRange.getLength(),
                      sourceRange.getOffset(),
                      sourceRange.getLength()) {
                    public boolean isConstructor() throws ModelException {
                      return true;
                    }
                  };
              ctorMethod.setParameters(ctor.getParameters());
              reporter.reportMethod(ctorMethod, suffix, replaceRange);
            } else {
              ISourceRange sourceRange = selfClassData.getSourceRange();
              reporter.reportMethod(
                  new FakeMethod(
                      (ModelElement) selfClassData,
                      "self",
                      sourceRange.getOffset(),
                      sourceRange.getLength(),
                      sourceRange.getOffset(),
                      sourceRange.getLength()),
                  "()",
                  replaceRange);
            }
          } catch (ModelException e) {
            PHPCorePlugin.log(e);
          }
        }
      }
    }
  }
 protected String processTypeName(IType type, String token) {
   return type.getElementName();
 }
  public IGoal[] init() {
    PHPDocClassVariableGoal typedGoal = (PHPDocClassVariableGoal) goal;
    TypeContext context = (TypeContext) typedGoal.getContext();
    String variableName = typedGoal.getVariableName();
    int offset = typedGoal.getOffset();

    IModelAccessCache cache = context.getCache();
    IType[] types =
        PHPTypeInferenceUtils.getModelElements(context.getInstanceType(), context, offset, cache);
    Map<PHPDocBlock, IField> docs = new HashMap<PHPDocBlock, IField>();
    // remove array index from field name
    if (variableName.endsWith("]")) { // $NON-NLS-1$
      int index = variableName.indexOf("["); // $NON-NLS-1$
      if (index != -1) {
        variableName = variableName.substring(0, index);
      }
    }
    if (types != null) {
      for (IType type : types) {
        try {
          // we look in whole hiearchy
          ITypeHierarchy superHierarchy;
          if (cache != null) {
            superHierarchy = cache.getSuperTypeHierarchy(type, null);
          } else {
            superHierarchy = type.newSupertypeHierarchy(null);
          }
          IType[] superTypes = superHierarchy.getAllTypes();
          for (IType superType : superTypes) {
            IField[] typeField = PHPModelUtils.getTypeField(superType, variableName, true);
            if (typeField.length > 0) {
              PHPDocBlock docBlock = PHPModelUtils.getDocBlock(typeField[0]);
              if (docBlock != null) {
                docs.put(docBlock, typeField[0]);
              }
            }
          }
        } catch (ModelException e) {
          if (DLTKCore.DEBUG) {
            e.printStackTrace();
          }
        }
      }
    }

    for (Entry<PHPDocBlock, IField> entry : docs.entrySet()) {
      PHPDocBlock doc = entry.getKey();
      IField typeField = entry.getValue();
      IType currentNamespace = PHPModelUtils.getCurrentNamespace(typeField);

      IModelElement space =
          currentNamespace != null ? currentNamespace : typeField.getSourceModule();

      for (PHPDocTag tag : doc.getTags(PHPDocTag.VAR)) {
        // do it like for
        // PHPDocumentationContentAccess#handleBlockTags(List tags):
        // variable name can be optional, but if present keep only
        // the good ones
        if (tag.getVariableReference() != null
            && !tag.getVariableReference().getName().equals(variableName)) {
          continue;
        }

        evaluated.addAll(
            Arrays.asList(
                PHPEvaluationUtils.evaluatePHPDocType(
                    tag.getTypeReferences(), space, tag.sourceStart(), null)));
      }
    }

    return IGoal.NO_GOALS;
  }