Skip to content
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

AbstractActionController:indexAction states it can only return ViewModel #71

Open
boesing opened this issue Jan 7, 2021 · 0 comments
Open
Labels
Bug Something isn't working Help Wanted

Comments

@boesing
Copy link
Member

boesing commented Jan 7, 2021

Bug Report (non-critical)

Q A
Version(s) 3.2.0

Summary

The pre-defined method AbstractActionController::indexAction states that it can only return ViewModel.
In Projects which implement their own FooController::indexAction, static analysis complains about an invalid return type if e.g. a Laminas\Http\Response is returned.

Current behavior

Static code analysis complains about invalid return type.

How to reproduce

<?php
declare(strict_types=1);

use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;

final class FooController extends AbstractActionController
{
    public function indexAction(): Response
    {
        return new Response();
    }
}
Return type                                                            
         (Laminas\Http\Response) of method                                           
         FooController::indexAction() should be       
         compatible with return type (Laminas\View\Model\ViewModel) of method   
         Laminas\Mvc\Controller\AbstractActionController::indexAction()   

Expected behavior

No errors.

@boesing boesing added the Bug Something isn't working label Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Help Wanted
Projects
None yet
Development

No branches or pull requests

1 participant