Skip to content

Commit

Permalink
Add B/C layer for Symfony 6.2 deprecation
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas <thomas@sctr.net>
  • Loading branch information
mbabker and deluxetom committed Jan 17, 2023
1 parent 603a76f commit cb3294e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Request/Extractor/RequestBodyExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ final class RequestBodyExtractor implements ExtractorInterface
{
public function getRefreshToken(Request $request, string $parameter): ?string
{
if (null === $request->getContentType() || !str_contains($request->getContentType(), 'json')) {
$format = method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType();
if (null === $format || !str_contains($format, 'json')) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Request/Extractor/RequestBodyExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private function createMockRequest(?string $contentType, ?array $jsonBodyData =

$request
->expects($this->atLeastOnce())
->method('getContentType')
->method(method_exists(Request::class, 'getContentTypeFormat') ? 'getContentTypeFormat' : 'getContentType')
->willReturn($contentType);

if (is_array($jsonBodyData)) {
Expand Down

0 comments on commit cb3294e

Please sign in to comment.