Skip to content

Incorrect behavior of SingleInArrayToCompareRector #7893

@raoz

Description

@raoz

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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions