Skip to content

Incorrect behavior of RenameForeachValueVariableToMatchExprVariableRector #9866

Description

@samsonasik

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/642b537d-cbad-4f00-a4fe-0cd8fc3a0f70

<?php

namespace App;

class AnonymousClassNode {}

class Test
{
    public function run()
    {
        $anonymousClassNodes[] = new AnonymousClassNode();

        foreach ($anonymousClassNodes as $anonymousClassNode) {

        }
    }
}

Responsible rules

  • RenameForeachValueVariableToMatchExprVariableRector

Expected Behavior

It should be skipped, anonymousClassNode should not be renamed to anonymouClassNode

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions