markitosgv/JWTRefreshTokenBundle

Deprecation on "Request/Extractor/RequestBodyExtractor.php::getRefreshToken": "$request->getContentType() method is deprecated"

TekPike opened this issue · 0 comments

The deprecation: Since symfony/http-foundation 6.2: The "Symfony\Component\HttpFoundation\Request::getContentType()" method is deprecated, use "getContentTypeFormat()" instead.

Concerned file: "Request/Extractor/RequestBodyExtractor.php" (line 20)

if (null === $request->getContentType() || false === strpos($request->getContentType(), 'json')) {
    return null;
}

A way to fix it:

$contentType = method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType();
if (null === $contentType || false === strpos($contentType, 'json')) {
    return null;
}