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

Introduce notFalse() #274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Introduce notFalse() #274

wants to merge 2 commits into from

Conversation

simPod
Copy link

@simPod simPod commented Feb 7, 2019

I was rewriting this code

/** @var SplFileInfo $file */
$filename = $file->getRealPath();
assert($filename !== false);

into Assertion and the Assertion::notFalse() method was missing. Using Assertion::true($filename !== false) IMO loses the benefit of using Assertion as nice readable wrappers around simple conditions.

notFalse() is similar to notNull(). Especially some PHP internal functions return type of <result>|bool but actually bool there is false -> <result>|false which stands for failure. This is handy instrument how to handle it.

@stefanfisk
Copy link

I'd very much appreciate this addition! Would it be accepted if I supplied an update to date PR?

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.

2 participants