Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110628 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25495 invoked from network); 17 Jun 2020 13:13:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2020 13:13:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BC6101804C8 for ; Wed, 17 Jun 2020 04:59:29 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 17 Jun 2020 04:59:29 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id q19so2531160lji.2 for ; Wed, 17 Jun 2020 04:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7s1g+TDl+yj0QA9c9wvSdzUEoPEsJ5tQN0agi9/15bo=; b=eYJzIQIyB/lKkT55tqjxvUxrdDvdp7TsqeJtKP9iY0noPa9AYdDX4FUzZ+//frBz4P VGCVHLod3ImeQhKu18UOXyq7UQU8bwTUqnPIPt7y5N87mca1B/kgYZ0qOghEt5cqQ+7J Xa9fLHC3WsbHLrfGMzufulS5HwBaN/eF97A8btgh1mOcm/9F/d/CtAwb/LpkpWpVoM/P Vg9+rIxaU9/XZoC1DHc12pd1s/wpOrL4gEpeSDe1P8e6k3uQ/PwhMvl3cU27/p1yYebr uIuEEUcdnwzZ5b+5CMklr8ajSoececx4P2I2d1Kq/HJv5akqAp4+2AQFGsTZRWHwPc9l kgCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7s1g+TDl+yj0QA9c9wvSdzUEoPEsJ5tQN0agi9/15bo=; b=TX1YnMHXv16W3ICXbZWZJmcsIA+emCDnpqkEOaQ2kbtYeBgqKMn4CIn95dkXONMT5a EnMUo4ogOBcCOigyukJEz8zli0W6T88LlshxKiqosCrCfWg0xhXeqhzEur8MljVmV00f a8jB47ndrDArJP4uXkmlsQVT2KxEaFMAEjL/8SyuuFESUaSTa0bSy3f3Evp3etAPHisk StMIwM9iVy/wXt/sEFFWDxtKIOKDpiZXl4g4hxWymUgfrK7DshNQhUYjHwCcyWM2d0bu OJmPMMwm7Y72np1bruDxBdKMGSpxjStkVv47tyszv59OwPrt5ctKYIsHG5zwgPsChEWU j4FQ== X-Gm-Message-State: AOAM5321eHvZzyzDQeFl1QLGUJj6458XckCmDUr5XkjB8EZaeo7Ky21e t5dmAFgKPlea26PjNZrN1O4fJWZGy8OJvzqptWA= X-Google-Smtp-Source: ABdhPJxVy1TxOxo8i1m5zouX8sGagYlWZnJw6cPQ/dEI0BExthw2n2AOGGveiSlbJjZc7e+b+r9JPVbfI4LOyFNyB2U= X-Received: by 2002:a2e:9e87:: with SMTP id f7mr4112701ljk.44.1592395166915; Wed, 17 Jun 2020 04:59:26 -0700 (PDT) MIME-Version: 1.0 References: <8ADA2EC7-EE07-4429-8F84-1E5ADC7660E6@cschneid.com> In-Reply-To: Date: Wed, 17 Jun 2020 14:59:15 +0300 Message-ID: To: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= Cc: Nikita Popov , Christian Schneider , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Allow void return type for constructors/destructors From: benas.molis.iml@gmail.com (Benas IML) Thanks everybody for the replies. > However, I am also fine if the void return value is only enforced when th= e void return > type is declared. Additionally, we could emit a deprecation notice/warnin= g when > there is no return type declaration, but a value is returned. I think thi= s would be > a nice way to immediately give people the possibility to disallow a retur= n value, > while being respectful for older code bases. Completely agreed. I'll update the RFC to reflect this as well. We should allow newer codebases to enforce `void` rules on constructors/destructors by allowing to explicitly declare return type as `void`. Meanwhile, we should throw a deprecation warning, if the constructor/destructor is returning a non-void value and doesn't have an explicit `: void` declaration. Then, presumably in PHP 9, in addition to explicit `: void`, also enforce `void` rules implicitly altogether. Best regards, Benas On Wed, 17 Jun 2020 at 11:31, M=C3=A1t=C3=A9 Kocsis wrote: >> >> This PR should also address all of M=C3=A1t=C3=A9's concerns since it ma= kes >> constructors and destructors always return `void` (even when no explicit >> `void` return type is specified). > > > To be clear, my main concern was that declaring a void return type should= n't be > allowed, unless it's actually enforced. Now, it's all fine because you st= ated your > intentions :) > > However, I am also fine if the void return value is only enforced when th= e void return > type is declared. Additionally, we could emit a deprecation notice/warnin= g when > there is no return type declaration, but a value is returned. I think thi= s would be > a nice way to immediately give people the possibility to disallow a retur= n value, > while being respectful for older code bases. > > Regards, > M=C3=A1t=C3=A9 > >