Skip to content

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