Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130079 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 1A0CD1A00BC for ; Tue, 17 Feb 2026 07:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771311611; bh=ihdbWsnKBFSZuKDp5GpAdg/UtTOtpsK/AyMckR6GSI4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=W3DpwLNGlsOFLGJ8ZA0/zyWteaW6nowaG/TNDnNVdtApCspE/lb/tQxKls5e76aF4 43ex759O2bVe5XRThluMgMfRmxHVV8jY1OdZUUnstQTAe133kSfSfwxd6tEj54USkb c2Ra7KcnRJrKCs0b2+Z6AxflmixkrURD9aypz1VGAbwL8CA/UBIT38SL4haNPpAftz g5j4pmCi4DaeBeLUxkDC+DBhNUiNSNUqZlVH94YXp3pC1+qqt7kVftKzwwHpu3MS9H jLJEeiq/iVydWmJwqWLI2sNRDZ7Qas8KHWdXPSwra3bV7eCMPwN+VqwxprnvrC1C3T CYR+OPWMYd8zg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D1CD31801C7 for ; Tue, 17 Feb 2026 07:00:10 +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.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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:00:00 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7d4c65d772cso3284273a34.1 for ; Mon, 16 Feb 2026 22:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771311595; cv=none; d=google.com; s=arc-20240605; b=ZvojlKX+l66ej/WvhUJVqAt3y8ospN8c5mVhp5ZalGdAOK2V1YJvrEQi7C/BKKoMfz W1eu+ibPBhx7cfNO6CBwnNFYPh8LBzDtLfh4XWXCc0WmVZqtcJxxEhGoT/Cdw+hM/M38 4cCY0F2VHl6WeJQE/eLPaFDkjn4/WTyWXcaUrvTxsiZc5Zwvjsp6TbQXYNm9DF5eK8ob C5Lp60CM+L0rPoH7lw9tkLhjBXTqgKeL47snYpDimD5UVMIR6ReoiYFAWFc64XkGs/FJ 57DxAaI9ESQJNXJpDAiU4H2MZrGx1b8NjjwGGGG/Sa0xyhr1KlgYiD/zEmtAhrwobBTZ 3m+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ihdbWsnKBFSZuKDp5GpAdg/UtTOtpsK/AyMckR6GSI4=; fh=0un1hNQkIQnxRVmSrptHpYePKulyS9pFxhu85Wb7djM=; b=YCHzkuXOsYuqaNj39IGdxJmwbGswrRhztfih8TRMlxAERtS4mDKwVu2Z4y5pazV7zF YZ2Jhc1A8LqN8o0Ivn/wqdQtDOJiq1OxwjMJDH2MuClQ+qxqUHEpXvOVEAlTmtYtdhVp n8UhY3Kh8ciP2dtqZsilhgVadYedICD/wh7rmiwEm2T8MbdIrBz/uZtxH3XY5GTsfwbp HmOj/oqkJ3cl1e6Q/Ncm6C/fpMRiI8fss4AClc6NzFEmYUpCmi2l/BkEhm22spKltiNg mbr5/QQv4plwxTc369CtCHQMnE+k/hhFXszk2/3qz1O+SN7FmWCkheWsf3jLSFUW9MjX Q6JA==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771311595; x=1771916395; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ihdbWsnKBFSZuKDp5GpAdg/UtTOtpsK/AyMckR6GSI4=; b=f2fRY+HqCA2dnIJm9eKY1iiQx2Z5bNEyq3W492SQPrTZ9dUUj8EtZsvDxmKAyBWVCH 5jcDE8coH0usixDX1ulSErsrZTKDBGWFXcQKF0KGXsjtGVbtk0WdggxoAmC7fRLIquz0 sSpjBoakI9Gz3DBjcY7ielwOZ8qV+7FgFxvfDFm4iXPT0B3TEDFqvEelppL5J/S3G063 cBXB400YRtJUFJ6QedSfJQ15wbZhoGwtvD4aSIZDOc980Olb0+TbkEzgZrbCqaaTlm5D fIQS+vwVCRLgdfZZnRnOh3b/zFe3Q+EdfQOxPOjbg22Mbq/9T6c7YRBKtY3GA2Oe0Y6u DpxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771311595; x=1771916395; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ihdbWsnKBFSZuKDp5GpAdg/UtTOtpsK/AyMckR6GSI4=; b=FF9DlMgjzwcX2QZYXbvsh44zXEjHVd2EMniRHw1/b12YwvvPwM7N6fdcb8/mBsf5uY X3mRmrTg6pBc5nLf+vCB7D/RgtqpfCDxNjiFNWgA1U4pmj/7M+gRKt3DnWyMYRhH5stD j0FnG2P7tLYWqTC+vlBEW9SJqiCu08j64yLKuJJTot0HXXzbh1OIu9GZX6930g9W+yEI 9n+4MJyVM0+LYkqdeMvwkJwFee165nDHH1OSHqWAAuzlRaURAWInbZFZMHatC0XqOcES DAngBdpigKEYT1ICAarHh73G2JpE2MOyJeFKTOIhnUK1+YEtsAMK0ZogACoPIE2DWtoO sLmA== X-Gm-Message-State: AOJu0YwHn+jt4W7Qlv/SM2XCZTZ80/J8aKwG8r+H2f/QI/7XaWg3E/mW xXB69yHF+BMdOWU/RxGv8TvMZd4ZOY9dH0Fh0b2oF/EZNZRLOEok6y3ne73qB/eqArbOkoxgNoO Ck1rHuV9GnoqPjKvLouh5RLFhryLHc+OI6YGorOU= X-Gm-Gg: AZuq6aJnYFK+86WP8x5OCM1UuWYoqBoVag+w+P73hai1p1uB9PuhtSp2Gc+JzqZSSfn sOP8htylgFB6JCuKvrNYD+Hf2wH8siTWu3s/GCm861Om17YpWUkpmtLXClbohNKnMkpbQJALJ6E DJuEuxd71f7KIAf0/yA7u7m72MldBEIIm6LkcbUhnvdFu76sLJYvBlZqyhjcuiRM5OdokOykyfC vaxxLKnVZSvY5E3WfFOlco3wxXSGHSQslGrcjGo/y/Pe8dXsbYfEBUqt8EjywC5pU812JJLVqFH bC4Fjsl1X5ol7+D36sPSnQ0tu0MOlqtbvWOt X-Received: by 2002:a05:6830:8293:b0:7cf:e4e6:2cb7 with SMTP id 46e09a7af769-7d4c4b646dcmr8929110a34.34.1771311595053; Mon, 16 Feb 2026 22:59:55 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <1f25d77e-224b-40d6-bf19-18dfdfc9de54@rwec.co.uk> In-Reply-To: <1f25d77e-224b-40d6-bf19-18dfdfc9de54@rwec.co.uk> Date: Tue, 17 Feb 2026 07:59:43 +0100 X-Gm-Features: AaiRm53PtvZAw7AZ2g6UaW0Jw4kramvUJu2FcZNZAUr5d9hDozC5-_MWmxCHYVQ Message-ID: Subject: Re: [PHP-DEV] [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value. To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: mirco.babin@gmail.com (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. > >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=C3=BCsterhus: I have prepared a RFC at https://gist.github.com/MircoBabin/aaa574297c8d1baa879f19c99ce28e93 Kind regards, Mirco Babin