Examples of PHPDocBlock


Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

    String[] typeNames = null;
    if (method instanceof IPHPDocAwareElement) {
      typeNames = ((IPHPDocAwareElement) method).getReturnTypes();
    } else {
      List<String> returnTypeList = new LinkedList<String>();
      PHPDocBlock docBlock = PHPModelUtils.getDocBlock(method);
      if (docBlock == null) {
        return null;
      }
      PHPDocTag[] tags = docBlock.getTags(PHPDocTagKinds.PARAM);
      if (tags != null && tags.length > 0) {
        for (PHPDocTag phpDocTag : tags) {
          if (phpDocTag.getReferences() != null
              && phpDocTag.getReferences().length > 0) {
            for (SimpleReference ref : phpDocTag
                .getReferences()) {
             
              if (ref instanceof TypeReference) {
                String type = ref.getName();
                if (type != null && isValidType(type, project)) {
                  returnTypeList.add(type);
                }               
              }
            }
          }
        }
      }
      typeNames = returnTypeList.toArray(new String[returnTypeList
          .size()]);
    }
    if (typeNames != null) {
      for (String typeName : typeNames) {
        Matcher m = ARRAY_TYPE_PATTERN.matcher(typeName);
        if (m.find()) {
          int offset = 0;
          try {
            offset = method.getSourceRange().getOffset();
          } catch (ModelException e) {
          }
         
          IEvaluatedType t = getArrayType(m.group(), currentNamespace, offset);
          String name = t.getTypeName();
          if (!evaluated.contains(name) && name.startsWith("$"))
            evaluated.add(t);
        } else {

            if (currentNamespace != null) {

              PHPDocBlock docBlock = PHPModelUtils
                  .getDocBlock(method);
              ModuleDeclaration moduleDeclaration = SourceParserUtil
                  .getModuleDeclaration(currentNamespace
                      .getSourceModule());
              if (typeName
                  .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
                // check if the first part
                // is an
                // alias,then get the full
                // name
                String prefix = typeName
                    .substring(
                        0,
                        typeName.indexOf(NamespaceReference.NAMESPACE_SEPARATOR));
                final Map<String, UsePart> result = PHPModelUtils
                    .getAliasToNSMap(prefix,
                        moduleDeclaration,
                        docBlock.sourceStart(),
                        currentNamespace, true);
                if (result.containsKey(prefix)) {
                  String fullName = result.get(prefix)
                      .getNamespace()
                      .getFullyQualifiedName();
                  typeName = typeName.replace(prefix,
                      fullName);
                }
              } else if (typeName
                  .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) < 0) {

                String prefix = typeName;
                final Map<String, UsePart> result = PHPModelUtils
                    .getAliasToNSMap(prefix,
                        moduleDeclaration,
                        docBlock.sourceStart(),
                        currentNamespace, true);
                if (result.containsKey(prefix)) {
                  String fullName = result.get(prefix)
                      .getNamespace()
                      .getFullyQualifiedName();
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

    }

    public boolean visit(PHPFieldDeclaration s) throws Exception {

      if (s.getName().equals(field.getElementName())) {
        PHPDocBlock doc = s.getPHPDoc();
        if (doc != null) {
          if (doc.getTags().length == 1) {
            PHPDocTag[] tags = doc.getTags();
            if (tags[0].getReferences().length == 1) {
              SimpleReference[] refs = tags[0].getReferences();
              if (refs.length == 1) {             
                reference = refs[0];
              }
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

  private String getPHPDocLink(Declaration declaration) {
    String path = null;
    if (declaration instanceof IPHPDocAwareDeclaration) {
      IPHPDocAwareDeclaration phpDocDeclaration = (IPHPDocAwareDeclaration) declaration;

      PHPDocBlock docBlock = phpDocDeclaration.getPHPDoc();
      if (docBlock != null) {
        for (PHPDocTag docTag : docBlock.getTags(PHPDocTagKinds.LINK)) {
          Matcher m = HTTP_URL_PATTERN.matcher(docTag.getValue()
              .trim());
          if (m.find()) {
            try {
              URL url = new URL(m.group());
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

    }
    return false;
  }

  static public PHPDocBlock getPHPDoc(IModelElement element) {
    PHPDocBlock doc = null;
    if (element instanceof IField) {
      doc = PHPModelUtils.getDocBlock((IField) element);
    } else if (element instanceof IMethod) {
      doc = PHPModelUtils.getDocBlock((IMethod) element);
    } else if (element instanceof IType) {
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

  private static MagicMember getMagicMember(IMember member) {
    if (member instanceof IMethod || member instanceof IField) {
      IType type = null;
      if (member instanceof IMethod) {
        type = ((IMethod) member).getDeclaringType();
        PHPDocBlock doc = PHPModelUtils.getDocBlock(type);
        if (doc != null) {
          Pattern WHITESPACE_SEPERATOR = Pattern.compile("\\s+"); //$NON-NLS-1$
          final PHPDocTag[] tags = doc.getTags();
          for (PHPDocTag docTag : tags) {
            final int tagKind = docTag.getTagKind();
            if (tagKind == PHPDocTag.METHOD) {
              // http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.method.pkg.html
              final String[] split = WHITESPACE_SEPERATOR
                  .split(docTag.getValue().trim());
              if (split.length < 2) {
                continue;
              }

              if (MagicMemberUtil.removeParenthesis(split)
                  .equals(member.getElementName())) {
                return MagicMemberUtil.getMagicMethod(docTag
                    .getValue());
              } else if (MagicMemberUtil
                  .removeParenthesis2(split).equals(
                      member.getElementName())) {
                return MagicMemberUtil.getMagicMethod2(docTag
                    .getValue());
              }
            }
          }
        }
      } else {
        type = ((IField) member).getDeclaringType();
        PHPDocBlock doc = PHPModelUtils.getDocBlock(type);
        if (doc != null) {
          Pattern WHITESPACE_SEPERATOR = Pattern.compile("\\s+"); //$NON-NLS-1$
          final PHPDocTag[] tags = doc.getTags();
          for (PHPDocTag docTag : tags) {
            final int tagKind = docTag.getTagKind();
            if (tagKind == PHPDocTag.PROPERTY
                || tagKind == PHPDocTag.PROPERTY_READ
                || tagKind == PHPDocTag.PROPERTY_WRITE) {
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

      // if (buf == null) { // no source attachment found
      // fContentAccesses.put(method, null);
      // return null;
      // }

      PHPDocBlock javadoc = PHPModelUtils.getDocBlock(method);
      if (javadoc == null) {
        fContentAccesses.put(method, null);
        return null;
      }
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

  private static PHPDocBlock getJavadocNode(IMember member) {
    if (member instanceof IType) {
      return PHPModelUtils.getDocBlock((IType) member);
    }
    if (member instanceof IMethod) {
      PHPDocBlock result = PHPModelUtils.getDocBlock((IMethod) member);
      if (result == null && member instanceof FakeConstructor) {
        FakeConstructor fc = (FakeConstructor) member;
        result = PHPModelUtils.getDocBlock((IType) fc.getParent());
      }
      return result;
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

    }
    return null;
  }

  private static String javadoc2HTML(IMember member) {
    PHPDocBlock javadoc = getJavadocNode(member);

    if (javadoc == null) {
      MagicMember magicMember = getMagicMember(member);
      if (magicMember != null) {
        return getHTMLForMagicMember(member, magicMember);
      }
      javadoc = new PHPDocBlock(0, 0, null, null, new PHPDocTag[0]);
    }
    if (canInheritJavadoc(member)) {
      IMethod method = (IMethod) member;
      IType declaringType = method.getDeclaringType();
      JavadocLookup lookup;
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

    Assert.assertNotNull("Can't find declaration AST node for: "
        + declarationName, declaration);
    Assert.assertTrue(
        "Declaration is not PHPDoc aware: " + declarationName,
        declaration instanceof IPHPDocAwareDeclaration);
    PHPDocBlock phpDoc = ((IPHPDocAwareDeclaration) declaration)
        .getPHPDoc();

    if (positiveTest) {
      Assert.assertNotNull("No PHPDoc section found for:"
          + declarationName, phpDoc);
      Assert.assertNotNull("PHPDoc doesn't contain short description: "
          + declarationName, phpDoc.getShortDescription());
    } else {
      Assert.assertNull("Declaration node: " + declarationName
          + " must not contain PHPDoc section", phpDoc);
    }
  }
View Full Code Here

Examples of org.eclipse.php.internal.core.compiler.ast.nodes.PHPDocBlock

        boolean isHeaderComment = codeBeforeComment.equals("<?") //$NON-NLS-1$
            || codeBeforeComment.equals("<?php"); //$NON-NLS-1$
        if ((!isHeaderComment || this.preferences.comment_format_header)
            && this.editsEnabled
            && this.preferences.comment_format_javadoc_comment) {
          PHPDocBlock block = (PHPDocBlock) comment;

          newLineOfComment = false;
          appendToBuffer("/**"); //$NON-NLS-1$

          commentWords = new ArrayList<String>();
          org.eclipse.php.internal.core.compiler.ast.nodes.Scalar[] texts = block
              .getTexts()
              .toArray(
                  new org.eclipse.php.internal.core.compiler.ast.nodes.Scalar[block
                      .getTexts().size()]);
          PHPDocTag[] tags = block.getTags();
          if ((tags == null || tags.length == 0)) {
            texts = getNonblankScalars(texts);
          }
          boolean lastLineIsBlank = false;
          boolean isFirst = true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.