Skip to content

Convert float value to string with ScalarArgumentToExpectedParamTypeRector rule. #9358

Closed

Description

@laurentmuller

Bug Report

Subject Details
Rector version 2.1.6

Minimal PHP Code Causing Issue

class Column
{
    public function __construct(private ?string $text = null, private float $width = 0.0)
    {
    }

    public function instance(?string $text = null, float $width = 0.0)
        return new self($text, $width);
    }
}

use PHPUnit\Framework\TestCase;

class ColumnTest extends TestCase
{
    public function testWidth(): void
    {
        $column = Column::instance(width: 10.5)
        // ...
    }
}

When running rector:

- Column::instance(width: 10.0));
+ Column::instance(width: '10'));

Expected Behaviour

No change.

Activity

  1. samsonasik commented on Sep 8, 2025

    @samsonasik
    Member

    Already resolved at latest dev-main, see PR

    please try latest "rector/rector": "dev-main" while wait for next release.

  2. github-actions commented on Feb 8, 2026

    @github-actions
    Contributor

    This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.

  3. locked as resolved and limited conversation to collaborators on Feb 8, 2026
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