All,
Apologies for the long silence. I wanted time to sit with the responses
before replying, and that turned into longer than I intended.

Thanks for the depth of the replies. The points raised here, and in the
discussion on the PR, have shown me things I hadn't seen.
I still think there is a real gap between Closure and callable, but I am no
longer sure a marker interface is the right shape for filling it.

Given that, it doesn't feel right to keep this thread open and ask for more
of the list's time on something I'm no longer confident in.
I'll step back from the proposal, and I've closed the PR.

Thank you all.

Regards,
Osama Aldemeery

On Sun, Apr 5, 2026 at 4:58 AM Hans Krentel <[email protected]> wrote:

> On Thursday 02 April 2026 16:23:03 (+02:00), Matthew Weier O'Phinney wrote:
>
>  > If you define mixed, you cannot have a void or never return.
>
> We can't speak for Liskov (only she can), but as far as stable PHP is
> concerned never is actually fine, and should also stand a common
> interpretation of LSP, as never is the bottom type and henceforth a
> specialization of mixed. (Some may go for void, too, but that is far more
> abstract and does not work conceptually in PHP if I'm not mistaken.)
>
> Furthermore, the PHP runtime also guarantees that any function can never
> return, not only by the never return type.
>
> So it's at least irrelevant to implement a new throwable via an invocable
> mixed interface or never, the invocation in the runtime guarantees the
> higher contract to the return:
>
>      <?php
>
>      interface invocable {
>          public function __invoke(): mixed;
>      }
>
>      $o = new class implements invocable {
>          public function __invoke(): never {}
>      };
>
>      $o();
>
> Interface violation normally yields a compile error, not a type error,
> nowadays.
>
> So if you think that is an error, the discussion should have brought
> something to the table.
>
> -- hakre
>

Reply via email to