CakePHP 4 plugin extension for PHPStan.

Installs: 654

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 10

Forks: 0

Open Issues: 1


1.0.1 2020-05-25 12:53 UTC

This package is auto-updated.

Last update: 2020-07-25 13:34:29 UTC


Build Status Downloads Latest Version License

This extension provides following features:

  1. Provide correct return type \Cake\ORM\Locator\LocatorInterface::get
  2. Provide correct return type Cake\Controller\Controller::loadModel
  3. Provide correct return type Cake\Controller\Controller::loadComponent
  4. Provide correct return type Cake\Command\Command::loadModel
  5. Provide correct return type Cake\Console\Shell::loadModel
  6. Provide correct return type Cake\Mailer\Mailer::loadModel
  7. Provide correct return type Cake\View\Cell::loadModel
  8. Provide correct return type Cake\Console\Shell::helper


To use this extension, require it in Composer:

composer require --dev cakedc/cakephp-phpstan

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:

    - vendor/cakedc/cakephp-phpstan/extension.neon


To make your life easier make sure to have @mixin and @method annotations in your table classes. The @mixin annotation will help phpstan know you are using methods from behavior, and @method annotations will allow it to know the correct return types for methods like Table::get, Table::newEntity.

You can easily update annotations with the plugin IdeHelper


For bugs and feature requests, please use the issues section of this repository.

Commercial support is also available, contact us for more information.


If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our Contribution Guidelines for detailed instructions.


Copyright 2020 Cake Development Corporation (CakeDC). All rights reserved.

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file