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

Transforming back() function using HelperFunctionToConstructorInjectionRector in Laravel works incorrectly #1824

Closed
sashabeton opened this issue Aug 7, 2019 · 2 comments

Comments

@sashabeton
Copy link
Contributor

sashabeton commented Aug 7, 2019

PHP version: 7.2
Full Command: rector process ./src

Current Behaviour

back() function is being transformed incorrectly (without function usage)

Source:

<?php

use Illuminate\Http\RedirectResponse;

class Controller
{
    public function someAction(): RedirectResponse
    {
        return back();
    }
}

Transformed:

<?php

use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;

class Controller
{
    /** @var Redirector */
    private $redirector;

    public function __construct(Redirector $redirector)
    {
        $this->redirector = $redirector;
    }

    public function someAction(): RedirectResponse
    {
        return $this->redirector;
    }
}

Expected Behaviour

Expected behavior is to transform back() call correctly ($this->redirector->back())

image

@TomasVotruba
Copy link
Member

Thanks for reporting the issue.

Please send PR with failing test case, so we can spot the exact point of the error

sashabeton added a commit to sashabeton/rector that referenced this issue Aug 12, 2019
@TomasVotruba
Copy link
Member

Resolved by #1845

@sashabeton Just a tip to let Github close this automatically: https://help.github.com/en/articles/closing-issues-using-keywords

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

No branches or pull requests

2 participants