use foldhash::HashSet;
use mago_atom::Atom;
use mago_syntax::ast::Expression;
use crate::plugin::context::InvocationInfo;
use crate::plugin::context::ProviderContext;
use crate::plugin::provider::Provider;
use crate::plugin::provider::function::FunctionTarget;
use crate::plugin::provider::method::MethodTarget;
pub trait ExpressionThrowTypeProvider: Provider {
fn get_thrown_exceptions(
&self,
context: &ProviderContext<'_, '_, '_>,
expression: &Expression<'_>,
) -> HashSet<Atom>;
}
pub trait FunctionThrowTypeProvider: Provider {
fn targets() -> FunctionTarget
where
Self: Sized;
fn get_thrown_exceptions(
&self,
context: &ProviderContext<'_, '_, '_>,
invocation: &InvocationInfo<'_, '_, '_>,
) -> HashSet<Atom>;
}
pub trait MethodThrowTypeProvider: Provider {
fn targets() -> &'static [MethodTarget]
where
Self: Sized;
fn get_thrown_exceptions(
&self,
context: &ProviderContext<'_, '_, '_>,
class_name: &str,
method_name: &str,
invocation: &InvocationInfo<'_, '_, '_>,
) -> HashSet<Atom>;
}