Skip to content

Commit 9e5216b

Browse files
SpacePossumsebastianbergmann
authored andcommitted
ConfigurationException - previous must be (child of) \Exception, not Exception.
1 parent ca5ec11 commit 9e5216b

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/Exception/ConfigurationException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
final class ConfigurationException extends InvalidArgumentException
1414
{
1515
/**
16-
* @param string $option
17-
* @param string $expected
18-
* @param mixed $value
19-
* @param int $code
20-
* @param Exception|null $previous
16+
* @param string $option
17+
* @param string $expected
18+
* @param mixed $value
19+
* @param int $code
20+
* @param \Exception|null $previous
2121
*/
2222
public function __construct(
2323
string $option,
2424
string $expected,
2525
$value,
2626
int $code = 0,
27-
Exception $previous = null
27+
\Exception $previous = null
2828
) {
2929
parent::__construct(
3030
\sprintf(

tests/Exception/ConfigurationExceptionTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,25 @@
1717
*/
1818
final class ConfigurationExceptionTest extends TestCase
1919
{
20-
public function testConstruct()
20+
public function testConstructWithDefaults()
2121
{
2222
$e = new ConfigurationException('test', 'A', 'B');
2323

2424
$this->assertSame(0, $e->getCode());
2525
$this->assertNull($e->getPrevious());
2626
$this->assertSame('Option "test" must be A, got "string#B".', $e->getMessage());
2727
}
28+
29+
public function testConstruct()
30+
{
31+
$e = new ConfigurationException(
32+
'test',
33+
'integer',
34+
new \SplFileInfo(__FILE__),
35+
789,
36+
new \BadMethodCallException(__METHOD__)
37+
);
38+
39+
$this->assertSame('Option "test" must be integer, got "SplFileInfo".', $e->getMessage());
40+
}
2841
}

0 commit comments

Comments
 (0)