Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and remove unsed file. #69

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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 @@

/**
* @psalm-suppress UndefinedClass
* @psalm-suppress RedundantConditionGivenDocblockType
* @throws InvalidConfigException
* @throws \yii\di\NotInstantiableException
*/
Expand All @@ -92,8 +93,9 @@
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 @@ -112,15 +114,15 @@
SendinblueTransportFactory::class,
] as $factoryClass) {
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 @@
}

/**
* @param MessageWrapperInterface&MessageInterface $message
* @param MessageInterface|MessageWrapperInterface $message
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
*/
protected function sendMessage($message): bool
Expand All @@ -176,6 +178,6 @@
$message = $this->signer->sign($message, $this->signerOptions);
}
$this->getTransport()->send($message);
return true;

Check warning on line 181 in src/Mailer.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ $message = $this->signer->sign($message, $this->signerOptions); } $this->getTransport()->send($message); - return true; + return false; } }
}
}
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
Loading