Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113853 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13869 invoked from network); 29 Mar 2021 17:28:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Mar 2021 17:28:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0397B1804E2 for ; Mon, 29 Mar 2021 10:25:31 -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=-0.2 required=5.0 tests=BAYES_20,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-Virus: No X-Envelope-From: Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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 ; Mon, 29 Mar 2021 10:25:30 -0700 (PDT) Received: by mail-yb1-f180.google.com with SMTP id g38so14501734ybi.12 for ; Mon, 29 Mar 2021 10:25:30 -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 :content-transfer-encoding; bh=TMAkhISWImuruwZKdlNtAAuL1EGAgO+0qLEcVbcTJkg=; b=IdGKjM//xGgFPIeumfdazZoK2LAXT+VlluXX9LUVb5pO/Q7sjLSbRgEJgIrMxa2kWl Rys3/i7pidFt7VcH7YhKLBFvo+JCoCaKMQYsXLSAGOxoTONS8/XpOTPgielunZx9fVXi x4FEsDomwKua4npHsQudmH51Ddg9V5WTpf+/RzNNyARKzcuKiUX7BkqDbXBzgnh93aTv kTa8jT2S0RjItF+J2+es/bvXSSs4G0YdONCZ7bNhFysdayiVkDGMvf6V9zsrmUroxsuH U5rbfNFewOSi/Qm7yHaOEBRq2Zfd8g711pwFc/58Tx5MUSRo/SVQ10sh4ebHMnCg4N7s KsTA== 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:content-transfer-encoding; bh=TMAkhISWImuruwZKdlNtAAuL1EGAgO+0qLEcVbcTJkg=; b=AS3tx1SAbClYGFgU0agKzZi+NOCAVAgni4JzmWRCoWLZ2QUzcUKlYBaFNuYf/iIhYa Am2/jWI/xRGC1AGrzron/Lyg3YzYGmfB2Dk/B99lbldbJb3QPga5umI/SW2sajMPk3EO QW6SnOsYHNfB2nq12q2aln2eL+1V/UJ8ROJj8w1VBLBoBXwxbUujfMfpLdvNP4U9bGnc tqC5eGOQgwDNbImsm4rsd5QdyjxFckMgLIWmq+6TBcXBcmRNSqrWuTiPelPupNapibX6 IeQ5TyR35qrm57PoI6zou5CEZgilOU9bu9hT0q+IfHTEVKgH1iMo0fSef9mj6U7N3foC JyYg== X-Gm-Message-State: AOAM533S01SBXEWs50Ur0rG0Kth+fE5N03S/sNXwyqqG9Swb4N1lHwq1 7dZWGl96msQgqRj0TbxUFG5UzqW96tXDZn6kiC4sVWFsXmsFgQ== X-Google-Smtp-Source: ABdhPJzKqTE/ak4uDwWQKqrDS3svybO7gzfevi9bDw7dyHVYSCiouX44UirPJuIMmj7CXeDyg5N9s30HYqMNppazKRk= X-Received: by 2002:a25:556:: with SMTP id 83mr9186741ybf.411.1617038727034; Mon, 29 Mar 2021 10:25:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 29 Mar 2021 19:25:15 +0200 Message-ID: To: Internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] noreturn type From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Matthew > Ond=C5=99ej Mirtes and I present an RFC for the noreturn type: > https://wiki.php.net/rfc/noreturn_type > > The feature already exists in Hack (the primary inspiration) and is > currently supported by our static analysis tools inside docblocks, and we > feel there's a good argument for it to be supported by PHP itself. Thanks for the RFC! I'm very much in support of it. Two small things: 1. Some magic methods like __toString currently require a specific return type (like string in that case). Since noreturn is a bottom type technically it should be possible to type hint those magic methods with noreturn. It's not a big issue if that's not possible, but it should be mentioned in the RFC. 2. noreturn is one of the few return types that would technically make sense for __construct (other than void). class Foo { public function __construct(): noreturn { throw new Exception(); } } new Foo(); bar(); // < Dead code Not sure this is worth supporting but I just wanted to mention it. Ilija