Skip to main content

MirPlugin

Trait MirPlugin 

Source
pub trait MirPlugin: Send + Sync {
Show 15 methods // Required method fn name(&self) -> &str; // Provided methods fn hooks(&self) -> HookFlags { ... } fn stub_files(&self) -> Vec<PathBuf> { ... } fn function_return_type_ids(&self) -> Vec<String> { ... } fn function_return_type( &self, _event: &FunctionReturnTypeProviderEvent<'_>, ) -> Option<ProvidedType> { ... } fn method_return_type_classes(&self) -> Vec<String> { ... } fn method_return_type( &self, _event: &MethodReturnTypeProviderEvent<'_>, ) -> Option<ProvidedType> { ... } fn class_property_classes(&self) -> Vec<String> { ... } fn class_property( &self, _event: &ClassPropertyProviderEvent<'_>, ) -> Option<ProvidedType> { ... } fn after_expression_analysis( &self, _event: &mut AfterExpressionAnalysisEvent<'_>, ) { ... } fn after_statement_analysis( &self, _event: &mut AfterStatementAnalysisEvent<'_>, ) { ... } fn after_function_call_analysis( &self, _event: &mut AfterFunctionCallAnalysisEvent<'_>, ) { ... } fn after_method_call_analysis( &self, _event: &mut AfterMethodCallAnalysisEvent<'_>, ) { ... } fn before_add_issue(&self, _issue: &Issue) -> Option<bool> { ... } fn after_codebase_populated( &self, _event: &mut AfterCodebasePopulatedEvent<'_>, ) { ... }
}
Expand description

A mir plugin. Hook methods take &self and may run concurrently from rayon workers — use interior mutability with proper synchronization.

Return-type providers are separate from HookFlags: they are keyed by the ids returned from function_return_type_ids / method_return_type_classes, mirroring Psalm’s FunctionReturnTypeProviderInterface::getFunctionIds() and MethodReturnTypeProviderInterface::getClassLikeNames().

Required Methods§

Source

fn name(&self) -> &str

Provided Methods§

Source

fn hooks(&self) -> HookFlags

Source

fn stub_files(&self) -> Vec<PathBuf>

PHP stub files this plugin contributes (Psalm’s RegistrationInterface::addStubFile). Loaded before analysis.

Source

fn function_return_type_ids(&self) -> Vec<String>

Function ids (lowercased FQNs, no leading \) this plugin provides return types for.

Source

fn function_return_type( &self, _event: &FunctionReturnTypeProviderEvent<'_>, ) -> Option<ProvidedType>

Override the return type of a call to one of the declared function ids. None falls through to the next plugin / normal inference.

Source

fn method_return_type_classes(&self) -> Vec<String>

Class FQCNs (no leading \) this plugin provides method return types for.

Source

fn method_return_type( &self, _event: &MethodReturnTypeProviderEvent<'_>, ) -> Option<ProvidedType>

Source

fn class_property_classes(&self) -> Vec<String>

Class FQCNs (no leading \) this plugin provides undeclared-property types for. A listed class matches when it is the receiver’s own class or any ancestor, so a framework base class (e.g. Illuminate\Database\Eloquent\Model) covers every user subclass.

Source

fn class_property( &self, _event: &ClassPropertyProviderEvent<'_>, ) -> Option<ProvidedType>

Supply the type of an otherwise-undeclared property. None falls through to the next plugin / normal UndefinedProperty reporting.

Source

fn after_expression_analysis( &self, _event: &mut AfterExpressionAnalysisEvent<'_>, )

Source

fn after_statement_analysis(&self, _event: &mut AfterStatementAnalysisEvent<'_>)

Source

fn after_function_call_analysis( &self, _event: &mut AfterFunctionCallAnalysisEvent<'_>, )

Source

fn after_method_call_analysis( &self, _event: &mut AfterMethodCallAnalysisEvent<'_>, )

Source

fn before_add_issue(&self, _issue: &Issue) -> Option<bool>

Veto or pass an issue before it is reported (Psalm’s BeforeAddIssueInterface). Some(false) drops the issue, Some(true) forces it through, None defers to other plugins.

Source

fn after_codebase_populated(&self, _event: &mut AfterCodebasePopulatedEvent<'_>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§