Skip to content

Commit 6e3d608

Browse files
authored
Merge pull request #39 from tbreuss/fix/php-handler-return-response
return always a response object from PHP route handler
2 parents 179454f + 47afdbf commit 6e3d608

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/routing/PhpRouteHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PhpRouteHandler
1010
{
1111
private ?ContainerBuilder $container;
1212

13-
public function __invoke(Request $request): Response|array
13+
public function __invoke(Request $request): Response
1414
{
1515
$this->container = $request->attributes->get('_container');
1616
$path = $request->attributes->get('_path');
@@ -25,8 +25,8 @@ public function __invoke(Request $request): Response|array
2525

2626
$response = require $path;
2727

28-
if (!$response instanceof Response && !is_array($response)) {
29-
throw new \Exception('PHP file must return a response object or an array: ' . $path);
28+
if (!$response instanceof Response) {
29+
throw new \Exception('PHP file must return a response object: ' . $path);
3030
}
3131

3232
return $response;

0 commit comments

Comments
 (0)