Skip to content

Commit a94f4fb

Browse files
committed
fix psalm errors
1 parent dbf8df0 commit a94f4fb

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

src/Accumulate.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function current(): mixed
3838
/** @psalm-suppress UnusedMethodCall */
3939
$this->pop();
4040

41+
/** @var S */
4142
return \current($this->values);
4243
}
4344

src/Sequence/Aggregate.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ public function __invoke(callable $map): \Generator
5858

5959
/** @psalm-suppress ImpureMethodCall */
6060
while ($this->values->valid()) {
61-
/** @psalm-suppress ImpureFunctionCall */
61+
/**
62+
* @psalm-suppress PossiblyNullArgument
63+
* @psalm-suppress ImpureFunctionCall
64+
*/
6265
$aggregate = $this->walk($map($n2, $n1), $void);
6366

6467
foreach ($aggregate as $element) {

src/Sequence/Lazy.php

+1
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ public function dropWhile(callable $condition): self
860860
/**
861861
* @psalm-suppress ImpureMethodCall
862862
* @psalm-suppress ImpureFunctionCall
863+
* @psalm-suppress PossiblyNullArgument
863864
*/
864865
if (!$condition($generator->current())) {
865866
/** @psalm-suppress ImpureMethodCall */

src/Sequence/Primitive.php

+1
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ public function dropWhile(callable $condition): self
609609
/**
610610
* @psalm-suppress ImpureMethodCall
611611
* @psalm-suppress ImpureFunctionCall
612+
* @psalm-suppress PossiblyNullArgument
612613
*/
613614
if (!$condition($iterator->current())) {
614615
/** @psalm-suppress ImpureMethodCall */

src/Str.php

+6
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ public function pregSplit(string|\Stringable $regex, int $limit = -1): Sequence
285285
{
286286
/** @psalm-suppress ArgumentTypeCoercion */
287287
$strings = \preg_split((string) $regex, $this->value, $limit);
288+
289+
if ($strings === false) {
290+
/** @psalm-suppress ImpureFunctionCall */
291+
throw new InvalidRegex('', \preg_last_error());
292+
}
293+
288294
/** @var Sequence<self> */
289295
$sequence = Sequence::of();
290296

0 commit comments

Comments
 (0)