phpactor
phpactor copied to clipboard
[RPC][extract_expression] Extract expression without selection potentially breaks the code
Currently if extract_expression
executed while nothing is selected (offset start = offset end) then it potentially breaks the code. (well surprisingly sometimes it figures out what to do anyway - wow)
I think in this case it would be safer if the command would no do anything.
What do you think?
It's basically quite immature - it needs more tests! https://github.com/phpactor/code-transform/blob/master/lib/Adapter/TolerantParser/Refactor/TolerantExtractExpression.php
This issue should be fixed. At least there is a test for it.
https://github.com/phpactor/phpactor/blob/137b6a0fbd0e46bf729c1e439a068627e2a614c1/lib/CodeTransform/Tests/Adapter/TolerantParser/Refactor/TolerantExtractExpressionTest.php#L140
thanks @mamazu