Skip to content

Commit ef42c47

Browse files
authored
Merge pull request #109 from billythekid/patch-1
Fix deprecation notices
2 parents ce95a72 + 7cc9ace commit ef42c47

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/Map.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public function count(): int
287287
* @psalm-param (callable(TKey, TValue): bool)|null $callback
288288
* @psalm-return Map<TKey, TValue>
289289
*/
290-
public function filter(callable $callback = null): Map
290+
public function filter(?callable $callback = null): Map
291291
{
292292
$filtered = new self();
293293

@@ -552,7 +552,7 @@ public function reversed(): Map
552552
*
553553
* @psalm-return Map<TKey, TValue>
554554
*/
555-
public function slice(int $offset, int $length = null): Map
555+
public function slice(int $offset, ?int $length = null): Map
556556
{
557557
$map = new self();
558558

@@ -578,7 +578,7 @@ public function slice(int $offset, int $length = null): Map
578578
*
579579
* @psalm-param (callable(TValue, TValue): int)|null $comparator
580580
*/
581-
public function sort(callable $comparator = null)
581+
public function sort(?callable $comparator = null)
582582
{
583583
if ($comparator) {
584584
usort($this->pairs, function($a, $b) use ($comparator) {
@@ -603,7 +603,7 @@ public function sort(callable $comparator = null)
603603
* @psalm-param (callable(TValue, TValue): int)|null $comparator
604604
* @psalm-return Map<TKey, TValue>
605605
*/
606-
public function sorted(callable $comparator = null): Map
606+
public function sorted(?callable $comparator = null): Map
607607
{
608608
$copy = $this->copy();
609609
$copy->sort($comparator);
@@ -619,7 +619,7 @@ public function sorted(callable $comparator = null): Map
619619
*
620620
* @psalm-param (callable(TKey, TKey): int)|null $comparator
621621
*/
622-
public function ksort(callable $comparator = null)
622+
public function ksort(?callable $comparator = null)
623623
{
624624
if ($comparator) {
625625
usort($this->pairs, function($a, $b) use ($comparator) {
@@ -644,7 +644,7 @@ public function ksort(callable $comparator = null)
644644
* @psalm-param (callable(TKey, TKey): int)|null $comparator
645645
* @psalm-return Map<TKey, TValue>
646646
*/
647-
public function ksorted(callable $comparator = null): Map
647+
public function ksorted(?callable $comparator = null): Map
648648
{
649649
$copy = $this->copy();
650650
$copy->ksort($comparator);

src/Set.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function xor(Set $set): Set
177177
* @psalm-param (callable(TValue): bool)|null $callback
178178
* @psalm-return Set<TValue>
179179
*/
180-
public function filter(callable $callback = null): Set
180+
public function filter(?callable $callback = null): Set
181181
{
182182
return new self(array_filter($this->toArray(), $callback ?: 'boolval'));
183183
}
@@ -243,7 +243,7 @@ public function isEmpty(): bool
243243
*
244244
* @param string|null $glue
245245
*/
246-
public function join(string $glue = null): string
246+
public function join(?string $glue = null): string
247247
{
248248
return implode($glue ?? '', $this->toArray());
249249
}
@@ -363,7 +363,7 @@ public function reversed(): Set
363363
*
364364
* @psalm-return Set<TValue>
365365
*/
366-
public function slice(int $offset, int $length = null): Set
366+
public function slice(int $offset, ?int $length = null): Set
367367
{
368368
$sliced = new self();
369369
$sliced->table = $this->table->slice($offset, $length);
@@ -379,7 +379,7 @@ public function slice(int $offset, int $length = null): Set
379379
*
380380
* @psalm-param (callable(TValue, TValue): int)|null $comparator
381381
*/
382-
public function sort(callable $comparator = null)
382+
public function sort(?callable $comparator = null)
383383
{
384384
$this->table->ksort($comparator);
385385
}
@@ -396,7 +396,7 @@ public function sort(callable $comparator = null)
396396
* @psalm-param (callable(TValue, TValue): int)|null $comparator
397397
* @psalm-return Set<TValue>
398398
*/
399-
public function sorted(callable $comparator = null): Set
399+
public function sorted(?callable $comparator = null): Set
400400
{
401401
$sorted = $this->copy();
402402
$sorted->table->ksort($comparator);

0 commit comments

Comments
 (0)