slam / phpstan-laminas-framework
Laminas Framework 3 MVC controller plugin extension for PHPStan.
Fund package maintenance!
Slamdunk
paypal.me/filippotessarotto
Installs: 175 410
Dependents: 13
Suggesters: 0
Security: 0
Stars: 16
Watchers: 5
Forks: 10
Open Issues: 15
Type:phpstan-extension
Requires
- php: ~8.2.0 || ~8.3.0
- phpstan/phpstan: ^1.11.10
Requires (Dev)
- laminas/laminas-cache: ^3.12.2
- laminas/laminas-cache-storage-adapter-memory: ^2.3.0
- laminas/laminas-filter: ^2.37.0
- laminas/laminas-form: ^3.20.0
- laminas/laminas-hydrator: ^4.15.0
- laminas/laminas-i18n: ^2.28.0
- laminas/laminas-inputfilter: ^2.30.1
- laminas/laminas-mail: ^2.25.1
- laminas/laminas-mvc: ^3.7.0
- laminas/laminas-paginator: ^2.18.1
- laminas/laminas-validator: ^2.64.1
- phpstan/phpstan-deprecation-rules: ^1.2.0
- phpstan/phpstan-phpunit: ^1.4.0
- phpunit/phpunit: ^9.6.20
- slam/php-cs-fixer-extensions: ^3.11.1
Conflicts
- laminas/laminas-cache: <3.12
- laminas/laminas-filter: <2.37
- laminas/laminas-form: <3.20
- laminas/laminas-hydrator: <4.15
- laminas/laminas-i18n: <2.28
- laminas/laminas-inputfilter: <2.30
- laminas/laminas-log: <2.16
- laminas/laminas-mail: <2.25
- laminas/laminas-mvc: <3.7
- laminas/laminas-paginator: <2.18
- laminas/laminas-validator: <2.64
- dev-master
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- v0.12.7
- v0.12.6
- v0.12.5
- v0.12.4
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- dev-renovate/phpunit-phpunit-11.x
- dev-renovate/laminas-laminas-validator-3.x
- dev-renovate/all-minor-patch
- dev-phpstan_2
- dev-php_84
- dev-renovate/laminas-laminas-cache-storage-adapter-memory-3.x
- dev-renovate/laminas-laminas-cache-4.x
This package is auto-updated.
Last update: 2024-10-28 17:23:44 UTC
README
This extension provides following features:
- Provide correct return type for
$container->get()
calls on containers of type\Laminas\ServiceManager\ServiceLocatorInterface
,\Interop\Container\ContainerInterface
or\Psr\Container\ContainerInterface
- Handle controller plugins that are called using magic
__call()
in subclasses of\Laminas\Mvc\Controller\AbstractController
- Provide correct return type for
plugin
method ofAbstractController
,FilterChain
,PhpRenderer
andValidatorChain
getApplication()
,getRenderer()
,getRequest()
andgetResponse()
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- Handle
\Laminas\Stdlib\AbstractOptions
magic properties
Installation
To 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!
Manual installation
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
Configuration
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();