-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DowngradePhp74] Handle fn inside fn on ArrowFunctionToAnonymousFunct…
…ionRector (#967) * Add failing test fixture for ArrowFunctionToAnonymousFunctionRector # Failing Test for ArrowFunctionToAnonymousFunctionRector Based on https://getrector.org/demo/1ec26a84-7939-6dfc-82c4-1f4ae14adb2e Issue: rectorphp/rector#6730 * Renamed test file * [DowngradePhp74] Handle fn inside fn * fix Co-authored-by: Leonardo Losoviz <leo@getpop.org>
- Loading branch information
1 parent
97a8d8e
commit cddcebf
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.../Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector/Fixture/fn_inside_fn.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,47 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
final class DemoFile | ||
{ | ||
public function run() | ||
{ | ||
$inputObjectList = [/* ... */]; | ||
$serviceObjectList = [/* ... */]; | ||
$containsAllServiceObjectList = array_filter( | ||
$inputObjectList, | ||
fn ($object) => array_udiff( | ||
$serviceObjectList, | ||
$object->getServiceObjects(), | ||
fn ($object1, $object2) => get_class($object1) <=> get_class($object2), | ||
) === [], | ||
); | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
final class DemoFile | ||
{ | ||
public function run() | ||
{ | ||
$inputObjectList = [/* ... */]; | ||
$serviceObjectList = [/* ... */]; | ||
$containsAllServiceObjectList = array_filter( | ||
$inputObjectList, | ||
function ($object) use ($serviceObjectList) { | ||
return array_udiff( | ||
$serviceObjectList, | ||
$object->getServiceObjects(), | ||
function ($object1, $object2) { | ||
return get_class($object1) <=> get_class($object2); | ||
}, | ||
) === []; | ||
}, | ||
); | ||
} | ||
} | ||
?> |
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