-
-
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 throw after foreach with return in loop on Simplif…
…yForeachToCoalescingRector (#5714) * CodeQuality] Skip throw after foreach with return in loop on SimplifyForeachToCoalescingRector * CodeQuality] Skip throw after foreach with return in loop on SimplifyForeachToCoalescingRector * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
01c460e
commit a775c65
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ector/Foreach_/SimplifyForeachToCoalescingRector/Fixture/skip_throw_after_foreach.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,26 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector\Fixture; | ||
|
||
class SkipThrowAfterForeach | ||
{ | ||
public const SHOPCONFIGKEY_FILTER = 'MY_KEY'; | ||
|
||
/** | ||
* @return array<string, mixed> | ||
* | ||
* @throws Exception | ||
*/ | ||
private function getFilterConfig(): array | ||
{ | ||
$shopConfig = clxMobileNet::config('shopconfig'); | ||
|
||
foreach ($shopConfig as $key => $mixedValues) { | ||
if (self::SHOPCONFIGKEY_FILTER === $key) { | ||
return $mixedValues; | ||
} | ||
} | ||
|
||
throw new \Exception('Usage of "'.self::class.'" assumes that ShopConfig "'.self::SHOPCONFIGKEY_FILTER.'" is defined!'); | ||
} | ||
} |
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