Open carlosas opened 1 year ago
Note: IIRC, Psalm has a prerequisite that the class defining assertions on methods should be immutable (or at least the method itself). PHPStan does not support purity/immutability so this may not be a prerequisite on their part. However, if that's the case, Psalm should not silently fail but raise an error for wrong docblock or something
When using
getClassReflection()
from:https://github.com/phpstan/phpstan-src/blob/1.9.x/src/Reflection/ClassMemberAccessAnswerer.php#L14 and calling a method inside the returned type without checking null first, Psalm throws a
PossiblyNullReference
error because it doesn't take into account the@phpstan-assert-if-true
annotation.Tested with: