Skip to content

First class callable for instance methods #14385

@rela589n

Description

@rela589n

Description

Hi there!

I would like to propose following syntax sugar:

/** @var SurveyTemplate[] $templates */

$templateIds = array_map(SurveyTemplate::getId(...), $templates);

As the replacement for more verbose instance method call:

/** @var SurveyTemplate[] $templates */

$templateIds = array_map(static fn (SurveyTemplate $surveyTemplate): Uuid => $surveyTemplate->getId(), $templates);

Currently, first class callable methods allow to wrap only static method, while in current place non-static method is suggested to use.

Please, let me know what you think about it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions