Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpstan Webmozart Assert Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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:

  • Breakage during PHPStan major version upgrades (though maintainers have historically addressed these quickly)
  • Edge-case assertion handling (e.g., complex generics or custom assertion libraries)
  • Potential conflicts with other PHPStan extensions that modify type inference

Key questions:

  • How does the extension handle custom assertion methods or third-party extensions to webmozart/assert?
  • What is the exact compatibility matrix for PHPStan versions (e.g., does it support PHPStan 2.0+ fully)?
  • Are there known performance impacts during large-scale static analysis runs?
  • Why are there zero dependents despite the package's utility? (Potential lack of discoverability or niche use case)

Integration Approach

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport