Java Code Examples for com.jetbrains.php.lang.psi.elements.PhpClass#getSuperClass()
The following examples show how to use
com.jetbrains.php.lang.psi.elements.PhpClass#getSuperClass() .
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: Symfony2InterfacesUtil.java From Thinkphp5-Plugin with MIT License | 6 votes |
protected boolean isImplementationOfInterface(PhpClass phpClass, PhpClass phpInterface) { if (phpClass == phpInterface) { return true; } for (PhpClass implementedInterface : phpClass.getImplementedInterfaces()) { if (isImplementationOfInterface(implementedInterface, phpInterface)) { return true; } } if (null == phpClass.getSuperClass()) { return false; } return isImplementationOfInterface(phpClass.getSuperClass(), phpInterface); }
Example 2
Source File: Symfony2InterfacesUtil.java From Thinkphp5-Plugin with MIT License | 6 votes |
public boolean isInstanceOf(@NotNull PhpClass subjectClass, @NotNull PhpClass expectedClass) { // Tool.log(subjectClass.getFQN()+":"+expectedClass.getFQN()); if (subjectClass.getFQN().equals(expectedClass.getFQN())) return true; if (subjectClass == expectedClass) { return true; } if (expectedClass.isInterface()) { return isImplementationOfInterface(subjectClass, expectedClass); } if (null == subjectClass.getSuperClass()) { return false; } return isInstanceOf(subjectClass.getSuperClass(), expectedClass); }
Example 3
Source File: Symfony2InterfacesUtil.java From idea-php-toolbox with MIT License | 6 votes |
protected boolean isImplementationOfInterface(PhpClass phpClass, PhpClass phpInterface) { if (phpClass == phpInterface) { return true; } for (PhpClass implementedInterface : phpClass.getImplementedInterfaces()) { if (isImplementationOfInterface(implementedInterface, phpInterface)) { return true; } } if (null == phpClass.getSuperClass()) { return false; } return isImplementationOfInterface(phpClass.getSuperClass(), phpInterface); }
Example 4
Source File: Symfony2InterfacesUtil.java From idea-php-toolbox with MIT License | 6 votes |
public boolean isInstanceOf(@NotNull PhpClass subjectClass, @NotNull PhpClass expectedClass) { // we have equal class instance, on non multiple classes with same name fallback to namespace and classname if (subjectClass == expectedClass || PhpElementsUtil.isEqualClassName(subjectClass, expectedClass)) { return true; } if (expectedClass.isInterface()) { return isImplementationOfInterface(subjectClass, expectedClass); } if (null == subjectClass.getSuperClass()) { return false; } return isInstanceOf(subjectClass.getSuperClass(), expectedClass); }
Example 5
Source File: Symfony2InterfacesUtil.java From idea-php-laravel-plugin with MIT License | 6 votes |
protected boolean isImplementationOfInterface(PhpClass phpClass, PhpClass phpInterface) { if (phpClass == phpInterface) { return true; } for (PhpClass implementedInterface : phpClass.getImplementedInterfaces()) { if (isImplementationOfInterface(implementedInterface, phpInterface)) { return true; } } if (null == phpClass.getSuperClass()) { return false; } return isImplementationOfInterface(phpClass.getSuperClass(), phpInterface); }
Example 6
Source File: Symfony2InterfacesUtil.java From idea-php-toolbox with MIT License | 6 votes |
protected boolean isImplementationOfInterface(PhpClass phpClass, PhpClass phpInterface) { if (phpClass == phpInterface) { return true; } for (PhpClass implementedInterface : phpClass.getImplementedInterfaces()) { if (isImplementationOfInterface(implementedInterface, phpInterface)) { return true; } } if (null == phpClass.getSuperClass()) { return false; } return isImplementationOfInterface(phpClass.getSuperClass(), phpInterface); }
Example 7
Source File: Symfony2InterfacesUtil.java From idea-php-toolbox with MIT License | 6 votes |
public boolean isInstanceOf(@NotNull PhpClass subjectClass, @NotNull PhpClass expectedClass) { // we have equal class instance, on non multiple classes with same name fallback to namespace and classname if (subjectClass == expectedClass || PhpElementsUtil.isEqualClassName(subjectClass, expectedClass)) { return true; } if (expectedClass.isInterface()) { return isImplementationOfInterface(subjectClass, expectedClass); } if (null == subjectClass.getSuperClass()) { return false; } return isInstanceOf(subjectClass.getSuperClass(), expectedClass); }
Example 8
Source File: Utils.java From phpstorm-plugin with MIT License | 5 votes |
public static Boolean isClassAtoumTest(PhpClass checkedClass) { // First, we check if the class is in the units tests namespace if (!checkedClass.getNamespaceName().toLowerCase().contains(getTestsNamespaceSuffix().toLowerCase())) { return false; } if (checkedClass.isAbstract() || checkedClass.isInterface()) { return false; } // We also check if the class extends atoum PhpClass loopCheckedClass = checkedClass; while (loopCheckedClass.getSuperClass() != null) { PhpClass parent = loopCheckedClass.getSuperClass(); if (parent.getFQN().equals("\\atoum")) { return true; } loopCheckedClass = parent; } // We try with another method to check, if the project does not have atoum/stubs do { List<ClassReference> extendsList = checkedClass.getExtendsList().getReferenceElements(); if (extendsList.iterator().hasNext()) { ClassReference ref = extendsList.iterator().next(); if (ref.getFQN() != null && ref.getFQN().equals("\\atoum")) { return true; } } checkedClass = checkedClass.getSuperClass(); } while (checkedClass != null); return false; }
Example 9
Source File: Symfony2InterfacesUtil.java From idea-php-laravel-plugin with MIT License | 5 votes |
public boolean isInstanceOf(@NotNull PhpClass subjectClass, @NotNull PhpClass expectedClass) { if (subjectClass == expectedClass) { return true; } if (expectedClass.isInterface()) { return isImplementationOfInterface(subjectClass, expectedClass); } if (null == subjectClass.getSuperClass()) { return false; } return isInstanceOf(subjectClass.getSuperClass(), expectedClass); }