bnf/phpstan-psr-container
PHPStan dynamic return type extension for PSR-11 ContainerInterface. Improves type inference for $container->get() so services are typed correctly during static analysis. Install via Composer and include extension.neon (or use phpstan/extension-installer).
container.get() calls, improving developer confidence.Adopt this package when your project uses a PSR-11-compliant container (e.g., Symfony, Laravel, Zend Expressive) and relies on ContainerInterface::get() for dependency resolution. It is ideal when:
Avoid if:
For executives: "This extension significantly reduces production bugs related to service resolution by catching errors during development via PHPStan. It lowers debugging time and accelerates release cycles by ensuring service dependencies are correctly defined before deployment—without requiring new infrastructure or developer training. The minimal integration effort (just adding the package) delivers high ROI. Additionally, its compatibility with PHPStan 2.x ensures long-term alignment with modern tooling, reducing future migration risks and maintenance overhead."
For engineering teams: "This package eliminates false positives in PHPStan for PSR-11 containers, giving developers confidence in their dependency resolution. With support for the latest PHPStan versions, it future-proofs your static analysis setup while requiring zero additional configuration. Ideal for large codebases or microservices where container validation is critical."
How can I help you explore Laravel packages today?