public static PsiElement findArrayKeyValueInsideReference(
      PsiElement psiElement, String methodReferenceName, String keyName) {

    if (psiElement == null) {
      return null;
    }

    Collection<MethodReference> tests =
        PsiTreeUtil.findChildrenOfType(psiElement, MethodReference.class);
    for (MethodReference methodReference : tests) {

      // instance check
      // methodReference.getSignature().equals("#M#C\\Symfony\\Component\\OptionsResolver\\OptionsResolverInterface.setDefaults")
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference, methodReferenceName)) {
        PsiElement[] parameters = methodReference.getParameters();
        if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
          PsiElement keyValue =
              PhpElementsUtil.getArrayValue((ArrayCreationExpression) parameters[0], keyName);
          if (keyValue != null) {
            return keyValue;
          }
        }
      }
    }

    return null;
  }
  private static void attachOnDefaultOptions(
      Project project, HashMap<String, String> defaultValues, String typeClass) {

    PsiElement setDefaultOptions =
        PhpElementsUtil.getPsiElementsBySignatureSingle(
            project, "#M#C\\" + typeClass + ".setDefaultOptions");
    if (setDefaultOptions == null) {
      return;
    }

    Collection<MethodReference> tests =
        PsiTreeUtil.findChildrenOfType(setDefaultOptions, MethodReference.class);
    for (MethodReference methodReference : tests) {
      // instance check
      // methodReference.getSignature().equals("#M#C\\Symfony\\Component\\OptionsResolver\\OptionsResolverInterface.setDefaults")
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference, "setDefaults")) {
        PsiElement[] parameters = methodReference.getParameters();
        if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
          for (String key :
              PhpElementsUtil.getArrayCreationKeys((ArrayCreationExpression) parameters[0])) {
            defaultValues.put(key, typeClass);
          }
        }
      }

      // support: parent::setDefaultOptions($resolver)
      // Symfony\Component\Form\Extension\Core\Type\FormType:setDefaultOptions
      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference, "setDefaultOptions")
          && methodReference.getReferenceType() == PhpModifier.State.PARENT) {
        PsiElement parentMethod =
            PhpElementsUtil.getPsiElementsBySignatureSingle(
                project, methodReference.getSignature());
        if (parentMethod instanceof Method) {
          PhpClass phpClass = ((Method) parentMethod).getContainingClass();
          if (phpClass != null) {
            attachOnDefaultOptions(project, defaultValues, phpClass.getPresentableFQN());
          }
        }
      }
    }
  }
  @Nullable
  public static PsiElement getArrayKeyValueInsideSignaturePsi(
      Project project, String signature, String methodName, String keyName) {

    PsiElement psiElement = PhpElementsUtil.getPsiElementsBySignatureSingle(project, signature);
    if (psiElement == null) {
      return null;
    }

    for (MethodReference methodReference :
        PsiTreeUtil.findChildrenOfType(psiElement, MethodReference.class)) {

      if (PhpElementsUtil.isEqualMethodReferenceName(methodReference, methodName)) {
        PsiElement[] parameters = methodReference.getParameters();
        if (parameters.length > 0 && parameters[0] instanceof ArrayCreationExpression) {
          return PhpElementsUtil.getArrayValue((ArrayCreationExpression) parameters[0], keyName);
        }
      }
    }

    return null;
  }