Currently, I believe phpunit assertions work for helping determine types, e.g.:
private function x(\stdClass $b)
{
}
/**
* @return \stdClass|null
*/
private function g()
{
}
private function y()
{
$g = $this->g();
// \PHPUnit\Framework\Assert::assertNotNull($g);
// \Assert\Assert::that($g)->notNull();
$this->x($g);
}
If the PHPUnit assertion assertNotNull($g) is uncommented, the Null pointer exception goes away (awesome!)
However, the beberlei/assert assertion is not recognised... uncomment \Assert\Assert::that($g)->notNull(), but the null pointer exception remains (boo! hiss!)
Wonder if support for this great assertion library (to be clear: beberlei/assert) could be added at all?
Example use case: I often use beberlei/assert in production, but phpunit assertions only in a require-dev dependency, so may not exist.
Will do.
For myself: + Assertion::notNull
Done
wow, that was quick, thanks @kalessil :+1:
You are welcome James =)
Most helpful comment
Will do.
For myself: +
Assertion::notNull