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
Do not re-wrap NeverType as TemplateMixedType in TemplateUnionType::filterTypes()
- When TemplateUnionType::filterTypes() filters out all inner types, the parent
returns NeverType. The override was re-wrapping it via TemplateTypeFactory::create(),
which has no NeverType branch and falls through to TemplateMixedType.
- This caused MixedType::hasMethod() to return Yes for __toString, leading to a
false "Possibly impure call to method stdClass::__toString()" on pure functions
casting template types like T of int|string to string.
- Applied the same fix to TemplateBenevolentUnionType::filterTypes().
- The fix covers all callers of filterTypes: filterTypeWithMethod (string cast,
concatenation, interpolation, echo, print), filterTypeWithProperty,
filterTypeWithConstant, and filterTypeWhenIterable.
0 commit comments