phpstan/phpstan-webmozart-assert
PHPStan extension for webmozart/assert that teaches PHPStan how Assert::* calls narrow types. Supports many assertions (including nullOr*/all*) so values become non-null, specific scalars, instances, arrays, etc. after validation, improving static analysis accuracy.
Architecture fit: The package is a PHPStan extension designed specifically to enhance static analysis when using webmozart/assert. It integrates seamlessly into PHP's existing static analysis toolchain, leveraging PHPStan's type inference system. This aligns perfectly with modern PHP development practices where static analysis is critical for code quality. The extension operates at the analysis layer, requiring no runtime changes, making it architecture-neutral for existing PHP applications.
Integration feasibility: High. Installation is trivial via Composer (composer require --dev phpstan/phpstan-webmozart-assert) with automatic configuration via phpstan/extension-installer. Manual configuration requires a single line in phpstan.neon. No code modifications are needed in application logic—only existing webmozart/assert usage benefits from improved type inference. The extension is purely a dev dependency with zero runtime impact.
Technical risk: Low-to-moderate. The package actively maintains compatibility with PHPStan (e.g., recent updates for PHPStan 1.0/2.0). However, low adoption (0 dependents) suggests limited real-world testing. Key risks include:
Key questions:
webmozart/assert?Stack fit: Ideal for PHP projects using PHPStan for static analysis and webmozart/assert for validation. It operates entirely in the development/CI pipeline with no impact on production code or runtime
How can I help you explore Laravel packages today?