Re: RFC proposal: Invokable interface

From: Date: Mon, 30 Mar 2026 08:37:49 +0000
Subject: Re: RFC proposal: Invokable interface
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-130488@lists.php.net to get a copy of this message
On 30 March 2026 08:58:03 BST, Rob Landers <rob@bottled.codes> wrote: >I'd prefer if the interface forced an empty argument set. You can add arguments so long as >they're optional. But generally speaking, there is no need for arguments on an invokable class >-- that is what constructors and properties are for. An invokable class can be used for all the same things as any other callable - I've seen them used for event handlers, middleware, comparison for sorting, and so on. A type check for "callable with no arguments and mixed/unspecified return" would be a simple special case of the often-discussed "callable with specified signature"; but I don't think that's what's proposed here. Regards, Rowan Tommins [IMSoP]

« previous php.internals (#130488) next »