Skip to content

AddMethodCallBasedStrictParamTypeRector timeout when checking index from array_reverse #7896

@internalsystemerror

Description

@internalsystemerror

Bug Report

Subject Details
Rector version v0.15.25

When using the AddMethodCallBasedStrictParamTypeRector rule and checking the index of an array created from array_reverse, rector ends up getting stuck and eventually triggers the timeout.

Minimal PHP Code Causing Issue

https://getrector.com/demo/fe336fa4-194f-4bd3-8922-2780d5141d13

Changing:
$parts = array_reverse(explode('/', '/some/test/url')); to $parts = explode('/', '/some/test/url');

OR removing the lines:

if ($index === 0) {
    continue;
}

Allows rector to proceed

Note that the explode is unnecessary to replicate this, and passing a hard coded array to array_reverse has the same issue.

Expected Behaviour

Rector should be able to proceed without causing a timeout.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions