Skip to content

Commit b89656b

Browse files
committed
[DowngradePhp84] Apply on return on DowngradeArrayAllRector
1 parent 1088f72 commit b89656b

File tree

1 file changed

+34
-0
lines changed
  • rules-tests/DowngradePhp84/Rector/Expression/DowngradeArrayAllRector/Fixture

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Rector\Tests\DowngradePhp84\Rector\Expression\DowngradeArrayAllRector\Fixture;
4+
5+
class OnReturn
6+
{
7+
public function run(array $animals)
8+
{
9+
return array_all($animals, fn($animal) => str_starts_with($animal, 'c'));
10+
}
11+
}
12+
13+
?>
14+
-----
15+
<?php
16+
17+
namespace Rector\Tests\DowngradePhp84\Rector\Expression\DowngradeArrayAllRector\Fixture;
18+
19+
class OnReturn
20+
{
21+
public function run(array $animals)
22+
{
23+
$found = true;
24+
foreach ($animals as $animal) {
25+
if (!str_starts_with($animal, 'c')) {
26+
$found = false;
27+
break;
28+
}
29+
}
30+
return $found;
31+
}
32+
}
33+
34+
?>

0 commit comments

Comments
 (0)