CakePHP, PHPStan and endless type checks

How is PHPUnit involved? It’s PHPUnit that refuses to allow code without these checks because it “Cannot access property $id on Authentication\IdentityInterface|null”. Basically, PHPUnit does not allow code unless you can be certain that a given object is in fact the correct object. So if you’d like to get your code to validate, you need to wrap every function in these checks.

I’m using the CakePHP cakedc/cakephp-phpstan library which ostensibly is supposed to help with this, but it’s not. Am I really the only person you know using PHPUnit? Or the only one having these issues? Because its rampant?