# [VOTE] Deprecate returning values from __construct() and __destruct()

- Thread: https://externals.io/message/131272
- Original archive: https://news-web.php.net/php.internals/131272
- Started by tim@bastelstu.be on 2026-06-15T13:09:08+00:00
- Messages: 6
- RFC: Deprecate returning values from __construct() and __destruct() (Implemented (PHP 8.6)) — https://externals.io/rfc/deprecate-return-value-from-construct.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #131272 — tim@bastelstu.be — 2026-06-15T13:09:08+00:00

URL: https://externals.io/message/131272#131272

Hi

I just opened the vote on “Deprecate returning values from __construct() 
and __destruct()”.

RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct
Discussion: https://news-web.php.net/php.internals/130808

There is a single primary vote to cast. Voting closes 2026-06-29 
14:00:00 UTC.

Best regards
Tim Düsterhus

---

## #131274 — Kamil Tekiela — 2026-06-15T13:19:49+00:00

URL: https://externals.io/message/131272#131274 · In reply to: #131272

> Hi
>
> I just opened the vote on “Deprecate returning values from __construct()
> and __destruct()”.
>
> RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct
> Discussion: https://news-web.php.net/php.internals/130808
>
> There is a single primary vote to cast. Voting closes 2026-06-29
> 14:00:00 UTC.
>
> Best regards
> Tim Düsterhus
>

Just to clarify: return $this->privateVoidReturning(); will also trigger a
deprecation?

---

## #131276 — tim@bastelstu.be — 2026-06-15T13:23:45+00:00

URL: https://externals.io/message/131272#131276 · In reply to: #131274

Hi

Am 2026-06-15 15:19, schrieb Kamil Tekiela:
> Just to clarify: return $this->privateVoidReturning(); will also 
> trigger a
> deprecation?

Yes. This is consistent with `return some_void();` in a function that 
has an explicit `: void` return type:

     <?php

     function foo(): void {
         return;
     }

     function bar(): void {
         return foo();
     }

see: https://3v4l.org/2cQYR#v

I'll make sure to add a corresponding test case to the implementation 
for completeness.

Best regards
Tim Düsterhus

---

## #131280 — Levi Morrison — 2026-06-15T14:56:32+00:00

URL: https://externals.io/message/131272#131280 · In reply to: #131272

>
> Hi
>
> I just opened the vote on “Deprecate returning values from __construct()
> and __destruct()”.
>
> RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct
> Discussion: https://news-web.php.net/php.internals/130808
>
> There is a single primary vote to cast. Voting closes 2026-06-29
> 14:00:00 UTC.
>
> Best regards
> Tim Düsterhus

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?

---

## #131291 — tim@bastelstu.be — 2026-06-15T18:31:34+00:00

URL: https://externals.io/message/131272#131291 · In reply to: #131280

Hi


> 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

---

## #131589 — tim@bastelstu.be — 2026-06-29T14:48:08+00:00

URL: https://externals.io/message/131272#131589 · In reply to: #131272

Hi

Am 2026-06-15 15:09, schrieb Tim Düsterhus:
> I just opened the vote on “Deprecate returning values from 
> __construct() and __destruct()”.
> 
> RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct
> Discussion: https://news-web.php.net/php.internals/130808
> 
> There is a single primary vote to cast. Voting closes 2026-06-29 
> 14:00:00 UTC.

The RFC was accepted unanimously with 39 (Yes) votes and no abstentions.

Best regards
Tim Düsterhus
