public static Collection<PhpClass> getClassFromPhpTypeSetArrayClean(
      Project project, Set<String> types) {

    PhpType phpType = new PhpType();
    phpType.add(types);

    ArrayList<PhpClass> phpClasses = new ArrayList<PhpClass>();

    for (String typeName :
        PhpIndex.getInstance(project)
            .completeType(project, phpType, new HashSet<String>())
            .getTypes()) {
      if (typeName.startsWith("\\")) {

        // we clean array types \Foo[]
        if (typeName.endsWith("[]")) {
          typeName = typeName.substring(0, typeName.length() - 2);
        }

        PhpClass phpClass = PhpElementsUtil.getClassInterface(project, typeName);
        if (phpClass != null) {
          phpClasses.add(phpClass);
        }
      }
    }

    return phpClasses;
  }
  /**
   * Get class by shortcut namespace, on a scoped namespace
   *
   * @param project current project
   * @param classNameScope Namespace fo search "\Foo\Foo", "Foo\Foo", "Foo\Foo\", last "\*" is
   *     stripped
   * @param className Class name inside namespace also fqn is supported
   * @return PhpClass matched
   */
  public static PhpClass getClassInsideNamespaceScope(
      @NotNull Project project, @NotNull String classNameScope, @NotNull String className) {

    if (className.startsWith("\\")) {
      return PhpElementsUtil.getClassInterface(project, className);
    }

    // strip class name we namespace
    String strip = StringUtils.strip(classNameScope, "\\");
    int i = strip.lastIndexOf("\\");
    if (i <= 0) {
      return PhpElementsUtil.getClassInterface(project, className);
    }

    PhpClass phpClass =
        PhpElementsUtil.getClassInterface(
            project, strip.substring(0, i) + "\\" + StringUtils.strip(className, "\\"));
    if (phpClass != null) {
      return phpClass;
    }

    return PhpElementsUtil.getClassInterface(project, className);
  }
  public static Collection<PhpClass> getClassFromPhpTypeSet(Project project, Set<String> types) {

    PhpType phpType = new PhpType();
    phpType.add(types);

    List<PhpClass> phpClasses = new ArrayList<PhpClass>();

    for (String typeName :
        PhpIndex.getInstance(project)
            .completeType(project, phpType, new HashSet<String>())
            .getTypes()) {
      if (typeName.startsWith("\\")) {
        PhpClass phpClass = PhpElementsUtil.getClassInterface(project, typeName);
        if (phpClass != null) {
          phpClasses.add(phpClass);
        }
      }
    }

    return phpClasses;
  }