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
fix(diagnostics): narrow literal types through compound expressions
The literal narrowing pass in the diagnostic path only handled direct
Expression::Literal nodes, so compound expressions like ternaries
($flag ? 'asc' : 'desc'), null-coalesce, match, and parenthesized
wrappers resolved to the widened base type (e.g. string) instead of
the precise literal union ('asc'|'desc').
Extract the inline narrowing logic into a recursive
narrow_literal_type() helper that walks the complete set of PHP
expression forms whose result is one of N sub-expression values:
ternary, null-coalesce, match, and parenthesized wrappers. This is
a closed set — no other PHP expressions select among sub-values.
When any leaf is a variable or non-literal expression, the function
returns None and the caller keeps the widened type from the general
resolver, preserving the existing conservative behaviour.
Closes#180
0 commit comments