Hi

On 2/5/26 18:40, Mirco Babin wrote:
So, if you call `$object->__construct()`, there's no error, and you can
get the return value, but if you do `new Foo()`, you'd get an error?

That is correct.

As mentioned in my other email, I believe it should just be an error either way.

In fact I would expect the result to be quite similar to how it already is a compile-time (!) error to return something from a void function:

    function foo(): void {
        return 1;
    }
    // Fatal error: A void function must not return a value

Best regards
Tim Düsterhus

Reply via email to