Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130062 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 17E5E1A00BC for ; Mon, 9 Feb 2026 09:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1770629413; bh=OQl+YwJWpjpmQ+SmYwMg/g53EfgHmHfYv6bLZPK5UgY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=biglM2pHh7+V6Ufxzlal67dBhHOKv1jrVHddVgBernKTETJ2XwvA3aay9vOfRCf+7 1fvdpbhUg+gZQ7frtbS3Ue/9JhsdhyTdJLcAtfg3CBDKuEFXd2AiEbTQ1DgIb14Pcr MY6b0ePop/A1FbcrQQEjXnN7io2fYasLBxVrGwY2ZnWY8ZNz9WscF6Tsu9yL6mwsGg zNlbYYnfGrjLi55n/mJSulhB9lyGsqITLB2sG+Url2zsyLYKI2ymUStS0hABEmqRRi FfekUd2U7qE/rNGa+OXpmyL0gCDb7f4oq7Dc/Yt8IBLajse0N+TPBWc9BgeupyZJQ5 6Y9kJMPGUSEGg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F00A8180088 for ; Mon, 9 Feb 2026 09:30:12 +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.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_20, 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-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 ; Mon, 9 Feb 2026 09:30:12 +0000 (UTC) Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-7d44b2df00aso1376615a34.3 for ; Mon, 09 Feb 2026 01:30:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770629407; cv=none; d=google.com; s=arc-20240605; b=CEk1fChs5tKm+WIhhaCyB/S6UmTp65Eg/hLCrMQ9L8FLoy+TIMN2I89K2NcKkgiuBG kfCxno+3yiJkWaAIpekVH405VshFwwgC+SD78shS8DJMfpddNRpc3/7iv2y4me3/K2GG 38JqwxUTj450s0dyx+ePMsHN0oJ/7pVVkb0bMZmLOOUBUC9MFMNtx+Z53WQ4yudDWR3b Ljq/wnXLBWYgkZ/OrwWsgpxVDqVPkej68pIQmzOl6SpBT3rJpAoycwFs8MMc6FQAnYFb C+4woCvcJ2EQ4Xi65SRcb3kyP2lDh4u5L+k4XdyzbV4zgBA8pVH38y9J0vfpAQnrI9mX uUTg== 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=OQl+YwJWpjpmQ+SmYwMg/g53EfgHmHfYv6bLZPK5UgY=; fh=EziAb43BiVuTS60vb285ooUlWjkJxGaOF3C5VJfUNQE=; b=dHSaDgMMrbGVdTzK7Ju40Z1y1s/vyQxYhRC0CuUFck3EnozqlqC7QXrDjU3USuO79l lN9v+XZG6o+SyNoTWyHgRMUcQCYln3Gr6z9saJvxds0lMrydwce5wDsEZDI5OPDpxaNp H6XbKuL0g8iqmwyNKJpTrtsekazFd9WONPp5Oce80UY/3M2qMCPdoDqJxIc/y+BPtvLk Exa4mC3PrRfO0hqS/czV5POC1WEeriUQ16loDU9BAYf0WYIQ0SktlRf2GUv7Z3OyqVI8 UX55MhQtn+Eiu5meNs014ObwTUKavcrqXwF9voGkBvrBidmYDc4n4yG+jDAW9nYdhDxz AuTg==; 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=1770629407; x=1771234207; 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=OQl+YwJWpjpmQ+SmYwMg/g53EfgHmHfYv6bLZPK5UgY=; b=RC+x9SaeclbfCaRT8loILeUIsdQ4DmfzllSpSEKzaNNClxAp4V6rXIDThnXZ1kKpSF J31Za6VqEvfyC8r3UvWQ42Nu4O7ixXuGsosBKT2YZMnuGQ6l9rLvDrrDKdBKV4Ihy5ZP SFLV68nQ2KBXhcXo21TsQn2iDitpzvurlWgNnRcSXo9Pho0YJrrVMPbo9Ps4LyWzJJ5T 357sL0gFjpAgHHdtpE5/2DMCZrOQjcLE2v0ri9f3F1hoqbkWGs/vAxB9P4CtUxoegTJi PFuZwK7wbkdBh9oAJvyZPI6+dIYyoWBNy0KFc7hYZHadOiGJsBcCM0KHTPVTvXHXpn/k Dd5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770629407; x=1771234207; 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=OQl+YwJWpjpmQ+SmYwMg/g53EfgHmHfYv6bLZPK5UgY=; b=VJiDHxc4Jk08lqeclzIFY3lB22yhuhXx8L5TC2E/kJKQXUd0WHZmZivIAg1Eu68QtD BHOoPYu7MppFRgZxuBNq+vRp3TgI0A3iQJpINy+dIcPCGW21JA/2vuhqjpPJKR5lDUaB g+tNAYLYcR7FkdsE1MY7FI4VYC2ZMsQ3sJklU1gpK5/lmrCNP7eXBphsC8xY27SjC1YD wwda5+/ViuMB52VqxVDADHPM74ejjGn/f2IC7y57YfC9gWyLr65G7e2klWkFw7+PWCdN 9Fq5GsEWPUGqXqAOriiNxSZ+/N5S5/EdhEjurCueV4Tkciir0DTjRda+0KvC9+OP16+4 2FyQ== X-Gm-Message-State: AOJu0Yz84i2RB/jt9vdL/vweVQw+2HoNCjH7ttUuSZGHgrJGUJv/KaCl 7labNAOML/+0a6At7tm+OA7/BxKFtKbdQdprR/Wsrwp4P89z7bl3/muDr+1Fxthpmf+q1GVfHBp Gm5AOUoaOUWO16AcL/XJhzWTRhTV+LSUiLlyjf9M= X-Gm-Gg: AZuq6aIbh0roNiOPcveAG5YiPfcO5jrMV6LF4/toAX3/k2r6rqg3UQm18DRUWOt9rIo bJSGbDupP7R5k3+t9k07rPkDwodn0YAzHpV6alIc5hRVfdYfO02VbJ34YLzyW0FafeGuukz6xER 5H0shWvo33aHckD5MedbDpOOOrYbVt1arDIAnCR69wtuwlKv+yEAgw8Zs9ZANpbQ70B94qj4gOL mo1EzGep4jXOCRXKlktzQbXUCWfNeHB1maPSqVP4WWV370ukTV24zwrDgamR4fxg/rtcVmrSZ9i F+k66hcSyJxrMY3uGtbHmnqZ X-Received: by 2002:a05:6830:6adb:b0:7cf:e57f:df1b with SMTP id 46e09a7af769-7d464682e10mr5947615a34.26.1770629407056; Mon, 09 Feb 2026 01:30:07 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <0ece40da-762a-4190-9cc8-23ff432fd441@bastelstu.be> <69867F01.2070107@adviesenzo.nl> In-Reply-To: <69867F01.2070107@adviesenzo.nl> Date: Mon, 9 Feb 2026 10:29:55 +0100 X-Gm-Features: AZwV_Qhg1hVZCltCURv-8rOzMbcM2Uch_nbAKY5w1Xjt7BAs-VsRki0loH3ebqs Message-ID: Subject: Re: [PHP-DEV] [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value. To: Juliette Reinders Folmer Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: mirco.babin@gmail.com (Mirco Babin) > FYI/Just in case anyone already wants to forbid this - there is a sniff > available which will flag both constructors as well as destructors with > a return type and/or when the function returns something: > Universal.CodeAnalysis.ConstructorDestructorReturn > > Ref: https://github.com/PHPCSStandards/PHPCSExtra#universalcodeanalysisco= nstructordestructorreturn-wrench-books Thank you very much for this information. Using PHP Code Sniffer, we identified two more return values from the __construct() functions. Installing PHP Code Sniffer on Windows without using Composer is cumbersome. For those who want to use the PHP Code Sniffer tool, I've included installation instructions in the original issue, see: https://github.com/php/php-src/issues/21090#issuecomment-3870404274 Kind regards, Mirco Babin Op za 7 feb 2026 om 00:56 schreef Juliette Reinders Folmer : > > On 6-2-2026 20:59, Tim D=C3=BCsterhus wrote: > > On 2/2/26 19:00, Mirco Babin wrote: > > # RFC > > I've been asked to follow the RFC process. And I've been told that the > rejected PHP RFC Make constructors and destructors return void > ( https://wiki.php.net/rfc/make_ctor_ret_void ) rejects my proposal. > However, my proposal is explicitly about the "new" operator and not > about return types. It does, however, concern return values. > > > Personally I find the fact that it's illegal to define a return type on `= __construct()` to be a pretty good indication that the constructor is not m= eant to be able to return anything. As such I'm a little surprised by the d= isagreement in that RFC, though it should be noted that a majority was in f= avor (just not a 2/3's majority). > > > FYI/Just in case anyone already wants to forbid this - there is a sniff a= vailable which will flag both constructors as well as destructors with a re= turn type and/or when the function returns something: Universal.CodeAnalysi= s.ConstructorDestructorReturn > > Ref: https://github.com/PHPCSStandards/PHPCSExtra#universalcodeanalysisco= nstructordestructorreturn-wrench-books