Skip to content

Incorrect behavior of AddMethodCallBasedStrictParamTypeRector with variadic argument #7926

@smelesh

Description

@smelesh

Bug Report

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

Rector changes variadic argument type to array when passing arguments using a splat operator.

Minimal PHP Code Causing Issue

See https://getrector.com/demo/726efeee-2c58-4ed5-8c10-73e9416145a5

<?php

declare(strict_types=1);

final class Bug
{
    /**
     * @param list<int> $list
     */
    public function __construct(array $list)
    {
        $this->process(...$list);
    }

    private function process(int ...$variadic): void
    {
    }
}

Responsible rules

  • AddMethodCallBasedStrictParamTypeRector

Expected Behavior

Rector should skip it or choose a correct type.

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