-
-
Notifications
You must be signed in to change notification settings - Fork 60
Closed as not planned
Closed as not planned
Copy link
Labels
BugSomething isn't workingSomething isn't working
Description
- Is this related to quality assurance?
When running static analysis against a simple userland controller like:
class MyController extends AbstractActionController
{
public function indexAction()
{
return ['posts' => ['foo', 'bar']];
}
}That do NOT provide the return type, neither with PHP 7.1 return type nor via DocBlock, tools like PHPstan use inherited docs and report:
Method MyController::indexAction() should return Zend\View\Model\ViewModel but returns array.
Of course users should add return types, but it would result in requiring a massive code update without real benefits, since the default behavior of Zend\Mvc framework is to allow:
nullfrom\Zend\Mvc\View\Http\CreateViewModelListener::createViewModelFromNulllistenerarrayfrom\Zend\Mvc\View\Http\CreateViewModelListener::createViewModelFromArraylistenerViewModelfrom\Zend\Mvc\View\Http\DefaultRenderingStrategy::renderlistenerResponseInterfacefrom\Zend\Mvc\SendResponseListener::sendResponselistener
This change only applies to indexAction since I guess its usage is widespread: notFoundAction is untouched as users that override it are, IMHO, already advanced ones.
Ping @Ocramius you type lover ❤️
Reference: https://github.com/Slamdunk/phpstan-zend-framework/issues/5
Originally posted by @Slamdunk at zendframework/zend-mvc#312
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working