Commit 29d203f
fix(AssertIsTypeMethodCallRector): guard against non-string arg crashing isset on enum case (#674)
When `isType()` is called with an enum case argument, `ValueResolver::getValue()`
returns an enum object. Using it as an array key in `isset()` caused a fatal error:
"Cannot access offset of type SomeEnum in isset or empty".
Add `is_string()` guard before the array lookup so non-string args are safely skipped.
Fixes rectorphp/rector#9765
Co-authored-by: Claude <noreply@anthropic.com>1 parent d4fd79d commit 29d203f
2 files changed
Lines changed: 24 additions & 0 deletions
File tree
- rules-tests/PHPUnit120/Rector/Class_/AssertIsTypeMethodCallRector/Fixture
- rules/PHPUnit120/Rector/Class_
Lines changed: 20 additions & 0 deletions
| 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 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
0 commit comments