Skip to content

Commit d947cbe

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Console] Dispatch `ConsoleTerminateEvent` when exiting on signal [Cache][VarExporter] Fix proxy generation to deal with edgy behaviors of internal classes fix detecting the installed FrameworkBundle version [Notifier] [Telegram] Fix version and exception signature fix tests, partially reverts 1333caf89af4630e03f792c45b62c4dee6b5bf3a fix tests Fix merge error with ErrorLoggerCompilerPass
2 parents b0fc25b + fc31efa commit d947cbe

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

Exception/MultipleExclusiveOptionsUsedException.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
class MultipleExclusiveOptionsUsedException extends InvalidArgumentException
1818
{
1919
/**
20-
* @param string[] $usedExclusiveOptions
21-
* @param string[]|null $exclusiveOptions
20+
* @param string[] $usedExclusiveOptions
21+
* @param string[] $exclusiveOptions
2222
*/
23-
public function __construct(array $usedExclusiveOptions, array $exclusiveOptions = null, \Throwable $previous = null)
23+
public function __construct(array $usedExclusiveOptions, array $exclusiveOptions, \Throwable $previous = null)
2424
{
25-
$message = sprintf('Multiple exclusive options have been used "%s".', implode('", "', $usedExclusiveOptions));
26-
if (null !== $exclusiveOptions) {
27-
$message .= sprintf(' Only one of %s can be used.', implode('", "', $exclusiveOptions));
28-
}
25+
$message = sprintf(
26+
'Multiple exclusive options have been used "%s". Only one of "%s" can be used.',
27+
implode('", "', $usedExclusiveOptions),
28+
implode('", "', $exclusiveOptions)
29+
);
2930

3031
parent::__construct($message, 0, $previous);
3132
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Tests\Exception;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Notifier\Exception\MultipleExclusiveOptionsUsedException;
16+
17+
class MultipleExclusiveOptionsUsedExceptionTest extends TestCase
18+
{
19+
public function testMessage()
20+
{
21+
$exception = new MultipleExclusiveOptionsUsedException(['foo', 'bar'], ['foo', 'bar', 'baz']);
22+
23+
$this->assertSame(
24+
'Multiple exclusive options have been used "foo", "bar". Only one of "foo", "bar", "baz" can be used.',
25+
$exception->getMessage()
26+
);
27+
}
28+
}

0 commit comments

Comments
 (0)