Skip to content

Commit 8a0502e

Browse files
committed
Merge branch '2.x' into 3.0
* 2.x: sync changelog Allow to specify Throwable as exception class
2 parents 2a6f137 + b88e564 commit 8a0502e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
3.0.3
5+
-----
6+
7+
* fixed being able to configure exception codes and messages based on interfaces (e.g.
8+
`Throwable`)
9+
410
3.0.2
511
-----
612

@@ -135,6 +141,12 @@ CHANGELOG
135141
* `FOS\RestBundle\View\View`
136142
* `FOS\RestBundle\View\ViewHandler`
137143

144+
2.8.3
145+
-----
146+
147+
* fixed being able to configure exception codes and messages based on interfaces (e.g.
148+
`Throwable`)
149+
138150
2.8.2
139151
-----
140152

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)