Skip to content

Skip ExplicitReturnNullRector on code which contains goto #9224

@staabm

Description

@staabm

Bug Report

Subject Details
Rector version e.g. v1.0.0 (invoke vendor/bin/rector --version)

writing a simple "retry"-function is most efficiently done using goto - even though most people hate it.

rector adds a return null at the bottom of the function, which is dead code in this regard.
I think ExplicitReturnNullRector should stop trying to add return statements, when a single goto is met in the function/method scope it currently works on

Minimal PHP Code Causing Issue

https://getrector.com/demo/2f66102f-2dcd-4468-a142-794ec56ae9e6

Expected Behaviour

no return added

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