-
Notifications
You must be signed in to change notification settings - Fork 70
Add head function #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
* @expectedExceptionMessage Argument must be non-empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Argument must be non-empty');
instead?
Also see https://thephp.cc/news/2016/02/questioning-phpunit-best-practices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but it would be inconsistent with the other test cases since they all use annotations. Personally I'd prefer consistency and address this issue separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@nikic any thoughts on adding this function? |
I know this is quite old but the code seems still good. Will it be merged ? Also good idea the head but to match the bash one for example would it be possible to add a number of rows to return ? |
Would be nice to have a function that fetches the head of an iterable and throws an exception if it's non-empty instead of having to call the
current
function on an iterator and checking whether it's not null.