Search in sources :

Example 11 with Function

use of com.jetbrains.php.lang.psi.elements.Function in project phpinspectionsea by kalessil.

the class ComparableCoreClassesStrategy method apply.

public static boolean apply(@Nullable PsiElement leftOperand, @Nullable PsiElement rightOperand, ProblemsHolder holder) {
    /* validate parameters and prepare needed objects */
    if (null == leftOperand || null == rightOperand) {
        return false;
    }
    final Function scope = ExpressionSemanticUtil.getScope(leftOperand);
    if (null == scope) {
        return false;
    }
    final PhpIndex index = PhpIndex.getInstance(holder.getProject());
    return isComparableObject(leftOperand, index) && isComparableObject(rightOperand, index);
}
Also used : Function(com.jetbrains.php.lang.psi.elements.Function) PhpIndex(com.jetbrains.php.PhpIndex)

Aggregations

Function (com.jetbrains.php.lang.psi.elements.Function)11 NotNull (org.jetbrains.annotations.NotNull)9 PsiElement (com.intellij.psi.PsiElement)8 BasePhpElementVisitor (com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpElementVisitor)8 FunctionReference (com.jetbrains.php.lang.psi.elements.FunctionReference)5 MethodReference (com.jetbrains.php.lang.psi.elements.MethodReference)3 ProblemsHolder (com.intellij.codeInspection.ProblemsHolder)2 GroupStatement (com.jetbrains.php.lang.psi.elements.GroupStatement)2 Method (com.jetbrains.php.lang.psi.elements.Method)2 Parameter (com.jetbrains.php.lang.psi.elements.Parameter)2 PhpUnitAssertFixer (com.kalessil.phpStorm.phpInspectionsEA.fixers.PhpUnitAssertFixer)2 MessagesPresentationUtil (com.kalessil.phpStorm.phpInspectionsEA.utils.MessagesPresentationUtil)2 List (java.util.List)2 PsiElementVisitor (com.intellij.psi.PsiElementVisitor)1 PhpIndex (com.jetbrains.php.PhpIndex)1 PhpScopeHolder (com.jetbrains.php.codeInsight.PhpScopeHolder)1 PhpAccessVariableInstruction (com.jetbrains.php.codeInsight.controlFlow.instructions.PhpAccessVariableInstruction)1 PhpEntryPointInstruction (com.jetbrains.php.codeInsight.controlFlow.instructions.PhpEntryPointInstruction)1 PhpFile (com.jetbrains.php.lang.psi.PhpFile)1 ClassReference (com.jetbrains.php.lang.psi.elements.ClassReference)1