Skip to content

Expand NullToStrictIntPregSlitFuncCallLimitArgRector to support more functions #9483

Description

@codebymikey

Feature Request

I appreciate the work done with rectorphp/rector-src#7240!

From testing some more legacy code through rector, it seems that a bunch of more functions require the null to int conversion (mainly the preg_* class of functions).

So I think it might be a good idea to abstract the NullToStrictIntPregSlitFuncCallLimitArgRector (slight typo) into a more flexible NullToStrictIntFuncCallArgRector, so something along the lines of this map can be incorporated for those functions (or make it configurable so that users can add their own functions or methods too):

I've added a 3v4l snippet to showcase the behaviour on PHP 7.4 vs 8.1:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions