Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 3
level: 4
ignoreErrors:
-
identifier: new.static
Expand Down
8 changes: 6 additions & 2 deletions src/Connection/ImapConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public function connect(string $host, ?int $port = null, array $options = []): v

/**
* Get the default socket options for the given transport.
*
* @param 'ssl'|'tls'|'starttls'|'tcp' $transport
*/
protected function getDefaultSocketOptions(string $transport, array $proxy = [], bool $validateCert = true): array
{
Expand Down Expand Up @@ -595,6 +597,8 @@ public function done(): void

/**
* Send an IMAP command.
*
* @param-out string $tag
*/
public function send(string $name, array $tokens = [], ?string &$tag = null): void
{
Expand Down Expand Up @@ -744,9 +748,9 @@ protected function assertNextResponse(callable $filter, callable $assertion, cal
* @template T of Response
*
* @param callable(T): bool $filter
* @return T
* @return T|null
*/
protected function nextResponse(callable $filter): Response
protected function nextResponse(callable $filter): ?Response
{
if (! $this->parser) {
throw new LogicException('No parser instance set');
Expand Down
4 changes: 4 additions & 0 deletions src/Connection/ImapQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ protected function parseDate(mixed $date): CarbonInterface

/**
* Build a single expression node from a basic or nested where.
*
* @param array{type: 'basic'|'nested', boolean: 'AND'|'OR', query: ImapQueryBuilder} $where
*/
protected function makeExpressionNode(array $where): array
{
Expand All @@ -391,6 +393,8 @@ protected function makeExpressionNode(array $where): array

/**
* Merge the existing expression with the next expression, respecting the boolean operator.
*
* @param 'AND'|'OR' $boolean
*/
protected function mergeExpressions(string $existing, string $next, string $boolean): string
{
Expand Down
2 changes: 2 additions & 0 deletions src/FlaggableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public function hasFlag(BackedEnum|string $flag): bool;

/**
* Add or remove a flag from the message.
*
* @param '+'|'-' $operation
*/
public function flag(BackedEnum|string $flag, string $operation, bool $expunge = false): void;
}
4 changes: 2 additions & 2 deletions src/MessageQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ protected function fetch(Collection $messages): array
return [
$uid => [
'flags' => $data->lookup('FLAGS')?->values() ?? [],
'headers' => $data->lookup('[HEADER]')?->value ?? '',
'contents' => $data->lookup('[TEXT]')?->value ?? '',
'headers' => $data->lookup('[HEADER]')->value ?? '',
'contents' => $data->lookup('[TEXT]')->value ?? '',
],
];
})->all();
Expand Down
2 changes: 2 additions & 0 deletions src/QueriesMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ trait QueriesMessages

/**
* The fetch order.
*
* @var 'asc'|'desc'
*/
protected string $fetchOrder = 'desc';

Expand Down
1 change: 1 addition & 0 deletions src/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public static function fromImapUtf7(string $string): string

// Direct implementation of IMAP's modified UTF-7 decoding.
return preg_replace_callback('/&([^-]*)-?/', function ($matches) {
/** @var array{0: string, 1: string, 2?: string} $matches */
// If it's just an ampersand.
if ($matches[1] === '') {
return '&';
Expand Down