Program: 15468
Project: 15468
Buggy source:
private static void getDefaultOptions(@NotNull Project project,@NotNull PhpClass phpClass,@NotNull FormClass formClass,@NotNull FormOptionVisitor visitor){
  for (  String methodName : FORM_OPTION_METHODS) {
    Method method=phpClass.findMethodByName(methodName);
    if (method == null) {
      continue;
    }
    Collection<MethodReference> tests=PsiTreeUtil.findChildrenOfType(method,MethodReference.class);
    for (    MethodReference methodReference : tests) {
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,"String_Node_Str")) {
        PsiElement[] parameters=methodReference.getParameters();
        if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
          for (          Map.Entry<String,PsiElement> entry : PhpElementsUtil.getArrayCreationKeyMap((ArrayCreationExpression)parameters[0]).entrySet()) {
            visitor.visit(entry.getValue(),entry.getKey(),formClass,FormOptionEnum.DEFAULT);
          }
        }
      }
 else {
        for (        String currentMethod : OPTIONS_VIA_METHOD_PARAMETER) {
          if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,currentMethod)) {
            PsiElement[] parameters=methodReference.getParameters();
            if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
              for (              Map.Entry<String,PsiElement> entry : PhpElementsUtil.getArrayValuesAsMap((ArrayCreationExpression)parameters[0]).entrySet()) {
                visitor.visit(entry.getValue(),entry.getKey(),formClass,FormOptionEnum.getEnum(currentMethod));
              }
            }
            break;
          }
        }
      }
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,methodName) && methodReference.getReferenceType() == PhpModifier.State.PARENT) {
        PsiElement parentMethod=PhpElementsUtil.getPsiElementsBySignatureSingle(project,methodReference.getSignature());
        if (parentMethod instanceof Method) {
          PhpClass phpClassInner=((Method)parentMethod).getContainingClass();
          if (phpClassInner != null) {
            getDefaultOptions(project,phpClassInner,formClass,visitor);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void getDefaultOptions(@NotNull Project project,@NotNull PhpClass phpClass,@NotNull FormClass formClass,@NotNull FormOptionVisitor visitor,int depth){
  if (depth-- < 0) {
    return;
  }
  for (  String methodName : FORM_OPTION_METHODS) {
    Method method=phpClass.findMethodByName(methodName);
    if (method == null) {
      continue;
    }
    Collection<MethodReference> tests=PsiTreeUtil.findChildrenOfType(method,MethodReference.class);
    for (    MethodReference methodReference : tests) {
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,"String_Node_Str")) {
        PsiElement[] parameters=methodReference.getParameters();
        if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
          for (          Map.Entry<String,PsiElement> entry : PhpElementsUtil.getArrayCreationKeyMap((ArrayCreationExpression)parameters[0]).entrySet()) {
            visitor.visit(entry.getValue(),entry.getKey(),formClass,FormOptionEnum.DEFAULT);
          }
        }
      }
 else {
        for (        String currentMethod : OPTIONS_VIA_METHOD_PARAMETER) {
          if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,currentMethod)) {
            PsiElement[] parameters=methodReference.getParameters();
            if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
              for (              Map.Entry<String,PsiElement> entry : PhpElementsUtil.getArrayValuesAsMap((ArrayCreationExpression)parameters[0]).entrySet()) {
                visitor.visit(entry.getValue(),entry.getKey(),formClass,FormOptionEnum.getEnum(currentMethod));
              }
            }
            break;
          }
        }
      }
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference,methodName) && methodReference.getReferenceType() == PhpModifier.State.PARENT) {
        PsiElement parentMethod=PhpElementsUtil.getPsiElementsBySignatureSingle(project,methodReference.getSignature());
        if (parentMethod instanceof Method) {
          PhpClass phpClassInner=((Method)parentMethod).getContainingClass();
          if (phpClassInner != null) {
            getDefaultOptions(project,phpClassInner,formClass,visitor,depth);
          }
        }
      }
    }
  }
}