Skip to content

Commit

Permalink
Dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Feb 19, 2024
1 parent 30800b1 commit 7e57e6a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"ext-mbstring": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.38.2",
"friendsofphp/php-cs-fixer": "^3.49.0",
"laminas/laminas-mail": "^2.25.1",
"phpstan/phpstan": "^1.10.43",
"phpstan/phpstan": "^1.10.58",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-strict-rules": "^1.5.2",
"phpunit/phpunit": "^10.4.2"
"phpunit/phpunit": "^10.5.10"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/AbstractException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class AbstractException extends \RuntimeException
\E_USER_DEPRECATED => 'E_USER_DEPRECATED',
];

final public function __construct(string $message, int $code = 0, \Throwable $previous = null)
final public function __construct(string $message, int $code = 0, ?\Throwable $previous = null)
{
$errorType = '';
if (isset(self::ERROR_LABELS[$code])) {
Expand Down
2 changes: 1 addition & 1 deletion src/ImapResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class ImapResource implements ImapResourceInterface
/**
* Constructor.
*/
public function __construct(Connection $resource, MailboxInterface $mailbox = null)
public function __construct(Connection $resource, ?MailboxInterface $mailbox = null)
{
$this->resource = $resource;
$this->mailbox = $mailbox;
Expand Down
6 changes: 3 additions & 3 deletions src/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function count()
return $return;
}

public function getStatus(int $flags = null): \stdClass
public function getStatus(?int $flags = null): \stdClass
{
$return = \imap_status($this->resource->getStream(), $this->getFullEncodedName(), $flags ?? \SA_ALL);

Expand All @@ -114,7 +114,7 @@ public function clearFlag(string $flag, $numbers): bool
return \imap_clearflag_full($this->resource->getStream(), $this->prepareMessageIds($numbers), $flag, \ST_UID);
}

public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface
public function getMessages(?ConditionInterface $search = null, ?int $sortCriteria = null, bool $descending = false, ?string $charset = null): MessageIteratorInterface
{
if (null === $search) {
$search = new All();
Expand Down Expand Up @@ -191,7 +191,7 @@ public function getIterator(): MessageIteratorInterface
return $this->getMessages();
}

public function addMessage(string $message, string $options = null, \DateTimeInterface $internalDate = null): bool
public function addMessage(string $message, ?string $options = null, ?\DateTimeInterface $internalDate = null): bool
{
$arguments = [
$this->resource->getStream(),
Expand Down
10 changes: 5 additions & 5 deletions src/MailboxInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getDelimiter(): string;
/**
* Get Mailbox status.
*/
public function getStatus(int $flags = null): \stdClass;
public function getStatus(?int $flags = null): \stdClass;

/**
* Bulk Set Flag for Messages.
Expand All @@ -70,7 +70,7 @@ public function clearFlag(string $flag, $numbers): bool;
*
* @param ConditionInterface $search Search expression (optional)
*/
public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface;
public function getMessages(?ConditionInterface $search = null, ?int $sortCriteria = null, bool $descending = false, ?string $charset = null): MessageIteratorInterface;

/**
* Get message iterator for a sequence.
Expand All @@ -96,7 +96,7 @@ public function getIterator(): MessageIteratorInterface;
/**
* Add a message to the mailbox.
*/
public function addMessage(string $message, string $options = null, \DateTimeInterface $internalDate = null): bool;
public function addMessage(string $message, ?string $options = null, ?\DateTimeInterface $internalDate = null): bool;

/**
* Returns a tree of threaded message for the current Mailbox.
Expand All @@ -111,7 +111,7 @@ public function getThread(): array;
* @param array<int, int|string>|MessageIterator|string $numbers Message numbers
* @param MailboxInterface $mailbox Destination Mailbox to move the messages to
*
* @throws \Ddeboer\Imap\Exception\MessageMoveException
* @throws Exception\MessageMoveException
*/
public function move($numbers, self $mailbox): void;

Expand All @@ -121,7 +121,7 @@ public function move($numbers, self $mailbox): void;
* @param array<int, int|string>|MessageIterator|string $numbers Message numbers
* @param MailboxInterface $mailbox Destination Mailbox to copy the messages to
*
* @throws \Ddeboer\Imap\Exception\MessageCopyException
* @throws Exception\MessageCopyException
*/
public function copy($numbers, self $mailbox): void;
}
2 changes: 1 addition & 1 deletion src/Message/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class EmailAddress
private ?string $name;
private ?string $address;

public function __construct(string $mailbox, string $hostname = null, string $name = null)
public function __construct(string $mailbox, ?string $hostname = null, ?string $name = null)
{
$this->mailbox = $mailbox;
$this->hostname = $hostname;
Expand Down
10 changes: 5 additions & 5 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final protected function createConnection(): ConnectionInterface
return $server->authenticate((string) \getenv('IMAP_USERNAME'), (string) \getenv('IMAP_PASSWORD'));
}

final protected function createMailbox(ConnectionInterface $connection = null): MailboxInterface
final protected function createMailbox(?ConnectionInterface $connection = null): MailboxInterface
{
$connection = $connection ?? $this->getConnection();
$this->mailboxName = \uniqid('mailbox_' . self::SPECIAL_CHARS);
Expand All @@ -49,10 +49,10 @@ final protected function createMailbox(ConnectionInterface $connection = null):
final protected function createTestMessage(
MailboxInterface $mailbox,
string $subject,
string $contents = null,
string $encoding = null,
string $charset = null,
string $overwriteCharset = null
?string $contents = null,
?string $encoding = null,
?string $charset = null,
?string $overwriteCharset = null
): void {
$bodyPart = new Mime\Part($contents ?? \uniqid($subject));
$bodyPart->setType(Mime\Mime::TYPE_TEXT);
Expand Down
64 changes: 32 additions & 32 deletions tests/MailboxSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public function testSearchCapabilities(): void
$this->createTestMessage($this->mailbox, $firstSubject);
$this->createTestMessage($this->mailbox, \uniqid('second_'));

$messages = $this->mailbox->getMessages(new Search\Text\Subject($firstSubject));
$messages = $this->mailbox->getMessages(new Subject($firstSubject));

self::assertCount(1, $messages);
self::assertSame($firstSubject, $messages->current()->getSubject());

$messages = $this->mailbox->getMessages(new Search\Text\Subject(\uniqid('none_')));
$messages = $this->mailbox->getMessages(new Subject(\uniqid('none_')));

self::assertCount(0, $messages);
}
Expand All @@ -104,7 +104,7 @@ public function testUnknownCriterion(): void

public function testRawExpressionCondition(): void
{
$messages = $this->mailbox->getMessages(new Search\RawExpression('ON "1-Oct-2017"'));
$messages = $this->mailbox->getMessages(new RawExpression('ON "1-Oct-2017"'));

self::assertCount(0, $messages);
}
Expand All @@ -117,30 +117,30 @@ public function testSearchEscapes(): void
$date = new \DateTimeImmutable();

$conditions = [
new Search\LogicalOperator\All(),
new Search\Date\Since($date),
new Search\Date\Before($date),
new Search\Date\On($date),
new Search\Email\Bcc($specialEmail),
new Search\Email\Cc($specialEmail),
new Search\Email\From($specialEmail),
new Search\Email\To($specialEmail),
new Search\Flag\Answered(),
new Search\Flag\Flagged(),
new Search\Flag\Recent(),
new Search\Flag\Seen(),
new Search\Flag\Unanswered(),
new Search\Flag\Unflagged(),
new Search\Flag\Unseen(),
new Search\State\Deleted(),
new Search\State\NewMessage(),
new Search\State\Old(),
new Search\State\Undeleted(),
new Search\Text\Body($specialChars),
new Search\Text\Keyword($specialChars),
new Search\Text\Subject($specialChars),
new Search\Text\Text($specialChars),
new Search\Text\Unkeyword($specialChars),
new All(),
new Since($date),
new Before($date),
new On($date),
new Bcc($specialEmail),
new Cc($specialEmail),
new From($specialEmail),
new To($specialEmail),
new Answered(),
new Flagged(),
new Recent(),
new Seen(),
new Unanswered(),
new Unflagged(),
new Unseen(),
new Deleted(),
new NewMessage(),
new Old(),
new Undeleted(),
new Body($specialChars),
new Keyword($specialChars),
new Subject($specialChars),
new Text($specialChars),
new Unkeyword($specialChars),
];

$searchExpression = new SearchExpression();
Expand All @@ -162,11 +162,11 @@ public function testSpacesAndDoubleQuoteEscape(): void
// self::assertCount(0, $messages);
}

public function testOrConditionFunctionality(): Search\LogicalOperator\OrConditions
public function testOrConditionFunctionality(): OrConditions
{
$orCondition = new Search\LogicalOperator\OrConditions([
new Search\Text\Body(\uniqid()),
new Search\Text\Subject(\uniqid()),
$orCondition = new OrConditions([
new Body(\uniqid()),
new Subject(\uniqid()),
]);

self::assertStringContainsString('(', $orCondition->toString());
Expand All @@ -175,7 +175,7 @@ public function testOrConditionFunctionality(): Search\LogicalOperator\OrConditi
}

#[Depends('testOrConditionFunctionality')]
public function testOrConditionUsage(Search\LogicalOperator\OrConditions $orCondition): void
public function testOrConditionUsage(OrConditions $orCondition): void
{
self::markTestIncomplete('OR condition isn\'t supported by the current c-client library');

Expand Down

0 comments on commit 7e57e6a

Please sign in to comment.