/**
   * Find a string return value of a method context "function() { return 'foo'}" First match wins
   */
  @Nullable
  public static String getMethodReturnAsString(
      @NotNull PhpClass phpClass, @NotNull String methodName) {

    Method method = phpClass.findMethodByName(methodName);
    if (method == null) {
      return null;
    }

    final Set<String> values = new HashSet<String>();
    method.acceptChildren(
        new PsiRecursiveElementWalkingVisitor() {
          @Override
          public void visitElement(PsiElement element) {

            if (PhpElementsUtil.getMethodReturnPattern().accepts(element)) {
              String value = PhpElementsUtil.getStringValue(element);
              if (value != null && StringUtils.isNotBlank(value)) {
                values.add(value);
              }
            }

            super.visitElement(element);
          }
        });

    if (values.size() == 0) {
      return null;
    }

    // we support only first item
    return values.iterator().next();
  }
  @Nullable
  public static Method getClassMethod(
      @NotNull Project project, @NotNull String phpClassName, @NotNull String methodName) {

    // we need here an each; because eg Command is non unique because phar file
    for (PhpClass phpClass : PhpIndex.getInstance(project).getClassesByFQN(phpClassName)) {
      Method method = phpClass.findMethodByName(methodName);
      if (method != null) {
        return method;
      }
    }

    return null;
  }
 /** There is no need for this proxy method. We are api safe now */
 @Deprecated
 @Nullable
 public static Method getClassMethod(PhpClass phpClass, String methodName) {
   return phpClass.findMethodByName(methodName);
 }