Re: [VOTE] Deprecate returning values from __construct() and __destruct()
| From: | Levi Morrison | Date: | Mon, 15 Jun 2026 14:56:32 +0000 |
| Subject: | Re: [VOTE] Deprecate returning values from __construct() and __destruct() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131280@lists.php.net to get a copy of this message | ||
On Mon, Jun 15, 2026 at 7:11 AM Tim Düsterhus <tim@bastelstu.be> wrote:
>
> Hi
>
> I just opened the vote on “Deprecate returning values from __construct()
> and __destruct()”.
>
> RFC: ‰¼¢Ãg6փ
> (
h[¯Ö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?