Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100030 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26757 invoked from network); 24 Jul 2017 09:54:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2017 09:54:09 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.216 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.216 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.216] ([81.169.146.216:17525] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/2C-18680-1C3C5795 for ; Mon, 24 Jul 2017 05:54:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1500890046; l=1529; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=m57LfyRX4LZQhNVuinE4Su+s/E1TPYZAHOAQXzRuwl8=; b=e2eIJclrnZW5mgWi/dODgyO00pwuFcHeB93uxmYugO1i4/oT3ZOwlPcB1GXi6cbBmC hUv3+FMcqbqXxGI4qSU/eutklB7zXn0WK5Hb5+rtOjB+jwiXAwwq7/sbXaZDed9dH6YR WpRWomlmgpSXiJ7Pe101hw7O5hc6t70W8w+Lk= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqX/3Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f47.google.com with SMTP id a9so19796716oih.0 for ; Mon, 24 Jul 2017 02:54:06 -0700 (PDT) X-Gm-Message-State: AIVw110ef8IefsyodO7MefteMNsMAk7vFD4tqFsNkhSOHvNvGeLF57as yFxcnjMY/L9QtWoDF9N4S1umvytzTQ== X-Received: by 10.202.205.209 with SMTP id d200mr7514416oig.304.1500890046152; Mon, 24 Jul 2017 02:54:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.154.167 with HTTP; Mon, 24 Jul 2017 02:54:05 -0700 (PDT) In-Reply-To: <20650CE0-9380-4DC0-BE3F-68E8D18E014D@gmail.com> References: <20650CE0-9380-4DC0-BE3F-68E8D18E014D@gmail.com> Date: Mon, 24 Jul 2017 11:54:05 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Tim Bezhashvyly Cc: PHP Internals Content-Type: multipart/alternative; boundary="001a1134e2180c4ae705550d3230" Subject: Re: [PHP-DEV] RFC: Allow throwing an exception as right part of null coalescing operator From: me@kelunik.com (Niklas Keller) --001a1134e2180c4ae705550d3230 Content-Type: text/plain; charset="UTF-8" > > Dear internals, > > Don't you think allowing to throw an exception as the right side of null > coalescing operator would be a good idea? > > Something like: > > echo $a ?? throw new \RuntimeException('foo'); > > Regards, > Tim > Sometimes that would be really helpful. What you can do is something like that: function raise(Throwable $t) { throw $t; } $a = $a ?? raise(new \RuntimeException("foo")); Regards, Niklas --001a1134e2180c4ae705550d3230--