在PhpStorm中,我在\ Psr\Http\Message\ResponseInterface"的te行收到警告信息"警告方法'找不到Json':
return $response->withJson($toReturn, 200);
Run Code Online (Sandbox Code Playgroud)
代码:
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
$app->get('/bedrijven', function (Request $request, Response $response) {
require_once(CLASSES_PATH . "/class_bedrijven.php");
$Bedrijven = new Bedrijven();
$toReturn = $Bedrijven->get_bedrijven();
return $response->withJson($toReturn, 200);
});
Run Code Online (Sandbox Code Playgroud)
我已经将使用composer的slim框架更新到最新版本3.8.1,并在PhpStorm中添加了Slim作为插件.供应商主管将设置为来源和排除.
我能找到的唯一答案是在编辑器 - >检查 - > PHP - >未定义 - >未定义方法中关闭PhpStorm中的警告消息.
有更好的解决方案吗?