override fun getDeclarations()

in src/main/kotlin/com/pestphp/pest/features/customExpectations/symbols/PestCustomExpectationSymbolDeclarationProvider.kt [15:26]


    override fun getDeclarations(element: PsiElement, offsetInElement: Int): Collection<PsiSymbolDeclaration> {
        val possibleExtensionName = element as? StringLiteralExpression ?: return emptyList()
        if (possibleExtensionName.parent !is ParameterList || possibleExtensionName.contents.isEmpty()) return emptyList()
        val methodReference = possibleExtensionName.parent.parent as? MethodReferenceImpl ?: return emptyList()
        val methodDescriptor = methodReference.toMethod() ?: return emptyList()
        if (methodReference.name == "extend" &&
            PhpType.intersectsGlobal(element.project, methodReference.classReference!!.type, PEST_EXPECTATION_TYPE)
        ) {
            return listOf(PestCustomExpectationSymbolDeclaration(element, methodDescriptor))
        }
        return emptyList()
    }