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,
ViewEvent and Application returns the real instance instead of type-hinted interfacesgetView()
method on \Laminas\View\Helper\AbstractHelper
returns the real Renderer instance instead of type-hinted
interface\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!
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();