Commit 3d34d5f
Fix static method call on non-generic class-string returning ErrorType
- Static method calls on non-generic class-string (e.g. $class::foo() where $class is class-string) now return mixed instead of *ERROR*
- The root cause was that ClassStringType::getObjectTypeOrClassStringObjectType() returns ObjectWithoutClassType, which has hasMethod() returning maybe, causing filterTypeWithMethod() to return null
- Added check in StaticCallHandler: when the resolved type is a classless object type (from class-string), return MixedType instead of ErrorType
- New regression test in tests/PHPStan/Analyser/nsrt/bug-9844.php1 parent 47f36d8 commit 3d34d5f
2 files changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
338 | 339 | | |
339 | 340 | | |
340 | 341 | | |
341 | | - | |
| 342 | + | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
345 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
346 | 349 | | |
347 | 350 | | |
348 | 351 | | |
| |||
| 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 | + | |
0 commit comments