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
<?phpinterface a {}
class b {
publicfunctioncustom(): int {
return0;
}
}
class c extends b implements a {}
/** * @template T as (a&b) */class d {
/** * @param T $param */publicfunctiontest(b$param): void {
echo$param->custom();
}
}
/** @extends d<c> */class e extends d {
}
Psalm output (using commit 9168cef):
ERROR: PossiblyUndefinedMethod - 20:22 - Method a::custom does not exist
INFO: MixedArgument - 20:14 - Argument 1 of echo cannot be mixed, expecting string
Specifically, only the first type of an intersection is considered, with the rest being discarded. So in this case, if we write @template T as (b&a), there would be no issues, but then a's methods would be unresolved.
https://psalm.dev/r/542b1e4b94
The text was updated successfully, but these errors were encountered: