-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Skip Generator on SimplifyForeachToCoalescingRector (#…
…6221) * [CodeQuality] Skip Generator on SimplifyForeachToCoalescingRector * [CodeQuality] Skip Generator on SimplifyForeachToCoalescingRector * ensure array type * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
6a4d717
commit 69a3e31
Showing
4 changed files
with
36 additions
and
6 deletions.
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
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
23 changes: 23 additions & 0 deletions
23
...eQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector/Fixture/skip_generator.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,23 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector\Fixture; | ||
|
||
final class SkipGenerator | ||
{ | ||
public function load(): \Generator | ||
{ | ||
foreach (['a' => 1, 'b' => 2] as $key => $value) { | ||
yield $key => $value; | ||
} | ||
} | ||
|
||
public function loadByKey(string $name): ?int | ||
{ | ||
foreach ($this->load() as $key => $value) { | ||
if ($key === $name) { | ||
return $value; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
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