Skip to content

Is there an upgrade rule from Closure::fromCallable() to first class callable syntax? #9266

@devnix

Description

@devnix

Hi! I was wondering if there isn't a rule to upgrade Closure::fromCallable() to first class callable syntax. I'm playing with the upgrade rules to PHP 8.1 but I think this is not being refactored, and I wanted to be sure that this isn't implemented in any way before doing a custom rule:

new CodeSample(
    "Closure::fromCallable([$obj, 'method']);",
    "$obj->method(...);"
),
new CodeSample(
    "Closure::fromCallable('trim');",
    "trim(...);"
),
new CodeSample(
    "Closure::fromCallable(['SomeClass', 'staticMethod']);",
    "SomeClass::staticMethod(...);"
),

If I get it working, would you like a pull request to have it on the PHP 8.1 ruleset?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions