Allow Symfony 7 / Remove EOL PHP / Bearer Fix (#18357)

Bump requirements
  - add Symfony 7 support
  - remove support php < 8.2 (EOL)
  - remove symfony < 6.4 support

Bug Fix
  - add missing $security{{name}} variable when using Bearer Auth

Misc
 - getContentType method is deprecated; use getContentTypeFormat
 - use match instead of switch for simple assignments
 - remove default depth param from json_encode call
 - make data provider static (phpunit)
This commit is contained in:
Daniel Metzner
2024-04-13 04:46:47 +02:00
committed by GitHub
parent 4cde53c3d7
commit 8155d03c38
12 changed files with 161 additions and 320 deletions

View File

@@ -102,7 +102,7 @@ class Controller extends AbstractController
$json = $this->exceptionToArray($exception);
$json['statusCode'] = $statusCode;
return new Response(json_encode($json, 15, 512), $statusCode, $headers);
return new Response(json_encode($json, 15), $statusCode, $headers);
}
/**
@@ -229,7 +229,7 @@ class Controller extends AbstractController
public static function isContentTypeAllowed(Request $request, array $consumes = []): bool
{
if (!empty($consumes) && $consumes[0] !== '*/*') {
$currentFormat = $request->getContentType();
$currentFormat = $request->getContentTypeFormat();
foreach ($consumes as $mimeType) {
// canonize mime type
if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) {
@@ -240,7 +240,7 @@ class Controller extends AbstractController
// add custom format to request
$format = $mimeType;
$request->setFormat($format, $format);
$currentFormat = $request->getContentType();
$currentFormat = $request->getContentTypeFormat();
}
if ($format === $currentFormat) {