On 16.06.2020 at 21:30, Benas IML wrote: > I put the original RFC on hold and created a new PR [0] for implicitly > enforcing `void` rules on both constructors and destructors. Note, that > this results in a BC break since it is no longer legal to return non-void > value from constructors/destructors. In other words, it is now illegal to > return something from ctor. > > As a side bonus, it is also allowed to explicitly declare both > `__construct()` and `__destruct()` as `void` (but this is by no means > mandatory, it's optional). > > I'm not sure whether this needs a proper RFC since this is more of a patch > (fix: #79679) than a new feature, so let me know! > > This PR should also address all of Máté's concerns since it makes > constructors and destructors always return `void` (even when no explicit > `void` return type is specified).
Thanks, I tend to prefer this solution. Given the potential BC break (constructors may be called like normal methods, so returning something can make sense), I think an RFC is justified. -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php