Hi

On 6/15/26 16:56, Levi Morrison wrote:
Tim, sorry if I missed it in the discussion and RFC: is there any plan
to allow declaring `function __construct(): void` at the same time?
Since:
  1. We are going to actively enforce that they don't return anything,
  2. and returning `void` is the correct declaration for such functions
(and I would argue `null` as well but I don't care too much about
this, I debated mentioning it at all because it's a bit off in the
weeds),

doesn't it make sense to also allow declaring a void return at the same time?

Allowing an explicit `: void` return is not part of the RFC.

I intentionally focused on the deprecation to keep the RFC focused on the “important bits”, namely removing this confusing behavior.

That's also why `__clone()` is intentionally left to future scope, since the situation there is slightly different. It definitely makes sense to me to align `__clone()` with `__construct()` in one way or another, though, since they effectively only differ in s/new/clone/ for their intended use.

Best regards
Tim Düsterhus

Reply via email to