Skip to content

Incorrect Named Argument generation for variadic function sprintf(), array_merge(), ... #18

@tiggerduck

Description

@tiggerduck

Version: v0.1.23

Rector-Rule incorrectly transforms sprintf calls into named arguments using non-existent parameter names like values1.

sprintf(format: $message, values1: $property)

In PHP (including the latest version 8.4), sprintf is defined with a variadic parameter:
function sprintf(string $format, mixed ...$values): string.

The $values part collects all trailing arguments into an array. There is no parameter explicitly named $values1. Attempting to run the Rector-generated code results in a fatal error:
Fatal error: Uncaught Error: Unknown named parameter $values1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions