> On Jul 2, 2021, at 12:30 AM, Hossein Baghayi <hossein.bagh...@gmail.com> 
> wrote:
> 
> Hello,
> 
> On Sun, 27 Jun 2021 at 19:09, Ralph Schindler <ra...@ralphschindler.com>
> wrote:
> 
>> 
>> This proposes a method for a publisher/framework/producer (the caller of
>> the callback) to document all the parameters that are available as named
>> parameters, and subscribers/consumers (creator of the callback) could
>> subscribe to what they need by name.
>> 
> 
> Wouldn't it rather be nice if we had more detailed callable types instead?
> I mean instead of simply defining a parameter type as `callable` we could
> specifically define what the callable expects.
> 
> Something like this:
> ```
> function bar ((int, string):bool $callback) {...}
> ```
> 
> A more generic approach that could be more descriptive, maybe.
> 
> I have no clue if this was already discussed in other threads or not. And
> whether it is feasible to implement.


From 2015 which failed (not sure why): 

https://wiki.php.net/rfc/callable-types

But I believe that would be better to be part of a broader ability to define 
our own types, e.g.

type function(int, string):bool IntStrFunc;
function bar (intStrFunc $callback) {...}

I think a few have mentioned user-defined types in the recent past but I am not 
aware of it being a current RFC for it. 

-Mike

Reply via email to