It passed 39 to 0, with no abstentions, clearing the two-thirds majority it needed. Voting closed on June 29, 2026. The RFC targets PHP 8.6, and the page marks it as implemented.
Deprecate returning values from __construct() and __destruct()
Deprecates returning a value, or using yield, in __construct() and __destruct(), while a bare return; stays legal.
Deprecate returning values from __construct() and __destruct()?
This poll has closed.
Summary
You can't give __construct() or __destruct() a return type, not even void, but PHP still lets you write return 123; inside them. The value just goes nowhere, which can confuse people. This RFC from Tim Düsterhus deprecates returning a value from either method.
Show me
Here is a trimmed version of the RFC's example:
class Foo { public function __construct() { return 123; // Deprecated: Returning a value from a constructor is deprecated } } class Bar { public function __construct() { if (random_int(0, 1)) { return; // Skipping the rest of the logic remains legal. } echo "Constructing", PHP_EOL; } }
A bare return; with no value still works, so you can keep using it to skip the rest of the method.
Using yield inside a constructor or destructor is deprecated too, since it turns the method into a generator that returns a Generator object.
The deprecation is raised at compile time, not when the code runs. In the next major version it becomes an error, matching how a void function already fails if it returns a value.
You can still call __construct() and __destruct() directly. For example, parent::__construct() works the same as before.
What it means for existing code
The deprecation alone doesn't break anything. Your code still runs, but you'll see a deprecation notice. Once it becomes an error in a later major version, code that returns a value will stop working.
This pattern is rare. Juliette Reinders Folmer checked the top 4,000 Composer packages and found 77 return statements with a value, across 59 files in 36 packages, and 21 of them were return $this;. To fix yours, drop the value from the return.