Skip to content

Controller plugins seem not to be recognized #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
parktrip opened this issue Feb 5, 2020 · 3 comments
Closed

Controller plugins seem not to be recognized #5

parktrip opened this issue Feb 5, 2020 · 3 comments
Labels
question Further information is requested

Comments

@parktrip
Copy link

parktrip commented Feb 5, 2020

first, thank you for this nice module for Laminas

I have an issue but I am afraid it is more configuration problem at my level.

when I run phpstan, controller plugins are not recognized and appears as errors. Can be the ones from Laminas like identity() or flashMessenger() or the ones I have defined in my application.

Application is working and I have checked if modules like 'Laminas\Mvc\Plugin\Identity' and
'Laminas\Mvc\Plugin\FlashMessenger' are in the modules list in the config/application.config.php file.

here is my neon file:
includes: - vendor\slam\phpstan-laminas-framework\extension.neon parameters: level: 1

here is the command I run as the root level of my app:

vendor\bin\phpstan analyse vendor\MyVendor\MyModule\src --memory-limit 512M

here is part of the output
`Note: Using configuration file D:\www\melliol\ern\phpstan.neon.
85/85 [============================] 100%


Line Controller\CollectionController.php


179 Call to an undefined method MyModule\Controller\CollectionController::translate().
185 Call to an undefined method MyModule\Controller\CollectionController::translate().
188 Call to an undefined method MyModule\Controller\CollectionController::identity().`
(....)


Line Controller\DirectoryController.php


151 Call to an undefined method MyModule\Controller\DirectoryController::acl().
169 Call to an undefined method MyModule\Controller\DirectoryController::acl().
197 Call to an undefined method MyModule\Controller\DirectoryController::displayFormErrorMessages().
(....)`

can you tell me what am i doing wrong ?

thank you in advance

@Slamdunk
Copy link
Owner

Slamdunk commented Feb 5, 2020

Have you provided your custom service manager as described in the readme https://github.com/Slamdunk/phpstan-laminas-framework#configuration ?

@Slamdunk Slamdunk added the question Further information is requested label Feb 5, 2020
@parktrip
Copy link
Author

parktrip commented Feb 5, 2020

No I didn't as this sentence in your doc:

This library already recognize built-in services and plugins.

makes me think I didn't need to do this.

by doing this, it is working like a charm, thank you for your very quick support.

have a nice day,

@parktrip parktrip closed this as completed Feb 5, 2020
@Slamdunk
Copy link
Owner

Slamdunk commented Feb 5, 2020

On higher PHPStan level, you'll also need some ignores like:

  1. '#Method .+Controller::(indexAction|notFoundAction)\(\) should return Laminas\\View\\Model\\ViewModel but returns .+#' see Updated AbstractActionController::indexAction return type to reflect real usage laminas/laminas-mvc#5
  2. '#Method .+Controller::.+Action\(\) has no return typehint specified#' on level 6 if you don't want to bother with return types of controller actions

I have to document these somewhere...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants