Re: [RFC] Deprecate returning values from __construct() and __destruct()
| From: | Juliette Reinders Folmer | Date: | Thu, 28 May 2026 17:19:27 +0000 |
| Subject: | Re: [RFC] Deprecate returning values from __construct() and __destruct() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131040@lists.php.net to get a copy of this message | ||
On 8-5-2026 10:44, Tim Düsterhus wrote:
following Rowan’s request from the earlier “let the "new" operator fail when the __construct( ) function returns a value” discussion [1], I have now created a dedicated RFC to deprecate returning values from __construct() and __destruct(). Please find the RFC text at: https://wiki.php.net/rfc/deprecate-return-value-from-constructAs I mentioned in my earlier message about this topic [1], a PHP_CodeSniffer sniff already exists to forbid this. For lack of an impact analysis in the RFC, I've now used this sniff to create an impact analysis [2] based on the Packagist 4000 as downloaded by me some two months ago. Configuration used and full scan results are available in the gist. Smile, Juliette [1] https://externals.io/message/129980#130043 [2] https://gist.github.com/jrfnl/6782310676b7ff5942f97873a71552ea