From 02d78eb205291dfdeb38fc075a303fe084301bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 25 Apr 2023 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ControllerInterpreter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ControllerInterpreter.php b/src/ControllerInterpreter.php index 8908754..cbbf227 100644 --- a/src/ControllerInterpreter.php +++ b/src/ControllerInterpreter.php @@ -81,7 +81,8 @@ class ControllerInterpreter $reflectionMethod = $reflectionClass->getMethod($reflectionMethod); } - if ($reflectionMethod->getReturnType()->getName() !== 'Psr\Http\Message\ResponseInterface') { + $returnType = $reflectionMethod->getReturnType(); + if (method_exists($returnType, 'getName') && $returnType->getName() !== 'Psr\Http\Message\ResponseInterface') { die('Request Handler<' . $class::class . '::' . $reflectionMethod->getName() . '> returns must implements on Psr\Http\Message\ResponseInterface'); }