public static ArrayList<String> getExtendedTypeClasses(Project project, String... formTypeNames) {

    List<String> formTypeNamesList = Arrays.asList(formTypeNames);

    ArrayList<String> extendedTypeClasses = new ArrayList<String>();

    FormExtensionServiceParser formExtensionServiceParser =
        ServiceXmlParserFactory.getInstance(project, FormExtensionServiceParser.class);
    for (String formClass : formExtensionServiceParser.getFormExtensions().keySet()) {

      PsiElement psiElements[] =
          PhpElementsUtil.getPsiElementsBySignature(
              project, "#M#C\\" + formClass + ".getExtendedType");
      for (PsiElement psiElement : psiElements) {
        PhpReturn phpReturn = PsiTreeUtil.findChildOfType(psiElement, PhpReturn.class);
        if (phpReturn != null) {
          PhpPsiElement returnValue = phpReturn.getFirstPsiChild();
          if (returnValue instanceof StringLiteralExpression
              && formTypeNamesList.contains(
                  ((StringLiteralExpression) returnValue).getContents())) {
            extendedTypeClasses.add(formClass);
          }
        }
      }
    }

    return extendedTypeClasses;
  }
  @Override
  protected void addCompletions(
      @NotNull CompletionParameters completionParameters,
      ProcessingContext processingContext,
      @NotNull CompletionResultSet completionResultSet) {

    if (!Symfony2ProjectComponent.isEnabled(completionParameters.getPosition())) {
      return;
    }

    XmlEventParser xmlEventParser =
        ServiceXmlParserFactory.getInstance(
            completionParameters.getPosition().getProject(), XmlEventParser.class);
    for (Map.Entry<String, String> event : xmlEventParser.get().entrySet()) {
      completionResultSet.addElement(
          LookupElementBuilder.create(event.getKey())
              .withTypeText(event.getValue(), true)
              .withIcon(Symfony2Icons.EVENT));
    }

    for (EventDispatcherSubscribedEvent event :
        EventDispatcherSubscriberUtil.getSubscribedEvents(
            completionParameters.getPosition().getProject())) {
      completionResultSet.addElement(
          LookupElementBuilder.create(event.getStringValue())
              .withTypeText("EventSubscriber", true)
              .withIcon(Symfony2Icons.EVENT));
    }
  }