What do you think about fixer that would remove non-reachable code?
eg
before:
functinon foo()
{
echo 1;
return;
echo 2;
}
after:
functinon foo()
{
echo 1;
return;
}
馃憤 to have this. However I think this could be a risky fixer for some. It won't change what the code would do, but often unreachable code isn't intentional and people should actually run the code which is unreachable.
often unreachable code isn't intentional
agree
and people should actually run the code which is unreachable
why?
@keradus, I think it should be named "UnreachableCodeFixer" (instead of "NoUnreachableCodeFixer" which seems a contradiction for what you're proposing).
We name rules after state the code will follow after fixing. For all fixers. Just for consistency. So, after fixing, there should be no unreachable code.
Excellent then @keradus. Thanks for the clarification.
case 'directdebit':
return 'test';
break;
please let the fixer remove the break in these cases as well :)
As much as having this fixer would be great I'm not sure it's worth the effort - would be very complicated and Vimeo's Psalm has --find-dead-code option to do exactly this.
Most helpful comment
please let the fixer remove the
breakin these cases as well :)