Skip to content

Commit fb8abb8

Browse files
committed
Make loop in assertNextResponse looping, by making sure nextResponse returns null instead of throwing
PHPStorm tells me the loop in assertNextResponse is not looping, PHPStan tells me the throw at the end of assertNextResponse ist unreachable
1 parent ab9dec0 commit fb8abb8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Connection/ImapConnection.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Exception;
2525
use Generator;
2626
use LogicException;
27+
use Throwable;
2728

2829
class ImapConnection implements ConnectionInterface
2930
{
@@ -726,8 +727,12 @@ protected function assertTaggedResponse(string $tag, ?callable $exception = null
726727
*
727728
* @template T of Response
728729
*
729-
* @param callable(T): bool $filter
730+
* @param callable(Response): bool $filter
731+
* @param callable(T): bool $assertion
732+
* @param callable(T): Throwable $exception
730733
* @return T
734+
*
735+
* @throws ImapResponseException
731736
*/
732737
protected function assertNextResponse(callable $filter, callable $assertion, callable $exception): Response
733738
{
@@ -768,7 +773,7 @@ protected function nextResponse(callable $filter): ?Response
768773
}
769774
}
770775

771-
throw new ImapResponseException('No matching response found');
776+
return null;
772777
}
773778

774779
/**

0 commit comments

Comments
 (0)