Skip to content

Incorrect behavior of RenameParamToMatchTypeRector #8693

@samsonasik

Description

@samsonasik

Bug Report

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

Minimal PHP Code Causing Issue

When param name used as ArrowFunction param, it should be skipped.

See https://getrector.com/demo/14b8b5f1-05ee-4ecb-9d84-973ddc5297a4

<?php

use PhpParser\Node\Stmt\Foreach_;
use PhpParser\Node\Expr\Variable;

final class DemoFile
{
    public function run(Foreach_ $node)
    {
      array_map(
          fn (Variable $node) 
          => $node,
          []
          );
    }
}

Responsible rules

  • RenameParamToMatchTypeRector

Expected Behavior

Should be skipped, ref rectify error at rectorphp/rector-src@33ddf96

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