Skip to content

Commit e39bed1

Browse files
committed
Merge branch '2.x' into 3.x
* 2.x: Allow to specify Throwable as exception class
2 parents 98a8c31 + 2df7d95 commit e39bed1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private function addExceptionSection(ArrayNodeDefinition $rootNode): void
470470

471471
private function testExceptionExists(string $throwable): void
472472
{
473-
if (!is_subclass_of($throwable, \Throwable::class)) {
473+
if (!is_a($throwable, \Throwable::class, true)) {
474474
throw new InvalidConfigurationException(sprintf('FOSRestBundle exception mapper: Could not load class "%s" or the class does not extend from "%s". Most probably this is a configuration problem.', $throwable, \Throwable::class));
475475
}
476476
}

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function testExceptionCodesAcceptsIntegers()
4848
$expectedConfig = [
4949
\RuntimeException::class => 500,
5050
\TypeError::class => 500,
51+
\Throwable::class => 500,
5152
];
5253

5354
$config = $this->processor->processConfiguration(

0 commit comments

Comments
 (0)