From cbd97cdb51b2aca208946c43dc768eb004807793 Mon Sep 17 00:00:00 2001 From: Maxcastel Date: Wed, 9 Sep 2026 11:34:51 +0200 Subject: [PATCH] feat!: drop the Request::getContentType() fallbacks --- phpstan.neon.dist | 2 -- src/GraphQl/Action/EntrypointAction.php | 2 +- src/Serializer/SerializerContextBuilder.php | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ee3f9221f42..961562c7d0d 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -86,8 +86,6 @@ parameters: # Expected, due to backward compatibility - '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#' - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\PropertyInfo\\\\\\\\PropertyInfoExtractor' and 'getType' will always evaluate to true\\.#" - - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\HttpFoundation\\\\\\\\Request' and 'getContentTypeFormat' will always evaluate to true\\.#" - - '#Call to an undefined method Symfony\\Component\\HttpFoundation\\Request::getContentType\(\)\.#' - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\Serializer\\\\\\\\Serializer' and 'getSupportedTypes' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface and 'getSupportedTypes' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\ClassMetadata\\|Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata and 'isChangeTrackingDef…' will always evaluate to true\\.#" diff --git a/src/GraphQl/Action/EntrypointAction.php b/src/GraphQl/Action/EntrypointAction.php index eb3a24cdb10..3be68bc68b1 100644 --- a/src/GraphQl/Action/EntrypointAction.php +++ b/src/GraphQl/Action/EntrypointAction.php @@ -100,7 +100,7 @@ private function parseRequest(Request $request): array return [$query, $operationName, $variables]; } - $contentType = method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType(); + $contentType = $request->getContentTypeFormat(); if ('json' === $contentType) { return $this->parseData($query, $operationName, $variables, $request->getContent()); } diff --git a/src/Serializer/SerializerContextBuilder.php b/src/Serializer/SerializerContextBuilder.php index b259e6015ea..bf0582b74fd 100644 --- a/src/Serializer/SerializerContextBuilder.php +++ b/src/Serializer/SerializerContextBuilder.php @@ -97,7 +97,7 @@ public function createFromRequest(Request $request, bool $normalization, ?array } } - if ('csv' === (method_exists(Request::class, 'getContentTypeFormat') ? $request->getContentTypeFormat() : $request->getContentType())) { + if ('csv' === $request->getContentTypeFormat()) { $context[CsvEncoder::AS_COLLECTION_KEY] = $context[CsvEncoder::AS_COLLECTION_KEY] ?? false; } }