Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113920 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 87423 invoked from network); 1 Apr 2021 17:27:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2021 17:27:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 144E81804E4 for ; Thu, 1 Apr 2021 10:25:05 -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,HTML_MESSAGE, 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-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (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 ; Thu, 1 Apr 2021 10:25:04 -0700 (PDT) Received: by mail-io1-f41.google.com with SMTP id n198so738430iod.0 for ; Thu, 01 Apr 2021 10:25:04 -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; bh=ccunKpDoGw4lqC1iiYiut15/pJYnBRWUe/7cvFX60cA=; b=MPcactS1+gRikbIrN5YN8J50CxBJqVprNj9Lv2t1zggocQqjuf3tKtt34MRCJNrcOx QY9TO69befR0M+rMip0dCM4SGX9WMZOZFUKSRlQMaoR+jpy8kUfd7y89kZp008gNIM// /F4ow7Tr15DiQgtwDfNNNwP/Grbq8+beXN5GKTMCUVfP5wEZOALg8uQid20/NuYnsqQU Bz5hcsJDT29Q/WOV91ciA7IzcaEAQkxx0peVaVrHpCObO0BDAmS36QO7dOMYJjx8bDKv GJgmFqra5gltx1H9Pm5QowTmYsz5IHSCyPSo3ZZCubMO4RKVKfnQxyG2vkmybV+QM3Jh JNGw== 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; bh=ccunKpDoGw4lqC1iiYiut15/pJYnBRWUe/7cvFX60cA=; b=YWQvIJBDvQtg8GDPONAifx2tFsl6R8rEvSuUJ4mbil58QFXTK0znfcd1Xyqmm+mxWu Ys6VGB5JXu6FUqOwaqu7y0TCWqiIKcCkZSHLMYkFiFbcxp2YrotQ7nc925mBLOD+/mFS nhB2yiqJqqzgZcWjaRaoCbiZn9/80CBNbWA+cb8lKgm4tR7/yJDet7qFqB0DfQjOW8eA wsWt1eKRVFcJhit9QN3aIXw3BHcus5y1rCBH8DUGXjw7WAjFNTn7fjdo/6oKsaIwGTZn TcMiQbx4LCUKTND897qmmS7JJGStykmNY3ubDwhQqrKxtVZHnhZpVpvtO5IbknuydpSp YmaA== X-Gm-Message-State: AOAM532NR07X+KbPVUD51nt9ppcSvp5DSVAOAmO2WUFt1ocWEFIZXngV y4I8Z1QPxLc/uUHhVqBydeYQINcbLTgzZsqbXBU= X-Google-Smtp-Source: ABdhPJy0cBYTMi8ln67ABUz7L6HZEZJ3dlgCgDKgmw4DJNfG1f/abZHtzwR96+uXCN4FuZDQdYIhO/JcMiXhN4YQ+s0= X-Received: by 2002:a05:6638:2515:: with SMTP id v21mr8982929jat.110.1617297901581; Thu, 01 Apr 2021 10:25:01 -0700 (PDT) MIME-Version: 1.0 References: <7399011c-a638-5363-5303-c01ac402bb92@gmx.net> In-Reply-To: Date: Thu, 1 Apr 2021 20:24:35 +0300 Message-ID: To: Benjamin Eberlei Cc: Andreas Leathley , PHP Internals Content-Type: multipart/alternative; boundary="000000000000eb79ba05beec8298" Subject: Re: [PHP-DEV] [VOTE] noreturn type From: weirdan@gmail.com (Bruce Weirdan) --000000000000eb79ba05beec8298 Content-Type: text/plain; charset="UTF-8" On Thu, Apr 1, 2021 at 6:07 PM Benjamin Eberlei wrote: > > ```php > if (!isset($user)) { > throw new NotFoundException(); > } > ``` > Since `throw` is an expression (since PHP 8.0, https://wiki.php.net/rfc/throw_expression), it must have a type for its result, as any expression has a type. And it's result is exactly `noreturn` (or `never`, as this option seems to be preferred judging by current vote results), because `throw` never returns. It's quite natural to extend that to function calls that never return as well. And then it makes sense to declare that type as a part of function signature like you can do with other types. -- Best regards, Bruce Weirdan mailto: weirdan@gmail.com --000000000000eb79ba05beec8298--