N°9319 increase php min. version to 8.2 (#887)

* Update minimum PHP version to 8.2
* Fix previous wrong resolution of merge conflict
This commit is contained in:
jf-cbd
2026-04-20 14:47:44 +02:00
committed by GitHub
parent f439490bfc
commit 805087a01b
171 changed files with 5629 additions and 1446 deletions

View File

@@ -105,7 +105,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
try {
$payload = $this->$payloadMapper($request, $type, $argument);
} catch (PartialDenormalizationException $e) {
$trans = $this->translator ? $this->translator->trans(...) : fn ($m, $p) => strtr($m, $p);
$trans = $this->translator ? $this->translator->trans(...) : static fn ($m, $p) => strtr($m, $p);
foreach ($e->getErrors() as $error) {
$parameters = [];
$template = 'This value was of an unexpected type.';
@@ -187,7 +187,7 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
}
if (\is_array($data)) {
return $this->serializer->denormalize($data, $type, 'csv', $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
return $this->serializer->denormalize($data, $type, self::hasNonStringScalar($data) ? $format : 'csv', $attribute->serializationContext + self::CONTEXT_DENORMALIZE);
}
if ('form' === $format) {
@@ -202,4 +202,21 @@ class RequestPayloadValueResolver implements ValueResolverInterface, EventSubscr
throw new HttpException(Response::HTTP_BAD_REQUEST, \sprintf('Request payload contains invalid "%s" data.', $format), $e);
}
}
private static function hasNonStringScalar(array $data): bool
{
$stack = [$data];
while ($stack) {
foreach (array_pop($stack) as $v) {
if (\is_array($v)) {
$stack[] = $v;
} elseif (!\is_string($v)) {
return true;
}
}
}
return false;
}
}

View File

@@ -171,6 +171,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
if ($autowireAttributes) {
$invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
$attribute = $autowireAttributes[0]->newInstance();
$value = $parameterBag->resolveValue($attribute->value);

View File

@@ -47,6 +47,7 @@ class LocaleListener implements EventSubscriberInterface
public function setDefaultLocale(KernelEvent $event): void
{
$event->getRequest()->setDefaultLocale($this->defaultLocale);
$this->setRouterLocale($this->defaultLocale);
}
public function onKernelRequest(RequestEvent $event): void
@@ -54,14 +55,12 @@ class LocaleListener implements EventSubscriberInterface
$request = $event->getRequest();
$this->setLocale($request);
$this->setRouterContext($request);
$this->setRouterLocale($request->getLocale());
}
public function onKernelFinishRequest(FinishRequestEvent $event): void
{
if (null !== $parentRequest = $this->requestStack->getParentRequest()) {
$this->setRouterContext($parentRequest);
}
$this->setRouterLocale($this->requestStack->getParentRequest()?->getLocale() ?? $this->defaultLocale);
}
private function setLocale(Request $request): void
@@ -76,9 +75,9 @@ class LocaleListener implements EventSubscriberInterface
}
}
private function setRouterContext(Request $request): void
private function setRouterLocale(string $locale): void
{
$this->router?->getContext()->setParameter('_locale', $request->getLocale());
$this->router?->getContext()->setParameter('_locale', $locale);
}
public static function getSubscribedEvents(): array

View File

@@ -77,11 +77,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
*/
private static array $freshCache = [];
public const VERSION = '6.4.34';
public const VERSION_ID = 60434;
public const VERSION = '6.4.36';
public const VERSION_ID = 60436;
public const MAJOR_VERSION = 6;
public const MINOR_VERSION = 4;
public const RELEASE_VERSION = 34;
public const RELEASE_VERSION = 36;
public const EXTRA_VERSION = '';
public const END_OF_MAINTENANCE = '11/2026';