Skip to content

Incorrect behavior of ConstraintOptionsToNamedArgumentsRector #9344

@philiprabbett

Description

@philiprabbett

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/aa3b9a7a-31bb-459e-ad2a-ae5926507c7f

<?php

use Symfony\Component\Validator\Constraints as Assert;

final class DemoFile
{
    #[Assert\Sequentially(
        constraints: [
            new Assert\Choice(
                options: ['New York', 'Berlin', 'Tokyo'],
                message: 'Choose a valid genre.'
            ),
            new Assert\Count(min: 1),
        ],
    )]
    public string $city;
}

Responsible rules

  • ConstraintOptionsToNamedArgumentsRector

Expected Behavior

The rule shouldn't remove options from the constraint

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