Skip to content

Commit 1bfec80

Browse files
authored
Merge pull request #92 from simPod/implicit
Fix PHP 8.1 deprecations
2 parents 298cafa + 5da7abc commit 1bfec80

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

src/PriorityQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private function right(int $index): int
120120
*/
121121
private function parent(int $index): int
122122
{
123-
return ($index - 1) / 2;
123+
return (int) (($index - 1) / 2);
124124
}
125125

126126
/**

src/Queue.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ public function offsetUnset($offset)
178178
*
179179
* @throws Error
180180
*/
181+
#[\ReturnTypeWillChange]
181182
public function offsetExists($offset)
182183
{
183184
throw new Error();

src/Set.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function isEmpty(): bool
243243
*/
244244
public function join(string $glue = null): string
245245
{
246-
return implode($glue, $this->toArray());
246+
return implode($glue ?? '', $this->toArray());
247247
}
248248

249249
/**

src/Traits/Capacity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
trait Capacity
1212
{
1313
/**
14-
* @var integer internal capacity
14+
* @var int internal capacity
1515
*/
1616
private $capacity = self::MIN_CAPACITY;
1717

@@ -95,7 +95,7 @@ protected function shouldIncreaseCapacity(): bool
9595

9696
protected function nextCapacity(): int
9797
{
98-
return $this->capacity() * $this->getGrowthFactor();
98+
return (int) ($this->capacity() * $this->getGrowthFactor());
9999
}
100100

101101
/**
@@ -116,7 +116,7 @@ protected function decreaseCapacity()
116116
{
117117
$this->capacity = max(
118118
self::MIN_CAPACITY,
119-
$this->capacity() * $this->getDecayFactor()
119+
(int) ($this->capacity() * $this->getDecayFactor())
120120
);
121121
}
122122

src/Traits/GenericSequence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function insert(int $index, ...$values)
148148
*/
149149
public function join(string $glue = null): string
150150
{
151-
return implode($glue, $this->array);
151+
return implode($glue ?? '', $this->array);
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)