Repository navigation
Commit 4afc290
Cache a class's ancestors without the class itself
getAncestors() cached an array that contained $this, so every
ClassReflection that had answered it referenced itself. PHPStan runs
with gc_disable(), so a ClassReflection the reflection provider does not
keep, like a withTypes() copy, then stayed in memory until the process
ended, together with its template type map.
The cache now leaves the class out, and getAncestors() adds it back
first, so the returned array is the same.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent c7c28d4 commit 4afc290
2 files changed
Lines changed: 38 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2213 | 2213 | | |
2214 | 2214 | | |
2215 | 2215 | | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
| 2216 | + | |
2219 | 2217 | | |
2220 | 2218 | | |
2221 | 2219 | | |
2222 | 2220 | | |
2223 | 2221 | | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2224 | 2226 | | |
2225 | 2227 | | |
2226 | 2228 | | |
2227 | | - | |
| 2229 | + | |
2228 | 2230 | | |
2229 | 2231 | | |
2230 | 2232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
378 | 410 | | |
0 commit comments