Skip to content

Commit 93e4cfc

Browse files
committed
Fix handling of initial capacity for Deque
1 parent 5652e58 commit 93e4cfc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Traits/GenericSequence.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public function __construct(iterable $values = [])
3131
foreach ($values as $value) {
3232
$this->push($value);
3333
}
34+
35+
$this->capacity = max(
36+
$values === null ? 0 : count($values),
37+
$this::MIN_CAPACITY
38+
);
3439
}
3540

3641
/**

0 commit comments

Comments
 (0)