Skip to content

Commit

Permalink
#2229 Declare $previousCount only if a rounding is proceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Oct 23, 2020
1 parent 61b2c44 commit c4a9caf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Carbon/CarbonInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,10 @@ public function forHumans($syntax = null, $short = false, $parts = -1, $options

$intervalValues = $this;
$method = static::getRoundingMethodFromOptions($options);
$previousCount = INF;

if ($method) {
$previousCount = INF;

while (
\count($intervalValues->getNonZeroValues()) > $parts &&
($count = \count($keys = array_keys($intervalValues->getValuesSequence()))) > 1
Expand Down

0 comments on commit c4a9caf

Please sign in to comment.