Skip to content

Commit 163d570

Browse files
Guillaume DELOINCExabbuh
authored andcommitted
fix(maps): throwable maps
1 parent 21a27ce commit 163d570

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

DependencyInjection/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,10 @@ private function addExceptionSection(ArrayNodeDefinition $rootNode)
492492
*
493493
* @throws InvalidConfigurationException if the class was not found
494494
*/
495-
private function testExceptionExists($exception)
495+
private function testExceptionExists($throwable)
496496
{
497-
if (!is_subclass_of($exception, \Exception::class) && !is_a($exception, \Exception::class, true)) {
498-
throw new InvalidConfigurationException("FOSRestBundle exception mapper: Could not load class '$exception' or the class does not extend from '\\Exception'. Most probably this is a configuration problem.");
497+
if (!is_subclass_of($throwable, \Throwable::class)) {
498+
throw new InvalidConfigurationException("FOSRestBundle exception mapper: Could not load class '$throwable' or the class does not extend from '\\Throwable'. Most probably this is a configuration problem.");
499499
}
500500
}
501501
}

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function testExceptionCodesAcceptsIntegers()
4646
{
4747
$expectedConfig = [
4848
\RuntimeException::class => 500,
49+
\TypeError::class => 500,
4950
];
5051

5152
$config = $this->processor->processConfiguration(
@@ -132,7 +133,7 @@ public function testLoadBadMessagesClassThrowsException()
132133

133134
/**
134135
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
135-
* @expectedExceptionMessage Could not load class 'UnknownException' or the class does not extend from '\Exception'
136+
* @expectedExceptionMessage Could not load class 'UnknownException' or the class does not extend from '\Throwable'
136137
*/
137138
public function testLoadBadCodesClassThrowsException()
138139
{

0 commit comments

Comments
 (0)