Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130081 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 0BA021ADC5C for ; Tue, 17 Feb 2026 07:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771314043; bh=z+5Q52HUnqofBxmdIvnHgBi6eEiWdnxcFEw+BZVmM9E=; h=Date:From:To:Subject:In-Reply-To:References:From; b=GTkuHregGEuJJAppYnIJru+gWzuapyYTHlAnVAILKGCnrxfmAoZniyV2TmC7OqUnf LOxryJhln7nrdR7qbf9tpIV5ymMwUvtKNnPcbsxj/s0ffkE1hPsguLFp5lZxulm8WF fhBbl0u5h6tR+DZQB7bmsVZh88Y/qTl8xq7+v7K3VRNFEf+zQo8RsV1jkllCiHpaZp Ev4qUpg3ulJTwYRrReY0uURCxLyJfnk3HsRMNx/4nCylLDHueXhDdLdJ8lfvnavw76 ykfuhA/aeJOWlAou2u5Q/OAwoOuotRTK3Mff90y4bnRFd6uWkoKcfQMR0CqbX5fdlc bG6+hr2UeA91Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 213131804C2 for ; Tue, 17 Feb 2026 07:40:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 17 Feb 2026 07:40:39 +0000 (UTC) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4fFWlL3h0Vz9tn0; Tue, 17 Feb 2026 08:40:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mabe.berlin; s=MBO0001; t=1771314030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z+5Q52HUnqofBxmdIvnHgBi6eEiWdnxcFEw+BZVmM9E=; b=YjV4NVLGE13Y4va1VFvtaCf9UB+eqo946f+kI5u72uQ07LGQMPQtTDSMUwS+G1qaeiV5aW YwqKqvscJu3yCLovdpZZ1bVVeNw3+NEnldmNAIzj563LIIaM7eJp7XH1L+E8PB6Vs9u+xS gqIoz+vJR2oTlrBMPYmwwg+qwnk7s9Y6F3Lg7gSB/g5hpIPQ+uJRPX+yzoFi/I2rQR6koc 6CG685DlpiziYBGsLuCdsGWProLdpSg3LJ6f+FJ8aolfwpbW6I/Tfz+g6xCCqTLfEslbL4 d6rtFu9NZfVa99l/pK5HFGS71UUNzJEjZEoZURKWZUn4jIozzCPxLMEmn54bFg== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of marc@mabe.berlin designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=marc@mabe.berlin Date: Tue, 17 Feb 2026 08:40:28 +0100 To: internals@lists.php.net, Mirco Babin , "Rowan Tommins [IMSoP]" Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_=5BIDEA_for_RF?= =?US-ASCII?Q?C=5D_let_the_=22new=22_operator_?= =?US-ASCII?Q?fail_when_the_=5F=5Fconstruct=28?= =?US-ASCII?Q?=29_function_returns_a_value=2E?= In-Reply-To: References: <1f25d77e-224b-40d6-bf19-18dfdfc9de54@rwec.co.uk> Message-ID: <3C55E40A-1F0E-49FD-BB0B-977C10218E5A@mabe.berlin> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4fFWlL3h0Vz9tn0 From: marc@mabe.berlin ("Marc B.") Hi Mirco, Am 17=2E Februar 2026 07:59:43 MEZ schrieb Mirco Babin : >>Hi Mirco, and welcome! >> >>I agree that allowing constructors to return a value leads to confusion, >>and would support deprecating and then forbidding this=2E >> >>However, I agree with others that this should be checked when compiling >>the constructor, not when running it under the "new" operator=2E In othe= r >>words, make any method named "__construct" give >the same error as a >>function or method marked ": void"=2E > >Hello Rowan Tommins, > >I disagree with the compiling part=2E The __construct() function can >currently not have a return type, so the return type is implicitly >"mixed"=2E Changing that would be a BC break for those calling the >__construct() function as a regular function=2E > >As written to Tim D=C3=BCsterhus: I have prepared a RFC at >https://gist=2Egithub=2Ecom/MircoBabin/aaa574297c8d1baa879f19c99ce28e93 I'm with Roman here as well=2E Yes, it's a BC break, but as Roman suggested, there would be a deprecation= phase before and forbidden only in PHP 9=2E This should give enough time t= o adopt=2E Also, you are talking about the constructor only, which is ok, but I belie= ve the destructor needs to be discussed as well and mentioned in the RFC=2E > >Kind regards, >Mirco Babin Regards, Marc