Re: [RFC] [DISCUSSION] Allow void return type forconstructors/destructors

From: Date: Wed, 17 Jun 2020 14:00:04 +0000
Subject: Re: [RFC] [DISCUSSION] Allow void return type forconstructors/destructors
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-110631@lists.php.net to get a copy of this message
On 17.06.2020 at 15:36, Christian Schneider wrote: > I'm not sure I understand the second part "and doesn't have an explicit > : void declaration". > If there is a ' : void' declaration then returning any value will be an error. > As far as I can see this is already the case: > php -r 'class A { function __construct() : void { return 42; } }' > with PHP 7.4 gives > PHP Fatal error: A void function must not return a value in Command line code on line 1 But see <https://3v4l.org/uEOnQ>. -- Christoph M. Becker

« previous php.internals (#110631) next »