Commit b2a3bb0
Generalize cast type narrowing for (int) in addition to (string)
Refactor the cast narrowing logic in TypeSpecifier::resolveNormalizedIdentical()
to handle any Expr\Cast via a new determineCastProducingType() helper method.
- (string)$expr === '' narrows to null|false|'' (unchanged behavior)
- (int)$expr === 0 narrows to null|false|0|0.0|''|'0'
This addresses the review feedback to generalize the approach beyond
just string casts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 719330d commit b2a3bb0
2 files changed
Lines changed: 74 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2934 | 2934 | | |
2935 | 2935 | | |
2936 | 2936 | | |
2937 | | - | |
| 2937 | + | |
2938 | 2938 | | |
2939 | 2939 | | |
2940 | | - | |
| 2940 | + | |
2941 | 2941 | | |
2942 | | - | |
2943 | | - | |
2944 | | - | |
2945 | | - | |
2946 | | - | |
2947 | | - | |
2948 | | - | |
2949 | | - | |
| 2942 | + | |
| 2943 | + | |
2950 | 2944 | | |
2951 | 2945 | | |
2952 | 2946 | | |
2953 | | - | |
| 2947 | + | |
2954 | 2948 | | |
2955 | 2949 | | |
2956 | 2950 | | |
| |||
3144 | 3138 | | |
3145 | 3139 | | |
3146 | 3140 | | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
3147 | 3177 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
0 commit comments