nowo-tech/phpstan-frankenphp
PHPStan support for FrankenPHP projects. Ships stubs and rules covering frankenphp_* functions, worker-mode globals and runtime constants, so static analysis understands your FrankenPHP app and flags type errors early. Install with Composer and register the extension in phpstan.neon.
Architecture fit. Unchanged by v1.3.2. The package is a PHPStan custom-rules extension, not a runtime library. That is the right shape: FrankenPHP worker mode breaks applications through persistent process state (static properties, globals, singletons, request-scoped container bindings, in-memory caches), and static analysis is the cheapest way to find those hazards before they become cross-request data leaks. The level-split design (classic-mode rules, then worker-mode rules) mirrors the migration sequence and supports ratcheting. Note that v1.3.2's docs/PSR.md change explicitly describes the extension as AST-only — this is not a runtime instrument, and it does not claim to be. Zero production footprint, zero container changes, still true.
Integration feasibility. Unchanged. require-dev, one includes: entry in phpstan.neon, level selector. Sub-day for a team already running PHPStan; a team not running PHPStan is buying a static-analysis program, not a package. New in v1.3.2: the demo application's composer.lock / symfony.lock are now tracked, which makes the reference demo reproducible — you can clone, run the demo, and verify rule behavior against a pinned dependency set rather than trusting the README. Use that as the pre-adoption smoke test.
Technical risk.
set_time_limit, exit, output buffering, $_SERVER mutation, register_shutdown_function, header(), container scoping all have legitimate exceptions. False positives remain the dominant complaint and the main driver of bypass behavior. v1.3.2 ships no rule-behavior changes, so no re-triage is required on upgrade from 1.3.x.docs/PSR.md means the rules do not resolve Laravel's scoped bindings, Octane-style Request lifecycle, facade state, or queue-worker vs. web-worker distinctions through the type system. They will catch syntactic hazards and miss container- and facade-mediated state. This promotes the previous "expect gaps" to "plan for gaps."PhpVersion::PHP_82 for the package's own toolchain. That is evidence of a PHP 8.2 floor for development, not a declared support matrix for consumers. Confirm against your application's PHP minor before integrating.943010b) before adding to a dependency graph.Key questions.
rules.neon, and can individual rules be disabled or parameterized (e.g., ignore set_time_limit in a CLI-only path)?--generate-baseline? Is the intended workflow baselining legacy debt, and does it respect ignoreErrors with identifiers?docs/PSR.md describes the extension as AST-only. Budget for gaps on container- and facade-mediated state.Demo smoke workflow now runs on tags, weekly, and manually — so the demos are executed, but not on every PR. Per-PR rule regression coverage remains unproven.docs/SECURITY.md now documents attack surface, threat model, dependency policy, and an AI security audit checklist — useful for security sign-off. Still no stated PHPStan compatibility policy or issue-response commitment.Stack fit. Unchanged: Laravel + PHPStan/Larastan + CI, as an additional ruleset in the existing analysis job. No application, autoload, or deploy-pipeline changes. The only stack prerequisite remains an existing PHPStan baseline — without one, pre-existing violations swamp the signal.
Migration path.
.htaccess ignored, $_SERVER key differences, DOCUMENT_ROOT/SCRIPT_FILENAME paths, getallheaders) rather than application logic failures.ignoreErrors with identifiers for justified exceptions, then burn down the baseline.Compatibility. No breaking changes in v1.3.2 and no rule behavior changes, so upgrading from 1.3.x is low-risk. The release does not resolve the PHPStan-major question — verify against your exact PHPStan major, Larastan version, and PHP minor before committing, and pin rather than float. Watch for duplicated or contradictory diagnostics when stacking other community rulesets; PHPStan does not always attribute the source cleanly.
Sequencing recommendation. Unchanged. Pilot on one non-critical service with a single owner. Gate go/no-go on two numbers: false-positive rate per 1k findings, and percentage of worker-mode hazards found by the rules that manual review also found (recall proxy). Given the confirmed AST-only design, set the recall expectation lower for Laravel-heavy code and plan the fork decision in advance — MIT license makes it cheap.
Maintenance. Dev-only dependency; zero production runtime, no image or memory changes. Ongoing cost is small and predictable: pin the version, re-validate on every PHPStan major, budget a few hours per PHPStan upgrade cycle. v1.3.2 adds a small amount of your maintenance surface — a new Cursor rule file and extra docs — but nothing that runs. The tracked demo lockfiles slightly reduce triage time, because you can reproduce maintainer behavior instead of reasoning from README prose.
Support. Still the weakest dimension. Zero community, zero dependents, no vendor. The docs/SECURITY.md addition is a genuine improvement for internal security review — it gives you a documented threat model and dependency policy to cite — but it is a document about the project, not a support commitment from the project. There will still be no upstream fix for your false positive on a Tuesday. Mitigation is unchanged and explicit: either (a) accept ownership and fork, budgeting ~1–2 engineer-days per quarter for rule upkeep, or (b) restrict to the subset of rules with clear-cut semantics and hand-write the Laravel-specific ones.
Scaling. Analysis cost scales with PHPStan, not the package — incremental-cached and parallelizable, seconds to low minutes on a mid-size Laravel monolith. CI-time cost, not a production-scaling concern. The scaling pressure that matters is organizational: each additional blocking rule increases the chance someone adds a suppression to ship. Track suppression count as a leading indicator.
Failure modes.
Ramp-up. Low for developers: per-case demos remain the right documentation format, now with a reproducible pinned environment, and PHPStan output is already familiar. Under a day to a first useful run. The real ramp-up cost sits with whoever owns the migration: interpreting worker-mode findings, judging which are real, and sequencing remediation. Allocate roughly one sprint for the pilot plus triage, and name a single owner before adoption — with no community behind the package, an unowned ruleset in CI is a future red build with no one to call.
How can I help you explore Laravel packages today?