>Hi Mirco, and welcome! > >I agree that allowing constructors to return a value leads to confusion, >and would support deprecating and then forbidding this. > >However, I agree with others that this should be checked when compiling >the constructor, not when running it under the "new" operator. In other >words, make any method named "__construct" give >the same error as a >function or method marked ": void".
Hello Rowan Tommins, I disagree with the compiling part. The __construct() function can currently not have a return type, so the return type is implicitly "mixed". Changing that would be a BC break for those calling the __construct() function as a regular function. As written to Tim Düsterhus: I have prepared a RFC at https://gist.github.com/MircoBabin/aaa574297c8d1baa879f19c99ce28e93 Kind regards, Mirco Babin
