Skip to content

Commit

Permalink
Update dependencies and remove unsed file. (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Wilmer Arambula <terabytesoftw@users.noreply.github.com>
  • Loading branch information
terabytesoftw and terabytesoftw authored Feb 14, 2024
1 parent 21f4072 commit d7fe4ee
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 72 deletions.
64 changes: 0 additions & 64 deletions captainhook.json

This file was deleted.

10 changes: 10 additions & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"symbol-whitelist": [
"Symfony\\Component\\Mailer\\Bridge\\Amazon\\Transport\\SesTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Google\\Transport\\GmailTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Infobip\\Transport\\InfobipTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Mailchimp\\Transport\\MandrillTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Mailgun\\Transport\\MailgunTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Mailjet\\Transport\\MailjetTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\OhMySmtp\\Transport\\OhMySmtpTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Postmark\\Transport\\PostmarkTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Sendgrid\\Transport\\SendgridTransportFactory",
"Symfony\\Component\\Mailer\\Bridge\\Sendinblue\\Transport\\SendinblueTransportFactory",
"yii\\psr\\DynamicLogger"
]
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"require": {
"php": ">=8.1",
"psr/event-dispatcher": "1.0.0",
"psr/event-dispatcher": "^1.0",
"symfony/mailer": "^6.4 || ^7.0",
"symfony/mime": "^6.4 || ^7.0",
"yiisoft/yii2": ">=2.0.4"
Expand Down Expand Up @@ -79,4 +79,4 @@
"psalm": "psalm",
"test": "phpunit"
}
}
}
10 changes: 6 additions & 4 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private function getTransport(): TransportInterface

/**
* @psalm-suppress UndefinedClass
* @psalm-suppress RedundantConditionGivenDocblockType
* @throws InvalidConfigException
* @throws \yii\di\NotInstantiableException
*/
Expand All @@ -92,8 +93,9 @@ private function getTransportFactory(): Transport
if (isset($this->transportFactory)) {
return $this->transportFactory;
}

// Use the Yii DI container, if available.
if (isset(\Yii::$container)) {
if (isset(Yii::$container)) {
$factories = [];
foreach ([
NullTransportFactory::class,
Expand All @@ -114,13 +116,13 @@ private function getTransportFactory(): Transport
if (!class_exists($factoryClass)) {
continue;

Check warning on line 117 in src/Mailer.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Continue_": --- Original +++ New @@ @@ $factories = []; foreach ([NullTransportFactory::class, SendmailTransportFactory::class, EsmtpTransportFactory::class, NativeTransportFactory::class, SesTransportFactory::class, GmailTransportFactory::class, InfobipTransportFactory::class, MandrillTransportFactory::class, MailgunTransportFactory::class, MailjetTransportFactory::class, OhMySmtpTransportFactory::class, PostmarkTransportFactory::class, SendgridTransportFactory::class, SendinblueTransportFactory::class] as $factoryClass) { if (!class_exists($factoryClass)) { - continue; + break; } $factories[] = Yii::$container->get($factoryClass); }
}
$factories[] = \Yii::$container->get($factoryClass);
$factories[] = Yii::$container->get($factoryClass);
}
} else {
$factories = Transport::getDefaultFactories();
}

/** @psalm-suppress InvalidArgument Symfony's type annotation is wrong */
/** @psalm-var array<array-key, \Symfony\Component\Mailer\Transport\TransportFactoryInterface> $factories */
return new Transport($factories);
}

Expand Down Expand Up @@ -154,7 +156,7 @@ private function createTransport(array $config = []): TransportInterface
}

/**
* @param MessageWrapperInterface&MessageInterface $message
* @param MessageInterface|MessageWrapperInterface $message
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
*/
protected function sendMessage($message): bool
Expand Down
4 changes: 2 additions & 2 deletions tests/MailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function testSendMessageThrowsOnBadMessageType(): void

public function testDiContainer(): void
{
\Yii::$container = new Container();
Yii::$container = new Container();

$dispatcherMock = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
$dispatcherCreator = $this
Expand All @@ -180,7 +180,7 @@ public function testDiContainer(): void
$dispatcherCreator
->expects(self::atLeastOnce())
->method('__invoke')->willReturn($dispatcherMock);
\Yii::$container->set(EventDispatcherInterface::class, $dispatcherCreator);
Yii::$container->set(EventDispatcherInterface::class, $dispatcherCreator);


$mailer = new Mailer();
Expand Down

0 comments on commit d7fe4ee

Please sign in to comment.