Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89911 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98269 invoked from network); 28 Dec 2015 18:47:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Dec 2015 18:47:28 -0000 Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.160.177 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.160.177 mail-yk0-f177.google.com Received: from [209.85.160.177] ([209.85.160.177:35928] helo=mail-yk0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/E4-51216-EB381865 for ; Mon, 28 Dec 2015 13:47:27 -0500 Received: by mail-yk0-f177.google.com with SMTP id v14so17677351ykd.3 for ; Mon, 28 Dec 2015 10:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=I3ryBSMaBFkWMbAGJZyE8J8gJqk2XTXXZkfTjeFJap0=; b=gWmwlLcgSFCB3LQbml4fI18MCkraVQvyCkVxBkMoNPF1J73QjHahB494AYa28pasp1 JikotvdjHwaBrOAnkevvov5yJpXxajiMCW3mVbYAyowSKBMCGlvu8j63u8wcq4/Wc6CU 8SiHn72ebJDIhxRc8SEKp5hVLXgZ9zkWRH+MmOrI3hldJBQ8NIKUe4UWmsNUT7fisnY7 59KVvvOVlmV0oKQ579VsIRSm41VKLpbUm4NZ6mfuoyg3f00zmbOpHYnmQV/yTRNpuV48 gipfZwcKHk6i7sVx/iJ6vz8YkobB+GNMWwl8mdxF38rorKyCK8vFFFhy4Hg6C6F4+t4U D2Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=I3ryBSMaBFkWMbAGJZyE8J8gJqk2XTXXZkfTjeFJap0=; b=Jl25bCLBO+hVbE5T2VJXFlRL5hCX0n10HM195BlBApsiUZ1TXdxmiy8DX6PybIiGND lQO6O3S3GoTB5iFHpcFIWtvhRsw7LVgqpLqxIl5ZNgQbOwxPCDTs0z7SCkmerkcspUnq bDszmOhUim+6yKHSFvSL8qiq4H/3BylmDIVvD9CAMjywI3pBFXPwV/S9DfqDnoYUqQA2 TfKGN5dk50ZJg1ol2YLq+CCy0JYUEiJMTLYI7MOXTWDfH2g+g4Ry53ss/+sxPv594v+D UnuIcVQejTtXCRQXBcbI/uIjyugju/Ig+TB5WSLniKwFViEiplf/huv54B943Lj7p9d6 5a2A== X-Gm-Message-State: ALoCoQlCCIoagOQ84JMgiD6zJ3aob6V8X1U4TYMLAPfbOdE4umTCfubXmaPKfwVeWEnKjUtZmpw7iBExANULoigcLEoNMJ31uw== MIME-Version: 1.0 X-Received: by 10.13.210.66 with SMTP id u63mr42181515ywd.206.1451328442686; Mon, 28 Dec 2015 10:47:22 -0800 (PST) Received: by 10.37.79.213 with HTTP; Mon, 28 Dec 2015 10:47:22 -0800 (PST) X-Originating-IP: [78.147.5.253] In-Reply-To: References: Date: Mon, 28 Dec 2015 18:47:22 +0000 Message-ID: To: =?UTF-8?B?QnJvbmlzxYJhdyBCaWHFgmVr?= Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Multicatch RFC proposal From: danack@basereality.com (Dan Ackroyd) On 24 December 2015 at 22:40, Bronis=C5=82aw Bia=C5=82ek wrote: > Hello everyone! > > I've just created an RFC draft for catching multiple exception types > in one catch statement: > https://github.com/bronek89/php-multicatch-rfc > > I wrote RFC on github to check if there is any positive response from com= munity. > > Basically it introduces possibility to write code such as: > > try { > // ... > } catch (DbException | ResourceNotFoundException $e) { > throw new HttpException("not found", 404, $e); > } catch (\Throwable $e) { > throw new HttpException("fail", 500, $e); > } > > Provided patch is my first experience with PHP source code, so it > could be not perfectly written (or simply poor ;-) ) . > > What do you think about introducing that kind of feature into PHP? > Yes, please. The alternative work-arounds are not as good. Though I also am concerned about it getting in the way of other proposals, I don't think it would be an issue. The meaning of the syntax in your example is pretty obvious. So the only way it could be a problem is if another RFC proposed a different and 'not as obvious' meaning. cheers Dan