Laminas Framework 3 extensions for PHPStan
MIT License
This extension provides following features:
$container->get()
calls on containers of type\Laminas\ServiceManager\ServiceLocatorInterface
, \Interop\Container\ContainerInterface
or \Psr\Container\ContainerInterface
__call()
in subclasses of\Laminas\Mvc\Controller\AbstractController
plugin
method of AbstractController
, FilterChain
, PhpRenderer
and ValidatorChain
getApplication()
, getRenderer()
, getRequest()
and getResponse()
methods on Controllers, MvcEvents, View,getView()
method on \Laminas\View\Helper\AbstractHelper
returns the real Renderer instance instead of type-hinted\Laminas\Stdlib\ArrayObject
is configured as a Universal object crate
\Laminas\Stdlib\AbstractOptions
magic propertiesTo use this extension, require it in Composer:
composer require --dev slam/phpstan-laminas-framework
If you also install phpstan/extension-installer then you're all set!
If you don't want to use phpstan/extension-installer
, include extension.neon in your project's PHPStan config:
includes:
- vendor/slam/phpstan-laminas-framework/extension.neon
This library already recognize built-in services and plugins.
You can opt in for more advanced analysis by providing the service manager from your own application:
parameters:
laminasframework:
serviceManagerLoader: tests/service-manager.php
For example, tests/service-manager.php
would look something like this:
$app = \Laminas\Mvc\Application::init($config);
return $app->getServiceManager();