slam/phpstan-zend-framework

This package is abandoned and no longer maintained. The author suggests using the slam/phpstan-laminas-framework package instead.

Zend Framework 3 MVC controller plugin extension for PHPStan.

Maintainers

👁 Slam

Package info

github.com/Slamdunk/phpstan-zend-framework

Type:phpstan-extension

pkg:composer/slam/phpstan-zend-framework

Statistics

Installs: 9 293

Dependents: 0

Suggesters: 0

Stars: 5

Open Issues: 2

v0.11.0 2019-06-07 10:04 UTC

MIT bf21aa721487308934366248dd4614ed50d021b5

  • Michael Gooden <me.woop@michaelgooden.net>
  • Greg Bell <greg.woop@bitwombat.com.au>
  • Filippo Tessarotto <zoeslam.woop@gmail.com>

This package is auto-updated.

Last update: 2020-01-02 14:08:34 UTC


README

Repository abandoned 2019-12-31

This repository has moved to Slamdunk/phpstan-laminas-framework.

PHPStan extension for Zend Framework

👁 Build Status
👁 Scrutinizer Code Quality
👁 Packagist
👁 Total Downloads

This extension provides following features:

  1. Provide correct return types for \Zend\ServiceManager\ServiceLocatorInterface::get() using real service instances
  2. Handle controller plugins that are called using magic __call() in subclasses of \Zend\Mvc\Controller\AbstractController
  3. getApplication(), getRenderer(), getRequest() and getResponse() methods on Controllers, MvcEvents, View, ViewEvent and Application returns the real instance instead of type-hinted interfaces
  4. getView() method on \Zend\View\Helper\AbstractHelper returns the real Renderer instance instead of type-hinted interface
  5. \Zend\Stdlib\ArrayObject is configured as a Universal object crate
  6. Handle \Zend\Stdlib\AbstractOptions magic properties

Installation

To use this extension, require it in Composer:

composer require --dev slam/phpstan-zend-framework

If you also install phpstan/extension-installer then you're all set!

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:
 zendframework:
 serviceManagerLoader: tests/service-manager.php

For example, tests/service-manager.php would look something like this:

$app = \Zend\Mvc\Application::init($config);
return $app->getServiceManager();