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
Here we have two types of bounds set: an upper bound (the T inside class-string<T>) and a lower bound (the T inside Closure(T):void).
What we care about is the upper bound – the most specific type we can infer in the call to createProxy, in this case A. It's incorrect to union the lower-bounded type and the upper-bounded type together, as they represent wholly different constraints on the value of T.
Bug report
So, template upper & lower bounds. They're fun.
Here we have two types of bounds set: an upper bound (the
T
insideclass-string<T>
) and a lower bound (theT
insideClosure(T):void
).What we care about is the upper bound – the most specific type we can infer in the call to
createProxy
, in this caseA
. It's incorrect to union the lower-bounded type and the upper-bounded type together, as they represent wholly different constraints on the value ofT
.Code snippet that reproduces the problem
Expected output
No issue
Actual
Call to an undefined method AParent::bar().
https://phpstan.org/r/a0d9b3fd-e762-4022-80b5-51223678a665
The text was updated successfully, but these errors were encountered: