You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a piece of code in my tests that roughly looks like this:
self::assertNull($userRepository->findOneBy(['email' => 'foo@example.com']));
// Calls to the class I'm testing that should lead to new database records.$user = $userRepository->findOneBy(['email' => 'foo@example.com']);
self::assertInstanceOf(User::class, $staff2);
PHPStan emits an error:
Call to static method PHPUnit\Framework\Assert::assertInstanceOf() with 'App\Entity\User' and null will always evaluate to false.
If I remove the first assertNull() call, the error is gone. Apparently, PHPStan treats the findOneBy() call as pure which is a mistake from my POV.
The text was updated successfully, but these errors were encountered:
PHPStan 1.10.59, phpstan-doctrine 1.3.62, phpstan-phpunit 1.3.16, bleeding edge + strict rules
I have a piece of code in my tests that roughly looks like this:
PHPStan emits an error:
If I remove the first
assertNull()
call, the error is gone. Apparently, PHPStan treats thefindOneBy()
call as pure which is a mistake from my POV.The text was updated successfully, but these errors were encountered: