Re: [VOTE] Deprecate returning values from __construct() and __destruct()
| From: | Tim Düsterhus | Date: | Mon, 15 Jun 2026 13:23:45 +0000 |
| Subject: | Re: [VOTE] Deprecate returning values from __construct() and __destruct() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131276@lists.php.net to get a copy of this message | ||
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