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
/** @psalm-trace $obj */$obj = (object)['hasFoo' => true]; // Correctly traced as an object/** @param object{hasFoo: bool} $obj @psalm-assert-if-true true $obj->hasFoo @return bool */functionvalidateFoo(object$obj): bool {
return$obj->hasFoo;
}
validateFoo($obj); // "Variable obj is not an object so the assertion cannot be applied"
My actual use case is to array_filter() an array of objects, returning the objects with two specific fields set, but I was able to reduce the Psalm problem down to the above. (The actual PHP runs as expected.)