Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110676 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16563 invoked from network); 18 Jun 2020 22:31:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jun 2020 22:31:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E373E18054D for ; Thu, 18 Jun 2020 14:17:03 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 18 Jun 2020 14:17:03 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id B903D5C0117 for ; Thu, 18 Jun 2020 17:17:02 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Thu, 18 Jun 2020 17:17:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=zHvzRs Idbm1EEBD0D1zP4q2TEIUzOorxrkTlP3a7w80=; b=tu1f0v0XpLwjqCwkkD5slQ hsVde49SyTtaLbRfJyzkhZ6DNDxN6OwaQ7cWKI9ztyMSMv+gQTI+59t2EFFfE1Ob o4dpMdofz2gshvsCmJlhCn/OA/kCjGhzVC8M9kXnjiG4lrttNthMAVNgrMTKxIih c5f6tC4w0Ra9m5japR8H4Zv5GObT6ddnzsmw2l9GMdj8bccW6/VT09n8wDE84Rqp PC1bQd/JHHqrQbwzX62mdUCd6ztGgjb61RY5UW0tCpwgV9WAKz9tgW6n55EMTk83 PIsGKRgJUOEzgd3io+ZkLKH/v+x/+jGA3GhmTZQNs/RyKwbJfwQBNj/XNZmu0fSQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejgedgudeiudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnheplefhjeduueegudeghfehudfgvdeflefffeeuteev uedtjeffkeetkeeiveejkefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 070DD14200A2; Thu, 18 Jun 2020 17:17:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-536-ga595028-fm-20200618.001-ga5950281 Mime-Version: 1.0 Message-ID: <877ade00-2d68-4a3e-b847-808e06dee226@www.fastmail.com> In-Reply-To: References: Date: Thu, 18 Jun 2020 16:16:40 -0500 To: "php internals" Content-Type: text/plain Subject: =?UTF-8?Q?Re:_[PHP-DEV]_[RFC]_[DISCUSSION]_Make_constructors_and_destruc?= =?UTF-8?Q?tors_return_void?= From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jun 18, 2020, at 3:49 PM, Andreas Hennings wrote: > On the other hand, for a constructor the ": void" is just stating the > obvious. > Even if you see a constructor without ": void", you still know that this is > not meant to return anything. > Either because it is generally agreed to be bad (PHP7) or because it is > deprecated (PHP8) or because it is illegal (PHP9) I see this in the same category as __toString(). Adding `: string` to that method provides exactly zero additional information. You know it's going to return a string. That's it's whole purpose. On the off chance someone is returning a non-string right now, they're very clearly Doing It Wrong(tm). However, the stringable RFC added the ability to put `: string` on the method in order to be clearer, more explicit, and to not annoy type fans who are like "Ah, I've typed every one of my methods... except this one, because I can't, raaaah!" I see this as the same for constructors. Any constructor returning non-void right now is Doing It Wrong(tm), and you know that going in. But being able to make the obvious explicit still has its advantages, both for documentation and for consistency. I am in favor of this RFC for that reason. --Larry Garfield