-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EarlyReturn] Skip with AssignOp on PreparedValueToEarlyReturnRector (…
…#5857) * [EarlyReturn] Skip with AssignOp on PreparedValueToEarlyReturnRector * [EarlyReturn] Skip with AssignOp on PreparedValueToEarlyReturnRector
- Loading branch information
1 parent
10558a8
commit 28e84d2
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...rn_/PreparedValueToEarlyReturnRector/Fixture/skip_append_variable_value_before_if.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\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector\Fixture; | ||
|
||
final class SkipAppendVariableValueBeforeIf | ||
{ | ||
public function getTravelString(bool $shorten, int $range, string $metric, float $distance): string | ||
{ | ||
$label = ($shorten) ? ($metric === 'time' ? ' hrs' : ' mi') : ($metric === 'time' ? ' hours' : ' miles'); | ||
$range = ($metric === 'time') ? round($range / 60, 1) : $range; | ||
|
||
$travels = ($shorten) ? '' : 'up to '; | ||
$travels .= $range . $label; | ||
|
||
if ($distance > 3000) { | ||
$travels = ($shorten) ? 'any' : 'nationwide'; | ||
} | ||
|
||
return $travels; | ||
} | ||
} | ||
|
||
?> |
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