In PhpStorm warning method 'withJson' not found (Slim Framework)

Viewed 2203

In PhpStorm I get the warning message "warning method 'withJson' not found" in \Psr\Http\Message\ResponseInterface" at te line:

return $response->withJson($toReturn, 200);

The code:

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);
});

I already updated slim framework with composer to latest version 3.8.1 and added Slim as a plugin in PhpStorm. The Vendor directorie is set to Sources and Excluded.

The only answer I can find is to turn off the warning messages in PhpStorm in Editor -> Inspections -> PHP -> Undefined -> undefined method.

Is there a better solution?

1 Answers
Related