Class TreeUtils

java.lang.Object
org.sonar.php.tree.TreeUtils

public class TreeUtils extends Object
  • Method Details

    • isDescendant

      public static boolean isDescendant(Tree tree, Tree potentialParent)
    • findAncestorWithKind

      @CheckForNull public static Tree findAncestorWithKind(Tree tree, Collection<Tree.Kind> kinds)
    • findAncestorWithKind

      @CheckForNull public static Tree findAncestorWithKind(Tree tree, Tree.Kind... kinds)
    • descendants

      public static Stream<Tree> descendants(@Nullable Tree root)
    • descendants

      public static <T extends Tree> Stream<T> descendants(@Nullable Tree root, Class<T> clazz)
    • firstDescendant

      public static Optional<Tree> firstDescendant(@Nullable Tree root, Predicate<Tree> predicate)
    • firstDescendant

      public static <T extends Tree> Optional<T> firstDescendant(Tree root, Class<T> clazz)
    • hasAnnotation

      public static boolean hasAnnotation(Tree declaration, String annotation)