Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88796 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39484 invoked from network); 14 Oct 2015 22:46:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2015 22:46:20 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.45 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.213.45 mail-vk0-f45.google.com Received: from [209.85.213.45] ([209.85.213.45:34189] helo=mail-vk0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/65-33697-C3BDE165 for ; Wed, 14 Oct 2015 18:46:20 -0400 Received: by vkat63 with SMTP id t63so39164567vka.1 for ; Wed, 14 Oct 2015 15:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=cmbHsgitC7/tK6d+IuwsDZFZub08fAPg39FCMdzDOJo=; b=FJjyCl6qsyj6emnCza6rZeJCOkisEFfM/+CngYZphIMRHsgjCZlfGfzrGyaCIkyl5p c1Ro+yrJzHuGv/HGeu9bFa0IrdFN/FLkrkDIjcJSnRkTBxXRR6BQ6UUNksswmlpr+R8F qhSBoAHk5fdpaoxD4vptaANesxZ9X8QIKXbtpuKf15MMY63UNezrg0XDEJDCkXU9gtXw aJKFEvLomvob1SCigcLyBN0/IXYa2d7ors362yrsjl6SjNairTe0spk4T3oxrsILtjWC IaYq6+VZct3Gc1sceUZG7v5XWQsSZginK8TVCIC7BpImazkz8YjYNJe4uzZjthilDCUp GpoA== MIME-Version: 1.0 X-Received: by 10.31.108.135 with SMTP id j7mr3291984vki.81.1444862777716; Wed, 14 Oct 2015 15:46:17 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.31.191.208 with HTTP; Wed, 14 Oct 2015 15:46:17 -0700 (PDT) In-Reply-To: <561ED07E.4060809@gmail.com> References: <0A.C2.33697.6AECE165@pb1.pair.com> <561ED07E.4060809@gmail.com> Date: Wed, 14 Oct 2015 16:46:17 -0600 X-Google-Sender-Auth: 8aYyzlSKdP9oBVmhJG8uTw_RY0w Message-ID: To: Stanislav Malyshev Cc: Andrea Faulds , internals Content-Type: text/plain; charset=UTF-8 Subject: =?UTF-8?B?UmU6IFtQSFAtREVWXSBbUkZDXSBWb2lkIFJldHVybiBUeXBlICh2MC4yLCByZcO2cGVuaQ==?= =?UTF-8?B?bmcp?= From: levim@php.net (Levi Morrison) On Wed, Oct 14, 2015 at 4:00 PM, Stanislav Malyshev wrote: > Hi! > >> I'm reviving my Void Return Type RFC, this time for PHP 7.1: >> >> https://wiki.php.net/rfc/void_return_type >> >> Please read it and tell me your thoughts! > > I still see no point in this, as every PHP function actually returns > something (at least null). So this type would not actually be right and > would not reflect what actually is happening. I agree that `void` doesn't make sense given that we document that `return;` will return null[1]. If the union types RFC[2] passes it makes sense to allow `Foo | null` which allows something of type `Foo` or `null`. To me it makes sense that if you then remove `Foo` you are left with `null`, not `void`. My personal recommendation because of this would be to use `null` for the return type and instead of `void`. Also, I do not think this feature is pointless. For instance, it has value in interfaces. Declaring that a method does not return a value means implementors cannot accidentally return something. This is better than just documenting that it should not be done. [1]: http://php.net/manual/en/function.return.php [2]: https://wiki.php.net/rfc/union_types