pub trait MethodAssertionProvider: Provider {
// Required methods
fn targets() -> &'static [MethodTarget]
where Self: Sized;
fn get_assertions(
&self,
context: &ProviderContext<'_, '_, '_>,
class_name: &[u8],
method_name: &[u8],
invocation: &InvocationInfo<'_, '_, '_>,
) -> Option<InvocationAssertions>;
}Expand description
Provider for getting additional assertions from method calls.
This allows plugins to specify type narrowing for method calls like:
$validator->isString($x)- narrows$xtostringif returns trueAssert::assertInstanceOf(Foo::class, $x)- narrows$xtoFoo
Required Methods§
Sourcefn targets() -> &'static [MethodTarget]where
Self: Sized,
fn targets() -> &'static [MethodTarget]where
Self: Sized,
The methods this provider handles.
Sourcefn get_assertions(
&self,
context: &ProviderContext<'_, '_, '_>,
class_name: &[u8],
method_name: &[u8],
invocation: &InvocationInfo<'_, '_, '_>,
) -> Option<InvocationAssertions>
fn get_assertions( &self, context: &ProviderContext<'_, '_, '_>, class_name: &[u8], method_name: &[u8], invocation: &InvocationInfo<'_, '_, '_>, ) -> Option<InvocationAssertions>
Get assertions for the method invocation.
Returns Some(assertions) if this provider has assertions to add,
None otherwise.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".