Description
Originally posted by @agleis:
I've posted a gif of this issue below, but basically, in certain situations (especially in highly complex or nested functions), method extraction will 'paste' the method outside of the wrong set of brackets, such that it is still inside the original method. An example of this would be:
public function method() {
if(8 == 8) {
for($i = 0; $i < 10; $i++) {
$i++;
$i--;
}
}
}
Extracting the $i++
and $i--
lines would produce:
public function method() {
if(8 == 8) {
for($i = 0; $i < 10; $i++) {
$this->test($i);
}
}
/**
* @param $i
*/
public function test($i) {
$i++;
$i--;
}
}
As you can see, the new function is still inside the original method brackets. It probably wouldn't happen with a function this small, but that's the idea. I have noticed this quite a few times when I've been working on more complex classes, and it is a bit annoying. See the gif below for a real example of this bug happening.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.