/**
   * Check that there is exactly one space between a control structure keyword and a opening
   * parenthesis or curly brace.
   */
  private void checkSpaceBetweenKeywordAndNextNode(SyntaxToken keyword, SyntaxToken nextToken) {
    if (TokenUtils.isType(nextToken, PHPPunctuator.LCURLYBRACE, PHPPunctuator.LPARENTHESIS)
        && TokenUtils.isOnSameLine(keyword, nextToken)) {
      int nbSpace = TokenUtils.getNbSpaceBetween(keyword, nextToken);

      if (nbSpace != 1) {
        String endMessage =
            String.format(
                CONTROL_STRUCTURES_KEYWORD_MESSAGE,
                keyword.text(),
                TokenUtils.isType(nextToken, PHPPunctuator.LPARENTHESIS)
                    ? "parenthesis."
                    : "curly brace.");
        check.reportIssue(TokenUtils.buildIssueMsg(nbSpace, endMessage), keyword);
      }
    }
  }
 private static boolean isSemicolon(@Nullable Tree tree) {
   return tree != null
       && tree.is(Kind.TOKEN)
       && TokenUtils.isType((SyntaxToken) tree, PHPPunctuator.SEMICOLON);
 }