Java Code Examples for fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil#isTestClass()

The following examples show how to use fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil#isTestClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventDispatcherSubscriberUtil.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
@NotNull
private static Collection<EventDispatcherSubscribedEvent> getSubscribedEventsProxy(@NotNull Project project) {

    Collection<EventDispatcherSubscribedEvent> events = new ArrayList<>();

    // http://symfony.com/doc/current/components/event_dispatcher/introduction.html
    PhpIndex phpIndex = PhpIndex.getInstance(project);
    Collection<PhpClass> phpClasses = phpIndex.getAllSubclasses("\\Symfony\\Component\\EventDispatcher\\EventSubscriberInterface");

    for(PhpClass phpClass: phpClasses) {

        if(PhpElementsUtil.isTestClass(phpClass)) {
            continue;
        }

        Method method = phpClass.findMethodByName("getSubscribedEvents");
        if(method != null) {
            PhpReturn phpReturn = PsiTreeUtil.findChildOfType(method, PhpReturn.class);
            if(phpReturn != null) {
                attachSubscriberEventNames(events, phpClass, phpReturn);
            }
        }
    }

   return events;
}
 
Example 2
Source File: FormUtil.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
public static boolean isValidFormPhpClass(PhpClass phpClass) {
    return !(phpClass.isAbstract() || phpClass.isInterface() || PhpElementsUtil.isTestClass(phpClass));
}