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

Incorrect behavior of SingleInArrayToCompareRector #7893

Closed
raoz opened this issue Apr 20, 2023 · 1 comment · Fixed by rectorphp/rector-src#3640
Closed

Incorrect behavior of SingleInArrayToCompareRector #7893

raoz opened this issue Apr 20, 2023 · 1 comment · Fixed by rectorphp/rector-src#3640

Comments

@raoz
Copy link

raoz commented Apr 20, 2023

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/001ae62c-7857-4ce2-b4c1-8be77fd37568

<?php

final class DemoFile
{
    public function run()
    {
        $a = ['a', 'b'];
        echo in_array('a', [...$a]);
    }
}

Responsible rules

  • SingleInArrayToCompareRector

Expected Behavior

Either no change or

<?php

final class DemoFile
{
    public function run()
    {
        $a = ['a', 'b'];
        echo in_array('a', $a);
    }
}
@raoz raoz added the bug label Apr 20, 2023
@samsonasik
Copy link
Member

It should be skipped, should can be checked by if there is item is variadic, could you try provide a patch? Thank you.

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

Successfully merging a pull request may close this issue.

2 participants