Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed

From: Date: Tue, 14 Apr 2020 16:06:30 +0000
Subject: Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-109636@lists.php.net to get a copy of this message
> Le 14 avr. 2020 à 16:54, Nicolas Grekas <nicolas.grekas+php@gmail.com> a écrit : > > I'm just not sold on allowing "void" on __construct, because the very concept of > a return type on a constructor is ... void, and also because of the code style choices this will > open (and the CS "wars" I mentioned). > This issue is not specific to magic method like __construct(). It is the whole concept of “void” as return type which is, say, “problematic”. In fact, “void” is not really a return type. It is a way to state that the method is not supposed to return anything, which means, as you said very well, that “the very concept of return type on [this method] is void”. That might be a reason to reject the concept of “void” as return type. Or to revive https://wiki.php.net/rfc/allow-void-variance <https://wiki.php.net/rfc/allow-void-variance> . But again, the issue is orthogonal to the fact that this particular method is magic, and we should not cherry-pick and reject the concept of “void” for __construct() and similar magic methods only. —Claude

« previous php.internals (#109636) next »