We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2c9c1aa + fda004d commit 26687e4Copy full SHA for 26687e4
src/Traits/Capacity.php
@@ -1,6 +1,8 @@
1
<?php
2
namespace Ds\Traits;
3
4
+use Ds\Deque;
5
+
6
/**
7
* Common to structures that deal with an internal capacity. While none of the
8
* PHP implementations actually make use of a capacity, it's important to keep
@@ -104,6 +106,10 @@ protected function shouldDecreaseCapacity(): bool
104
106
*/
105
107
protected function shouldIncreaseCapacity(): bool
108
{
- return count($this) > $this->capacity;
109
+ if ($this instanceof Deque) {
110
+ return count($this) > $this->capacity;
111
+ }
112
113
+ return count($this) >= $this->capacity;
114
}
115
0 commit comments