Re: [IDEA for RF C] let the "new" operator fail when the __construct( ) function returns a value.
| From: | Rowan Tommins [IMSoP] | Date: | Sat, 21 Feb 2026 16:27:07 +0000 |
| Subject: | Re: [IDEA for RF C] let the "new" operator fail when the __construct( ) function returns a value. | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130120@lists.php.net to get a copy of this message | ||
On 20 February 2026 16:07:01 GMT, Mirco Babin <mirco.babin@gmail.com> wrote:
>Failing early is not always possible. The compiler can not always infere
>the correct return type.
PHP defines "void" separately from "null", precisely so that the compiler
doesn't need to infer anything about the returned value. All it has to do is distinguish
"return;" from "return some_expression;"
Example: https://3v4l.org/cTaBP
Rowan Tommins
[IMSoP]