Hi all,

I'd like to propose an Invokable interface, the Stringable equivalent for
__invoke().

The idea has come up a few times over the years (most recently in the PR
#15492 discussion, where Gina suggested this exact approach) but never had
a concrete implementation.

I've put one together: https://github.com/php/php-src/pull/21574

It follows the Stringable pattern: auto-implemented for any class defining
__invoke(), explicitly implementable with enforcement, and covariant to
callable in return type checks.

I'm working on a formal RFC and would love feedback before posting it.

I'd also like to request wiki karma to create the RFC page — my wiki
username is *aldemeery*.

Thanks,

Osama Aldemeery

Reply via email to