Re: Change to Too Few Args Exception RFC
| From: | Dmitry Stogov | Date: | Sat, 06 Aug 2016 07:18:22 +0000 |
| Subject: | Re: Change to Too Few Args Exception RFC | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-94874@lists.php.net to get a copy of this message | ||
I don't see a big problem accepting this. The change is really minor, and makes sense.
Dmitry.
On Aug 6, 2016 5:26 AM, Davey Shafik <davey@php.net> 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(… $args);
} catch (\Error $e) { }
compared:
try {
foo(… $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