Skip to content
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

Add head function #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add head function #67

wants to merge 1 commit into from

Conversation

jankramer
Copy link

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.


/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Argument must be non-empty
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jankramer
Copy link
Author

@nikic any thoughts on adding this function?

@Neirda24
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants