Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Commit

Permalink
fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 18, 2019
1 parent ad4a89a commit 7a83160
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Command/DebugCommand.php
Expand Up @@ -113,8 +113,8 @@ protected function outputMailer($name)

$tableRows[] = ['Name', $name];
$tableRows[] = ['Service', $service];
$tableRows[] = ['Class', get_class($mailer)];
$tableRows[] = ['Transport', sprintf('%s (%s)', sprintf('swiftmailer.mailer.%s.transport.name', $name), get_class($transport))];
$tableRows[] = ['Class', \get_class($mailer)];
$tableRows[] = ['Transport', sprintf('%s (%s)', sprintf('swiftmailer.mailer.%s.transport.name', $name), \get_class($transport))];
$tableRows[] = ['Spool', $spool];
if ($this->getContainer()->hasParameter(sprintf('swiftmailer.spool.%s.file.path', $name))) {
$tableRows[] = ['Spool file', $this->getContainer()->getParameter(sprintf('swiftmailer.spool.%s.file.path', $name))];
Expand Down
2 changes: 1 addition & 1 deletion DataCollector/MessageDataCollector.php
Expand Up @@ -110,7 +110,7 @@ public function getMailers()
public function getMailerData($name)
{
if (!isset($this->data['mailer'][$name])) {
throw new \LogicException(sprintf('Missing "%s" data in "%s".', $name, get_class($this)));
throw new \LogicException(sprintf('Missing "%s" data in "%s".', $name, \get_class($this)));
}

return $this->data['mailer'][$name];
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Expand Up @@ -50,7 +50,7 @@ public function getConfigTreeBuilder()
->end()
->beforeNormalization()
->ifTrue(function ($v) {
return is_array($v) && !array_key_exists('mailers', $v) && !array_key_exists('mailer', $v);
return \is_array($v) && !\array_key_exists('mailers', $v) && !\array_key_exists('mailer', $v);
})
->then(function ($v) {
$mailer = [];
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/SwiftmailerExtension.php
Expand Up @@ -118,7 +118,7 @@ protected function configureMailer($name, array $mailer, ContainerBuilder $conta

$container->setParameter(sprintf('swiftmailer.mailer.%s.transport.name', $name), $transport);

$transportId = in_array($transport, ['smtp', 'sendmail', 'null'])
$transportId = \in_array($transport, ['smtp', 'sendmail', 'null'])
? sprintf('swiftmailer.mailer.%s.transport.%s', $name, $transport)
: $transport;

Expand Down Expand Up @@ -333,7 +333,7 @@ protected function configureMailerAntiFlood($name, array $mailer, ContainerBuild

protected function configureMailerDeliveryAddress($name, array $mailer, ContainerBuilder $container, $isDefaultMailer = false)
{
if (count($mailer['delivery_addresses']) > 0) {
if (\count($mailer['delivery_addresses']) > 0) {
$container->setParameter(sprintf('swiftmailer.mailer.%s.single_address', $name), $mailer['delivery_addresses'][0]);
$container->setParameter(sprintf('swiftmailer.mailer.%s.delivery_addresses', $name), $mailer['delivery_addresses']);
$container->setParameter(sprintf('swiftmailer.mailer.%s.delivery_whitelist', $name), $mailer['delivery_whitelist']);
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/SwiftmailerTransportFactory.php
Expand Up @@ -148,11 +148,11 @@ public static function resolveOptions(array $options)
*/
public static function validateConfig($options)
{
if (!in_array($options['encryption'], ['tls', 'ssl', null], true)) {
if (!\in_array($options['encryption'], ['tls', 'ssl', null], true)) {
throw new \InvalidArgumentException(sprintf('The %s encryption is not supported', $options['encryption']));
}

if (!in_array($options['auth_mode'], ['plain', 'login', 'cram-md5', 'ntlm', null], true)) {
if (!\in_array($options['auth_mode'], ['plain', 'login', 'cram-md5', 'ntlm', null], true)) {
throw new \InvalidArgumentException(sprintf('The %s authentication mode is not supported', $options['auth_mode']));
}
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftmailerBundle.php
Expand Up @@ -31,7 +31,7 @@ public function build(ContainerBuilder $container)

// Older supported versions of Symfony don't have the parent class that EnsureNoHotPathPass extends from.
// But they don't have the hot_path optimization either, so not being able to register our pass is not an issue.
if (\class_exists('Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass')) {
if (class_exists('Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass')) {
$container->addCompilerPass(new EnsureNoHotPathPass(), PassConfig::TYPE_AFTER_REMOVING);
}
}
Expand Down
34 changes: 24 additions & 10 deletions Tests/Command/SendEmailCommandTest.php
Expand Up @@ -56,7 +56,7 @@ public function testTimeLimitNull()
$container = $this->buildContainer($spoolTransport, $realTransport);
$this->executeCommand($container);

$this->assertSame(null, $spool->getTimeLimit());
$this->assertNull($spool->getTimeLimit());
}

public function testMessageLimitInteger()
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testMessageLimitNull()
$container = $this->buildContainer($spoolTransport, $realTransport);
$this->executeCommand($container);

$this->assertSame(null, $spool->getMessageLimit());
$this->assertNull($spool->getMessageLimit());
}

public function testRecoverLoadbalancedTransportWithSpool()
Expand Down Expand Up @@ -129,11 +129,11 @@ private function buildContainer(\Swift_Transport $transport, \Swift_Transport $r
/**
* @return CommandTester
*/
private function executeCommand(ContainerInterface $container, $input = array(), $options = array())
private function executeCommand(ContainerInterface $container, $input = [], $options = [])
{
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
$kernel->expects($this->any())->method('getContainer')->willReturn($container);
$kernel->expects($this->any())->method('getBundles')->willReturn(array());
$kernel->expects($this->any())->method('getBundles')->willReturn([]);

$application = new Application($kernel);
$application->add(new SendEmailCommand());
Expand All @@ -149,12 +149,26 @@ private function executeCommand(ContainerInterface $container, $input = array(),
*/
private function configurableSpool(): \Swift_ConfigurableSpool
{
return new class extends \Swift_ConfigurableSpool {
public function start() {}
public function stop() {}
public function isStarted() {}
public function queueMessage(\Swift_Mime_SimpleMessage $message) {}
public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null) {}
return new class() extends \Swift_ConfigurableSpool {
public function start()
{
}

public function stop()
{
}

public function isStarted()
{
}

public function queueMessage(\Swift_Mime_SimpleMessage $message)
{
}

public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null)
{
}
};
}
}
@@ -1,6 +1,6 @@
<?php

$container->loadFromExtension('swiftmailer', array(
$container->loadFromExtension('swiftmailer', [
'transport' => 'sendmail',
'url' => '%env(SWIFTMAILER_URL)%',
));
]);
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/SwiftmailerExtensionTest.php
Expand Up @@ -99,7 +99,7 @@ public function testSendmailConfig($type)
*/
public function testSendmailDynamicConfigWithoutCommand($type)
{
$container = $this->loadContainerFromFile('sendmail_no_command', $type, array(), true);
$container = $this->loadContainerFromFile('sendmail_no_command', $type, [], true);
$container->getAlias('swiftmailer.transport')->setPublic(true);

/** @var \Swift_SendmailTransport $transport */
Expand Down

0 comments on commit 7a83160

Please sign in to comment.