Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94877 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88129 invoked from network); 6 Aug 2016 09:34:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2016 09:34:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.213.175 mail-yb0-f175.google.com Received: from [209.85.213.175] ([209.85.213.175:33349] helo=mail-yb0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/86-33134-A0FA5A75 for ; Sat, 06 Aug 2016 05:34:03 -0400 Received: by mail-yb0-f175.google.com with SMTP id e125so22023713ybc.0 for ; Sat, 06 Aug 2016 02:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hoIm6whj+5yIDPOjuRo630MY32Um7yDsVPAfFL/Fbg0=; b=UddSq2Jp2Bwh4su1sxWUzFpz7L6cUn+yXlvU7Ye/BKzuIqah9UoPJ2BqEaCgQrZtZb 0cCaq+0wmBOC6/heCtf9GTTVC3xFW84wysWsRAxOIu6DTnV5MOmxh7wUkQn3ogclIi0D k9f+A7fs/GF1l/OPtRcLCSDZet7pZEoRW/4Zrc+xGDKutZlOz+3l10bJ+mcp7K+3xS7w oB6L0HQK9RjZBfcSkx/us+5K6TLrROSjFDQCJqFlTKba13QX+Cr5PYK84kWWtRz7oqyL B8MLDjCr2j4WkYQMrPmbt5AM7ry3aTj461uum5e6SvXDputJqDFcwNRbPqk4rs+mop2P i6AA== 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:from:date :message-id:subject:to:cc; bh=hoIm6whj+5yIDPOjuRo630MY32Um7yDsVPAfFL/Fbg0=; b=kjDZDYK7Dmu+w4Kd3CBCWA8FzxnyEYcaTQheZu1ZJXwRCW4pV1xLZqJyAA3FGaEU3w 5IN4DL2YuBUK8Q1MrI1m1yIU81J82VkOlutdFznsCI16TIzWDxPTFE3h6YEfsIBDqGg9 6eyyZkWTyTy2QqWtBnALWbsMKD2JDfRhhCIh4e2erlFtMUQFlhF9UyniIaEfhebRmTnK PoRpVvcBU5jhd5EndNmrDUgawjOiVhIcGe++HLE06nK3DpY4/ZAF24g+q8fQAqMOxv8x YyFd1ZJlOiEaFGbcxteckO6sYBhifpqGm6sg7JGcF4MsJqbtZal2ac9gX121M0AVTkgB XVvA== X-Gm-Message-State: AEkooutAnPG0n2pFzYCMjarecPNNFTwo1WQpW0m/FqCMyC622Wy3wxkbqt/vwl/Z0WWU0bNyCRZ5qeDJkemD+Q== X-Received: by 10.37.75.129 with SMTP id y123mr11865473yba.61.1470476040428; Sat, 06 Aug 2016 02:34:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.131.129 with HTTP; Sat, 6 Aug 2016 02:34:00 -0700 (PDT) In-Reply-To: References: Date: Sat, 6 Aug 2016 11:34:00 +0200 Message-ID: To: Davey Shafik Cc: "internals@lists.php.net" , Dmitry Stogov Content-Type: multipart/alternative; boundary=94eb2c0957740a60a6053963e229 Subject: Re: [PHP-DEV] Change to Too Few Args Exception RFC From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c0957740a60a6053963e229 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Aug 6, 2016 at 4:26 AM, Davey Shafik wrote: > Hey all, > > I know this is a little late in the process, but it's something I've > noticed while prepping some content around 7.1. > > This RFC: https://wiki.php.net/rfc/too_few_args > > Passed, and has been implemented, but I feel that throwing an `\Error` > exception is a mistake. I think we should another more concrete exception > class for this error: > > `\TooFewArgumentsError extends \Error` > > A use case where this may trivially occur is where you are using argument > unpacking and the unpacked array is too small. Writing this, just looks > bad: > > try { > foo(=E2=80=A6 $args); > } catch (\Error $e) { } > > compared: > > try { > foo(=E2=80=A6 $args); > } catch (\TooFewArgumentsError $e) { } > > Thoughts? Dmitry? > > Given the tiny change this is, and that is backwards compatible with the > original RFC, I would like to add this to 7.1 for beta3. > > I think I can make this change myself. > > - Davey > Problem: We already use TypeError for this for internal functions. If we want to introduce an extra exception for this, lets use it for internal functions as well. In that case we should probably go with something that applies not just to too few arguments, but also to too many. Nikita --94eb2c0957740a60a6053963e229--