Skip to main content

Crate mir_php

Crate mir_php 

Source
Expand description

mir-php — PHP static analysis engine.

Provides type inference and semantic diagnostics for PHP source code, operating directly on php_ast AST slices with no dependency on any LSP framework.

§Usage

use bumpalo::Bump;
use php_rs_parser::parse;

let arena = Bump::new();
let program = parse(source, &arena).unwrap();

let diags = mir_php::analyze(source, &program.stmts, &[]);
let env   = mir_php::infer(&program.stmts);

Re-exports§

pub use diag::Diagnostic;
pub use diag::Severity;
pub use types::Ty;
pub use types::TypeEnv;

Modules§

diag
infer
stubs
types
util

Functions§

analyze
Analyse stmts against all workspace documents and return diagnostics.
infer
Build a TypeEnv (variable → type map) from stmts.