Skip to content

Update return types in TemplateAnnotationRector #2256

@stedekay

Description

@stedekay
Subject Details
Rector version e.g. v0.5.20
PHP version e.g. PHP 7.3
Full Command vendor/bin/rector process --set framework-extra-bundle-50 src

Current Behaviour

I know, its getting annoying with my issues :)
I found another case I've got sometimes. When the controller has an array return type it doesn't get updated to Response.

    /**
     * @return array
     */
    public function indexAction(): array
    {
        return $this->render('AppBundle:Module:index.html.twig');
    }

Minimal PHP Code Causing Issue

    /**
     * @Template("AppBundle:Module:index.html.twig")
     *
     * @return array
     */
    public function indexAction(): array
    {
        return [];
    }

Expected Behaviour

    /**
     * @return Response
     */
    public function indexAction(): \Symfony\Component\HttpFoundation\Response
    {
        return $this->render('AppBundle:Module:index.html.twig');
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions