-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php56] Skip after infinite loop on AddDefaultValueForUndefinedVariab…
…leRector (#3390) * Add failing test fixture for AddDefaultValueForUndefinedVariableRector with infinite loop # Failing Test for AddDefaultValueForUndefinedVariableRector Based on https://getrector.com/demo/e1b4cf4e-c34f-466d-ac1a-4ecdbffca61c * rename fixture * Closes #3388 Fixes rectorphp/rector#7777 * remove comment * add more failing fixture * rollback * fix * Fix * Fix * Final touch: clean up * Final touch: clean up * Final touch: clean up * Really Really Final touch: verify when parent is Closure Expr --------- Co-authored-by: Jack Bentley <jackbentley@iname.com>
- Loading branch information
1 parent
bf7648c
commit c65e60f
Showing
3 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...onLike/AddDefaultValueForUndefinedVariableRector/Fixture/skip_after_infinite_loop.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture; | ||
|
||
final class SkipAfterInfiniteLoop | ||
{ | ||
public function run(Item $yes) | ||
{ | ||
while (true !== false) { | ||
} | ||
|
||
$a = []; | ||
|
||
if ($b = $yes) { | ||
$a[] = 'test'; | ||
} | ||
|
||
return $a; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...nLike/AddDefaultValueForUndefinedVariableRector/Fixture/skip_after_infinite_loop2.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector\Fixture; | ||
|
||
final class SkipAfterInfiniteLoop2 | ||
{ | ||
public function run(Item $yes) | ||
{ | ||
echo 'test'; | ||
|
||
while (true !== false) { | ||
} | ||
|
||
$a = []; | ||
|
||
if ($b = $yes) { | ||
$a[] = 'test'; | ||
} | ||
|
||
return $a; | ||
} | ||
} |