Commit 1f47699
committed
fix: satisfy PHPStan 8.5 strict nullable-offset analysis
PHPStan on PHP 8.5 is stricter about array-offset access when the key
type includes null. Three pre-existing call sites tripped the new
offsetAccess.invalidOffset rule; all three are safe to tighten without
behavior change on any supported PHP version (8.2+).
FieldsBuilder::mapDocBlock — skip @param tags with no variable name
(phpdocumentor returns null there) instead of silently coercing null
into an empty-string key.
GlobTypeMapperCache::registerAnnotations — GlobAnnotationsCache's
withType() sets typeClassName and typeName together, so inside the
`typeClassName !== null` branch typeName is guaranteed non-null. Add
an assert() to document the invariant for the analyser.
IteratorTypeMapper::splitIteratorFromOtherTypes — restructure so the
unset/return happens inside the loop where $key has a concrete
array-key type, instead of carrying a nullable $key across the
loop/early-return boundary. Also drops the unused null initializer.1 parent 1c60784 commit 1f47699
3 files changed
Lines changed: 17 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
882 | 888 | | |
883 | 889 | | |
884 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | 209 | | |
212 | 210 | | |
213 | 211 | | |
| |||
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
219 | | - | |
220 | 217 | | |
221 | 218 | | |
222 | 219 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | 220 | | |
227 | | - | |
228 | | - | |
229 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
230 | 224 | | |
231 | | - | |
232 | | - | |
| 225 | + | |
| 226 | + | |
233 | 227 | | |
234 | | - | |
| 228 | + | |
235 | 229 | | |
236 | 230 | | |
0 commit comments