You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AssertIsTypeMethodCallRector crashes on 'isType' method call on any other object #9765
$someObject->isType() inside a subclass of PHPUnit\Framework\TestCase crashes the AssertIsTypeMethodCallRector when an enum case is passed in.
Error:
[ERROR] Could not process
"thefile.php" file, due to:
"System error: "Cannot access offset of type App\Enums\SomeEnum in isset or empty"
Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 92
that speed though 😳 Thank you for this insane quick fix!
I do wonder however, why does this Rector rule process the isType method here? The method is not called on a TestCase object, so there's no assertion to replace.
Right now the following still happens:
- (new stdClass)->isType('array');+ (new stdClass)->isArray();
but rector has no business in changing this method call. It's on an instance of a class type which should be ignored new stdClass is obviously just for simplicity in this bugticket ;)
Activity
fix(AssertIsTypeMethodCallRector): guard against non-string arg crash…
TomasVotruba commentedon May 21, 2026
Fix, thanks for reporting 👍
Levivb commentedon May 21, 2026
that speed though 😳 Thank you for this insane quick fix!
I do wonder however, why does this Rector rule process the
isTypemethod here? The method is not called on aTestCaseobject, so there's no assertion to replace.Right now the following still happens:
but rector has no business in changing this method call. It's on an instance of a class type which should be ignored
new stdClassis obviously just for simplicity in this bugticket ;)TomasVotruba commentedon May 21, 2026
I'll check it
TomasVotruba commentedon May 21, 2026
This should do : ) rectorphp/rector-phpunit#675
Levivb commentedon May 21, 2026
hah awesome! yea that looks nice! ❤️
indeed 2 bugs in one 😬 probably should've been more clear about that 😅
TomasVotruba commentedon May 21, 2026
No worries, the 2nd was hidding under 1st bigger one 😆 . Impossible to see at the start 👍
Keep up trying Rector out and reporting 🙏
github-actions commentedon Oct 25, 2026
This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.