On Wed, Jun 17, 2020 at 9:18 AM Christian Schneider <cschn...@cschneid.com> wrote:
> Am 16.06.2020 um 21:30 schrieb Benas IML <benas.molis....@gmail.com>: > > 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. > > This is a huge BC break as up to now returning something in a constructor > was silently ignored. > Therefore I'd strongly advise to go through a deprecation phase > (E_DEPRECATED or E_WARNING) before making it a fatal error so old software > can be fixed first. > I analyzed the top 2k composer packages, and found 95 places that would be affected by making __construct implicitly void: https://gist.github.com/nikic/e0d7c9c810e15b843ffd7d6779a2e49a Common cases seem to be "return parent::__construct()", "return $this" and "return false". There's not a lot of them, but I do tend to agree that starting out with a warning would be better. Regards, Nikita