Skip to content

RenameVariableToMatchMethodCallReturnTypeRector only considers first return type #9533

@FloydOtsoko

Description

@FloydOtsoko

Bug Report

Subject Details
Rector version v 2.2.11

Description:
If a Function returns ClassA|ClassB, Rector will always use the first one, to rename the Variables.

In my example I am using:

$ffmpeg = FFMpeg::create();

$video = $ffmpeg->open(Storage::disk('media')->path($this->path));

from FFMpeg::open header: * @return Audio|Video

Rector will rename my variable $video to $audio

Reproduce
Demo does not make changes, probably because FFMpeg is not found.
I have attached my console output to the demo

https://getrector.com/demo/38133f09-9257-41cb-becd-0742d6edf8c2

Expected Behaviour

I expect Rector to allow $audio and $video as possible variable names in this case specific case.

For other similar cases, I expect Rector to allow all possible return types as variable names

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions