Skip to main content

run

Function run 

Source
pub async fn run(
    cfg: &PhpstanConfig,
    path: &Path,
    workspace_root: Option<&Path>,
) -> Vec<Diagnostic>
Expand description

Analyse path with PHPStan and return its findings as diagnostics.

PHPStan reports only a line number, never a column, so each diagnostic spans the full line (character: u32::MAX on the end position — editors clamp this to the actual line length, the same convention other line-only-precision tools use rather than re-reading the source here).

Returns an empty Vec whenever the tool can’t be run at all (binary missing, spawn failure, unparseable output) — this is an opt-in, best- effort overlay on top of the built-in diagnostics, not a required source of truth, so a broken PHPStan setup degrades silently rather than erroring the whole diagnostics publish.