From cd99c4e251c3ffc3f32669864470553ca73f5c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Letord?= Date: Fri, 30 Jan 2026 15:20:20 +0100 Subject: [PATCH] Allow more versions Vendoring requirements Revert JWT To clean To clean Again --- composer.json | 34 +++++++++--------- config/phpstan.neon | 2 ++ src/Util/Normalizer/PsrRequestNormalizer.php | 36 +++++++++---------- src/Util/Normalizer/PsrResponseNormalizer.php | 34 ++++++++---------- 4 files changed, 49 insertions(+), 57 deletions(-) diff --git a/composer.json b/composer.json index cd14edf8..c822a4a5 100644 --- a/composer.json +++ b/composer.json @@ -50,13 +50,12 @@ "canvural/php-openapi-faker": "^2.0", "cebe/php-openapi": "^1.5", "fakerphp/faker": "^1.9", - "firebase/php-jwt": "^6.0.0", - "guzzlehttp/promises": "^1.4.0", - "illuminate/collections": "^8.0", - "monolog/monolog": "^1.25.1 || ^2.8.0 || ^3.0.0", + "firebase/php-jwt": "^6.0", + "guzzlehttp/promises": "^1.4.0 || ^2.0", + "illuminate/collections": "^8.99", "myclabs/deep-copy": "^1.11", "nesbot/carbon": "^2.48", - "nyholm/psr7": "1.*", + "nyholm/psr7": "^1.0", "league/openapi-psr7-validator": "^0.18", "openclassrooms/openapi-psr7-validator": "dev-master", "opis/json-schema": "^2.3", @@ -65,17 +64,17 @@ "phpstan/phpdoc-parser": "^1.2", "phpunit/phpunit": "^9.5", "psr/http-client": "^1.0", - "psr/http-message": "1.*", - "symfony/console": "^5.0 || ^6.0", - "symfony/dotenv": "^5.0 || ^6.0", - "symfony/finder": "^5.0 || ^6.0", - "symfony/http-client": "^5.0 || ^6.0", - "symfony/http-kernel": "^5.0 || ^6.0", - "symfony/property-access": "^5.0 || ^6.0 || ^6.0", - "symfony/property-info": "^5.0 || ^6.0", - "symfony/psr-http-message-bridge": "^1.2 || ^2.1.2", - "symfony/serializer": "^5.0 || ^6.0", - "symfony/yaml": "^5.0 || ^6.0" + "psr/http-message": "^1.0 || ^2.0", + "symfony/console": "^5.0 || ^6.0 || ^7.0", + "symfony/dotenv": "^5.0 || ^6.0 || ^7.0", + "symfony/finder": "^5.0 || ^6.0 || ^7.0", + "symfony/http-client": "^5.0 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.0 || ^6.0 || ^7.0", + "symfony/property-access": "^5.0 || ^6.0 || ^7.0", + "symfony/property-info": "^5.0 || ^6.0 || ^7.0", + "symfony/psr-http-message-bridge": "^1.2 || ^2.1.2 || ^6.0 || ^7.0", + "symfony/serializer": "^5.0 || ^6.0 || ^7.0", + "symfony/yaml": "^5.0 || ^6.0 || ^7.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.25", @@ -92,9 +91,8 @@ "pyrech/composer-changelogs": "^1.8", "rector/rector": "^0.15.23", "roave/security-advisories": "dev-latest", - "dereuromark/composer-versions-check": "^0.1", "spaze/phpstan-disallowed-calls": "^2.1", - "symfony/var-dumper": "^5.0 || ^6.0", + "symfony/var-dumper": "^5.0 || ^6.0 || ^7.0", "symplify/easy-coding-standard": "^11.3.0", "thecodingmachine/phpstan-strict-rules": "^1.0", "veewee/composer-run-parallel": "^1.1" diff --git a/config/phpstan.neon b/config/phpstan.neon index c62836d8..fb0fec96 100644 --- a/config/phpstan.neon +++ b/config/phpstan.neon @@ -33,6 +33,8 @@ parameters: - '/Language construct empty\(\) should not be used./' - '/In method "APITester\\Requester\\SymfonyKernelRequester::request", caught "Throwable" must be rethrown.+/' - '/.+ APITester\\Test\\TestCase\|null is not subtype of type PHPUnit\\Framework\\Test\|null/' + - '/throws checked exception Symfony\\Component\\Serializer\\Exception\\ExceptionInterface/' + - '/APITester\\Command\\ExecutePlanCommand::\$defaultName has no type specified./' - {paths: [ ../tests ], message: '/Method .+ throws checked exception .+ but it''s missing from the PHPDoc @throws tag./'} - {paths: [ ../src/Test/TestCase.php, ../src/Test/Plan.php ], message: '/Calling eval\(\) is forbidden, eval is evil, please write more code and do not use eval\(\)/'} - {paths: [ ../src/Test/TestCase.php, ../src/Test/Plan.php ], message: '/Language construct eval\(\) should not be used./'} diff --git a/src/Util/Normalizer/PsrRequestNormalizer.php b/src/Util/Normalizer/PsrRequestNormalizer.php index 5d1463ea..68c1e93b 100644 --- a/src/Util/Normalizer/PsrRequestNormalizer.php +++ b/src/Util/Normalizer/PsrRequestNormalizer.php @@ -11,39 +11,28 @@ final class PsrRequestNormalizer implements NormalizerInterface { - /** - * @inerhitDoc - * - * @param mixed $data - * @param mixed|null $format - */ - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Request; } /** - * @inerhitDoc - * - * @param mixed $object - * @param mixed|null $format - * * @return array{'method': string, * 'url': string, * 'body': string|array, * 'headers': array * } */ - public function normalize($object, $format = null, array $context = []): array + public function normalize(mixed $data, ?string $format = null, array $context = []): array { - /** @var Request $object */ + /** @var Request $data */ $result = [ - 'method' => $object->getMethod(), - 'url' => (string) $object->getUri(), - 'body' => Json::isJson((string) $object->getBody()) ? Json::decode( - (string) $object->getBody() - ) : (string) $object->getBody(), - 'headers' => $object->getHeaders(), + 'method' => $data->getMethod(), + 'url' => (string) $data->getUri(), + 'body' => Json::isJson((string) $data->getBody()) ? Json::decode( + (string) $data->getBody() + ) : (string) $data->getBody(), + 'headers' => $data->getHeaders(), ]; if (isset($context[AbstractNormalizer::IGNORED_ATTRIBUTES])) { @@ -61,4 +50,11 @@ public function normalize($object, $format = null, array $context = []): array */ return $result; } + + public function getSupportedTypes(?string $format): array + { + return [ + Request::class => true, + ]; + } } diff --git a/src/Util/Normalizer/PsrResponseNormalizer.php b/src/Util/Normalizer/PsrResponseNormalizer.php index 2008e6dd..2e3139e7 100644 --- a/src/Util/Normalizer/PsrResponseNormalizer.php +++ b/src/Util/Normalizer/PsrResponseNormalizer.php @@ -11,38 +11,27 @@ final class PsrResponseNormalizer implements NormalizerInterface { - /** - * @inerhitDoc - * - * @param mixed $data - * @param mixed|null $format - */ - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Response; } /** - * @inerhitDoc - * - * @param mixed $object - * @param mixed|null $format - * * @return array{ * 'body': string|array, * 'status': int, * 'headers': array * } */ - public function normalize($object, $format = null, array $context = []): array + public function normalize(mixed $data, ?string $format = null, array $context = []): array { - /** @var Response $object */ + /** @var Response $data */ $result = [ - 'body' => Json::isJson((string) $object->getBody()) ? Json::decode( - (string) $object->getBody() - ) : (string) $object->getBody(), - 'headers' => $object->getHeaders(), - 'status' => $object->getStatusCode(), + 'body' => Json::isJson((string) $data->getBody()) ? Json::decode( + (string) $data->getBody() + ) : (string) $data->getBody(), + 'headers' => $data->getHeaders(), + 'status' => $data->getStatusCode(), ]; if (isset($context[AbstractNormalizer::IGNORED_ATTRIBUTES])) { @@ -60,4 +49,11 @@ public function normalize($object, $format = null, array $context = []): array */ return $result; } + + public function getSupportedTypes(?string $format): array + { + return [ + Response::class => true, + ]; + } }