Commit 40ccae6
Bail to MixedType in deep dim fetch writes on oversized arrays
When produceArrayDimFetchAssignValueToWrite walks down through nested
ArrayDimFetch nodes, each level calls getOffsetValueType on the current
type. For deeply nested structures (6+ levels) where the type has already
been marked as an oversized array (precision intentionally lost), these
cascading operations produce exponential cost without useful precision
gain.
Stop drilling deeper when the dim fetch depth exceeds 5 AND the current
offsetValueType is already an oversized array, substituting MixedType
instead. This prevents expensive cascading intersectTypes/union operations
at levels where precision cannot be maintained anyway.
Closes phpstan/phpstan#146241 parent 9abd515 commit 40ccae6
2 files changed
Lines changed: 113 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
| |||
1073 | 1075 | | |
1074 | 1076 | | |
1075 | 1077 | | |
| 1078 | + | |
1076 | 1079 | | |
| 1080 | + | |
1077 | 1081 | | |
1078 | 1082 | | |
1079 | 1083 | | |
1080 | 1084 | | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1085 | 1102 | | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | 1103 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
| 1104 | + | |
1094 | 1105 | | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | 1106 | | |
1099 | 1107 | | |
1100 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 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 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
0 commit comments