From 65e0572e312a58440db2c7e02bbdd18cc662865c Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 19 Mar 2024 14:42:44 +0100 Subject: [PATCH 1/8] Add Symfony 7 support to Composer dependencies --- Makefile | 2 +- composer.json | 28 ++++++++++++++-------------- composer.lock | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 9db7d5d..be10967 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ ifeq ($(filter $(version),6.2 6.3 6.4),) sed -i -e "s/\(\s\+\)\(handle_all_throwables:\)/\1# \2/" tests/Functional/App/config.yaml endif -ifeq ($(filter $(version),5.3 5.4 6.0 6.1 6.2 6.3 6.4),) +ifeq ($(filter $(version),5.3 5.4 6.0 6.1 6.2 6.3 6.4 7.0),) sed -i -e "s/\(\s\+\)# \(storage_id:\)/\1\2/" tests/Functional/App/config.yaml sed -i -e "s/\(\s\+\)\(storage_factory_id:\)/\1# \2/" tests/Functional/App/config.yaml sed -i -e "s/\(\s\+\)\(lazy:\)/\1# \2/" tests/Functional/App/config.yaml diff --git a/composer.json b/composer.json index c232a54..adaf6c4 100755 --- a/composer.json +++ b/composer.json @@ -15,27 +15,27 @@ "justinrainbow/json-schema": "^5.2", "league/uri": "^6.3", "seld/jsonlint": "^1.7", - "symfony/config": "^5.4 || ^6.0", - "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/framework-bundle": "^5.4 || ^6.0", - "symfony/http-foundation": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", - "symfony/property-access": "^5.4 || ^6.0", - "symfony/routing": "^5.4 || ^6.0", - "symfony/serializer": "^5.4 || ^6.0", - "symfony/yaml": "^5.4 || ^6.0" + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0", + "symfony/routing": "^5.4 || ^6.0 || ^7.0", + "symfony/serializer": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", "masterminds/html5": "^2.7", "monolog/monolog": "^1.27 || ^2.6 || ^3.0", "phpunit/phpunit": "^9.6", - "symfony/browser-kit": "^5.4 || ^6.0", - "symfony/phpunit-bridge": "^5.4 || ^6.0", - "symfony/process": "^5.4 || ^6.0", - "symfony/security-bundle": "^5.4 || ^6.0" + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/security-bundle": "^5.4 || ^6.0 || ^7.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 205b1c9..f596afd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "004a637e7699c6f622c3fc0dd68fe537", + "content-hash": "8d5f9c830a3b05c4790c6b1347de31d0", "packages": [ { "name": "justinrainbow/json-schema", From a4a681a9c428df6820ddfb5974c355bb5b001472 Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 19 Mar 2024 15:11:54 +0100 Subject: [PATCH 2/8] Update dependencies in Composer lock --- composer.lock | 311 +++++++++++++++++++++++++------------------------- 1 file changed, 156 insertions(+), 155 deletions(-) diff --git a/composer.lock b/composer.lock index f596afd..7c99d8a 100644 --- a/composer.lock +++ b/composer.lock @@ -562,16 +562,16 @@ }, { "name": "symfony/cache", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "a30f316214d908cf5874f700f3f3fb29ceee91ba" + "reference": "223c3afac82e003a76931b71d77db408636a0de8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/a30f316214d908cf5874f700f3f3fb29ceee91ba", - "reference": "a30f316214d908cf5874f700f3f3fb29ceee91ba", + "url": "https://api.github.com/repos/symfony/cache/zipball/223c3afac82e003a76931b71d77db408636a0de8", + "reference": "223c3afac82e003a76931b71d77db408636a0de8", "shasum": "" }, "require": { @@ -639,7 +639,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.36" + "source": "https://github.com/symfony/cache/tree/v5.4.38" }, "funding": [ { @@ -655,20 +655,20 @@ "type": "tidelift" } ], - "time": "2024-02-19T13:08:14+00:00" + "time": "2024-03-19T09:55:32+00:00" }, { "name": "symfony/cache-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" + "reference": "fee6db04d913094e2fb55ff8e7db5685a8134463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/fee6db04d913094e2fb55ff8e7db5685a8134463", + "reference": "fee6db04d913094e2fb55ff8e7db5685a8134463", "shasum": "" }, "require": { @@ -718,7 +718,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/cache-contracts/tree/v2.5.3" }, "funding": [ { @@ -734,20 +734,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/config", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "0a4f363dc2f13d2f871f917cc563796d9ddc78d1" + "reference": "3dcd47d4bbd9fea4d1210e7a7a0a5ca02d99df14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0a4f363dc2f13d2f871f917cc563796d9ddc78d1", - "reference": "0a4f363dc2f13d2f871f917cc563796d9ddc78d1", + "url": "https://api.github.com/repos/symfony/config/zipball/3dcd47d4bbd9fea4d1210e7a7a0a5ca02d99df14", + "reference": "3dcd47d4bbd9fea4d1210e7a7a0a5ca02d99df14", "shasum": "" }, "require": { @@ -797,7 +797,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.4.36" + "source": "https://github.com/symfony/config/tree/v5.4.38" }, "funding": [ { @@ -813,20 +813,20 @@ "type": "tidelift" } ], - "time": "2024-02-23T16:13:23+00:00" + "time": "2024-03-22T10:04:40+00:00" }, { "name": "symfony/dependency-injection", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "cc1fb237cd0e6da33005062b13b8485deb6e4440" + "reference": "0ba1fa459d284a9398c71afa1cb5d13de025de17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/cc1fb237cd0e6da33005062b13b8485deb6e4440", - "reference": "cc1fb237cd0e6da33005062b13b8485deb6e4440", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/0ba1fa459d284a9398c71afa1cb5d13de025de17", + "reference": "0ba1fa459d284a9398c71afa1cb5d13de025de17", "shasum": "" }, "require": { @@ -886,7 +886,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.4.36" + "source": "https://github.com/symfony/dependency-injection/tree/v5.4.38" }, "funding": [ { @@ -902,20 +902,20 @@ "type": "tidelift" } ], - "time": "2024-02-22T18:43:31+00:00" + "time": "2024-03-18T16:56:51+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", "shasum": "" }, "require": { @@ -953,7 +953,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" }, "funding": [ { @@ -969,20 +969,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-01-24T14:02:46+00:00" }, { "name": "symfony/error-handler", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "90b1d7799bfc1b3ed5f902e8b334eeb7dba537a1" + "reference": "3c1fed45a12718e7e2758eef072677d01a0c91a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/90b1d7799bfc1b3ed5f902e8b334eeb7dba537a1", - "reference": "90b1d7799bfc1b3ed5f902e8b334eeb7dba537a1", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/3c1fed45a12718e7e2758eef072677d01a0c91a4", + "reference": "3c1fed45a12718e7e2758eef072677d01a0c91a4", "shasum": "" }, "require": { @@ -1024,7 +1024,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.36" + "source": "https://github.com/symfony/error-handler/tree/v5.4.38" }, "funding": [ { @@ -1040,7 +1040,7 @@ "type": "tidelift" } ], - "time": "2024-02-22T11:40:53+00:00" + "time": "2024-03-19T10:19:25+00:00" }, { "name": "symfony/event-dispatcher", @@ -1129,16 +1129,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/540f4c73e87fd0c71ca44a6aa305d024ac68cb73", + "reference": "540f4c73e87fd0c71ca44a6aa305d024ac68cb73", "shasum": "" }, "require": { @@ -1188,7 +1188,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.3" }, "funding": [ { @@ -1204,20 +1204,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.35", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086" + "reference": "899330a01056077271e2f614c7b28b0379a671eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086", - "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/899330a01056077271e2f614c7b28b0379a671eb", + "reference": "899330a01056077271e2f614c7b28b0379a671eb", "shasum": "" }, "require": { @@ -1252,7 +1252,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.35" + "source": "https://github.com/symfony/filesystem/tree/v5.4.38" }, "funding": [ { @@ -1268,7 +1268,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-03-21T08:05:07+00:00" }, { "name": "symfony/finder", @@ -1335,16 +1335,16 @@ }, { "name": "symfony/framework-bundle", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "224f69093099a507cf84d8c48ceb29e8653a5896" + "reference": "322b40a1235d85e93b3440cad59c67d73cdb5d9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/224f69093099a507cf84d8c48ceb29e8653a5896", - "reference": "224f69093099a507cf84d8c48ceb29e8653a5896", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/322b40a1235d85e93b3440cad59c67d73cdb5d9f", + "reference": "322b40a1235d85e93b3440cad59c67d73cdb5d9f", "shasum": "" }, "require": { @@ -1465,7 +1465,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.4.36" + "source": "https://github.com/symfony/framework-bundle/tree/v5.4.38" }, "funding": [ { @@ -1481,20 +1481,20 @@ "type": "tidelift" } ], - "time": "2024-02-20T14:48:43+00:00" + "time": "2024-03-15T07:39:49+00:00" }, { "name": "symfony/http-foundation", - "version": "v5.4.35", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928" + "reference": "d8c13d35f68c69e15595fe37fa2c225d11c10f7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f2ab692a22aef1cd54beb893aa0068bdfb093928", - "reference": "f2ab692a22aef1cd54beb893aa0068bdfb093928", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d8c13d35f68c69e15595fe37fa2c225d11c10f7e", + "reference": "d8c13d35f68c69e15595fe37fa2c225d11c10f7e", "shasum": "" }, "require": { @@ -1541,7 +1541,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.35" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.38" }, "funding": [ { @@ -1557,20 +1557,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-03-19T10:19:25+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.37", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "4ef7ed872564852b3c6c15fecf492975a52cbff3" + "reference": "21c32c7c6c32ea8d0f4b8e88a2607a2dc72799e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/4ef7ed872564852b3c6c15fecf492975a52cbff3", - "reference": "4ef7ed872564852b3c6c15fecf492975a52cbff3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/21c32c7c6c32ea8d0f4b8e88a2607a2dc72799e5", + "reference": "21c32c7c6c32ea8d0f4b8e88a2607a2dc72799e5", "shasum": "" }, "require": { @@ -1653,7 +1653,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.37" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.38" }, "funding": [ { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2024-03-04T20:55:44+00:00" + "time": "2024-04-02T19:56:39+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2223,16 +2223,16 @@ }, { "name": "symfony/property-access", - "version": "v5.4.35", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "f1341758d8046cfff0ac748a0cad238f917191d4" + "reference": "b58ea319e56b440b4daaa38201ee63ba9efa44d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/f1341758d8046cfff0ac748a0cad238f917191d4", - "reference": "f1341758d8046cfff0ac748a0cad238f917191d4", + "url": "https://api.github.com/repos/symfony/property-access/zipball/b58ea319e56b440b4daaa38201ee63ba9efa44d5", + "reference": "b58ea319e56b440b4daaa38201ee63ba9efa44d5", "shasum": "" }, "require": { @@ -2284,7 +2284,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.4.35" + "source": "https://github.com/symfony/property-access/tree/v5.4.38" }, "funding": [ { @@ -2300,20 +2300,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-03-18T16:56:51+00:00" }, { "name": "symfony/property-info", - "version": "v5.4.35", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "d30d48f366ad2bfbf521256be85eb1c182c29198" + "reference": "f3e4b84e5a33e655222167894398b671e93322d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/d30d48f366ad2bfbf521256be85eb1c182c29198", - "reference": "d30d48f366ad2bfbf521256be85eb1c182c29198", + "url": "https://api.github.com/repos/symfony/property-info/zipball/f3e4b84e5a33e655222167894398b671e93322d0", + "reference": "f3e4b84e5a33e655222167894398b671e93322d0", "shasum": "" }, "require": { @@ -2375,7 +2375,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.4.35" + "source": "https://github.com/symfony/property-info/tree/v5.4.38" }, "funding": [ { @@ -2391,20 +2391,20 @@ "type": "tidelift" } ], - "time": "2024-01-23T15:43:50+00:00" + "time": "2024-03-21T07:26:31+00:00" }, { "name": "symfony/routing", - "version": "v5.4.37", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "48ae43e443693ddb4e574f7c12f0d17ce287694e" + "reference": "f455f06d4ee7d354d9dcaf7d436532c1f388ee01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/48ae43e443693ddb4e574f7c12f0d17ce287694e", - "reference": "48ae43e443693ddb4e574f7c12f0d17ce287694e", + "url": "https://api.github.com/repos/symfony/routing/zipball/f455f06d4ee7d354d9dcaf7d436532c1f388ee01", + "reference": "f455f06d4ee7d354d9dcaf7d436532c1f388ee01", "shasum": "" }, "require": { @@ -2465,7 +2465,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.4.37" + "source": "https://github.com/symfony/routing/tree/v5.4.38" }, "funding": [ { @@ -2481,20 +2481,20 @@ "type": "tidelift" } ], - "time": "2024-02-27T09:52:32+00:00" + "time": "2024-03-18T16:56:51+00:00" }, { "name": "symfony/serializer", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "05137a513f4c5a5e56ffbcf53847a93284b49f67" + "reference": "978c155c92601227c014be0291b0bf5b58a1204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/05137a513f4c5a5e56ffbcf53847a93284b49f67", - "reference": "05137a513f4c5a5e56ffbcf53847a93284b49f67", + "url": "https://api.github.com/repos/symfony/serializer/zipball/978c155c92601227c014be0291b0bf5b58a1204a", + "reference": "978c155c92601227c014be0291b0bf5b58a1204a", "shasum": "" }, "require": { @@ -2568,7 +2568,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v5.4.36" + "source": "https://github.com/symfony/serializer/tree/v5.4.38" }, "funding": [ { @@ -2584,20 +2584,20 @@ "type": "tidelift" } ], - "time": "2024-02-22T18:40:43+00:00" + "time": "2024-03-19T09:55:32+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", "shasum": "" }, "require": { @@ -2651,7 +2651,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" }, "funding": [ { @@ -2667,7 +2667,7 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-04-21T15:04:16+00:00" }, { "name": "symfony/string", @@ -2757,16 +2757,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90" + "reference": "ae1d949ccc57d3f6662e4256b47ac9fbfa9651ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90", - "reference": "2e9c2b11267119d9c90d6b3fdce5e4e9f15e2e90", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ae1d949ccc57d3f6662e4256b47ac9fbfa9651ae", + "reference": "ae1d949ccc57d3f6662e4256b47ac9fbfa9651ae", "shasum": "" }, "require": { @@ -2826,7 +2826,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.36" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.38" }, "funding": [ { @@ -2842,7 +2842,7 @@ "type": "tidelift" } ], - "time": "2024-02-15T11:19:14+00:00" + "time": "2024-03-19T10:19:25+00:00" }, { "name": "symfony/var-exporter", @@ -3148,16 +3148,16 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "ced299686f41dce890debac69273b47ffe98a40c" + "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", - "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", + "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", "shasum": "" }, "require": { @@ -3168,7 +3168,7 @@ "require-dev": { "phpstan/phpstan": "^1.0", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^6.0" + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", "autoload": { @@ -3192,9 +3192,9 @@ "performance" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" }, "funding": [ { @@ -3210,7 +3210,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T21:32:43+00:00" + "time": "2024-03-26T18:29:49+00:00" }, { "name": "doctrine/instantiator", @@ -3284,16 +3284,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.52.1", + "version": "v3.53.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc" + "reference": "69a19093a9ded8d1baac62ed6c009b8bc148d008" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/6e77207f0d851862ceeb6da63e6e22c01b1587bc", - "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/69a19093a9ded8d1baac62ed6c009b8bc148d008", + "reference": "69a19093a9ded8d1baac62ed6c009b8bc148d008", "shasum": "" }, "require": { @@ -3317,6 +3317,7 @@ }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", + "infection/infection": "^0.27.11", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.11", @@ -3364,7 +3365,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.52.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.53.0" }, "funding": [ { @@ -3372,20 +3373,20 @@ "type": "github" } ], - "time": "2024-03-19T21:02:43+00:00" + "time": "2024-04-08T15:03:00+00:00" }, { "name": "masterminds/html5", - "version": "2.8.1", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf" + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { @@ -3393,7 +3394,7 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, "type": "library", "extra": { @@ -3437,9 +3438,9 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.8.1" + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" }, - "time": "2023-05-10T11:58:31+00:00" + "time": "2024-03-31T07:05:07+00:00" }, { "name": "monolog/monolog", @@ -4099,16 +4100,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.17", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -4182,7 +4183,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -4198,7 +4199,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T13:14:51+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "sebastian/cli-parser", @@ -5554,27 +5555,27 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v6.4.4", + "version": "v7.0.6", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "16ed5bdfd18e14fc7de347c8688e8ac479284222" + "reference": "a014167aa1f66cb9990675840da65609d3e61612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/16ed5bdfd18e14fc7de347c8688e8ac479284222", - "reference": "16ed5bdfd18e14fc7de347c8688e8ac479284222", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/a014167aa1f66cb9990675840da65609d3e61612", + "reference": "a014167aa1f66cb9990675840da65609d3e61612", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5" }, "conflict": { "phpunit/phpunit": "<7.5|9.1.2" }, "require-dev": { "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^5.4|^6.4|^7.0", "symfony/polyfill-php81": "^1.27" }, "bin": [ @@ -5615,7 +5616,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v6.4.4" + "source": "https://github.com/symfony/phpunit-bridge/tree/v7.0.6" }, "funding": [ { @@ -5631,7 +5632,7 @@ "type": "tidelift" } ], - "time": "2024-02-08T14:08:19+00:00" + "time": "2024-03-19T11:57:22+00:00" }, { "name": "symfony/process", @@ -5697,16 +5698,16 @@ }, { "name": "symfony/security-bundle", - "version": "v5.4.37", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "6773ef12fe2671a42f111e31f2c18af18e79c55c" + "reference": "411190ceea7a5711fa0e0cda81a4914d2c4899b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/6773ef12fe2671a42f111e31f2c18af18e79c55c", - "reference": "6773ef12fe2671a42f111e31f2c18af18e79c55c", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/411190ceea7a5711fa0e0cda81a4914d2c4899b0", + "reference": "411190ceea7a5711fa0e0cda81a4914d2c4899b0", "shasum": "" }, "require": { @@ -5780,7 +5781,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v5.4.37" + "source": "https://github.com/symfony/security-bundle/tree/v5.4.38" }, "funding": [ { @@ -5796,20 +5797,20 @@ "type": "tidelift" } ], - "time": "2024-03-01T19:35:15+00:00" + "time": "2024-03-14T13:06:06+00:00" }, { "name": "symfony/security-core", - "version": "v5.4.35", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "3cbacefb2a350ed39950f93c8a054c2eb625fb69" + "reference": "8024815e3ee09dc2235d91006ac969b060efccbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/3cbacefb2a350ed39950f93c8a054c2eb625fb69", - "reference": "3cbacefb2a350ed39950f93c8a054c2eb625fb69", + "url": "https://api.github.com/repos/symfony/security-core/zipball/8024815e3ee09dc2235d91006ac969b060efccbb", + "reference": "8024815e3ee09dc2235d91006ac969b060efccbb", "shasum": "" }, "require": { @@ -5874,7 +5875,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v5.4.35" + "source": "https://github.com/symfony/security-core/tree/v5.4.38" }, "funding": [ { @@ -5890,7 +5891,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-03-19T10:19:25+00:00" }, { "name": "symfony/security-csrf", @@ -6035,16 +6036,16 @@ }, { "name": "symfony/security-http", - "version": "v5.4.36", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "87ee1ea2b86740fc6a0104f165bebbe0b08b66ba" + "reference": "a6856888064791eef77de26dee86fc33e74dfbba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/87ee1ea2b86740fc6a0104f165bebbe0b08b66ba", - "reference": "87ee1ea2b86740fc6a0104f165bebbe0b08b66ba", + "url": "https://api.github.com/repos/symfony/security-http/zipball/a6856888064791eef77de26dee86fc33e74dfbba", + "reference": "a6856888064791eef77de26dee86fc33e74dfbba", "shasum": "" }, "require": { @@ -6101,7 +6102,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v5.4.36" + "source": "https://github.com/symfony/security-http/tree/v5.4.38" }, "funding": [ { @@ -6117,7 +6118,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T16:13:23+00:00" + "time": "2024-03-19T10:19:25+00:00" }, { "name": "symfony/stopwatch", From e9d06e14b1b25d5da7777229c5d1a816b69b1e05 Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 19 Mar 2024 15:21:20 +0100 Subject: [PATCH 3/8] Add Symfony 7.0 to CI --- .github/workflows/continuous-integration.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index d1930cd..2b7d8eb 100755 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -10,7 +10,7 @@ jobs: strategy: matrix: php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] - symfony-version: ['5.4', '6.0', '6.1', '6.2', '6.3', '6.4'] + symfony-version: ['5.4', '6.0', '6.1', '6.2', '6.3', '6.4', '7.0'] test-options: [''] coverage: [false] include: @@ -31,6 +31,8 @@ jobs: symfony-version: '6.3' - php-version: '7.4' symfony-version: '6.4' + - php-version: '7.4' + symfony-version: '7.0' - php-version: '8.0' symfony-version: '6.1' - php-version: '8.0' @@ -39,6 +41,10 @@ jobs: symfony-version: '6.3' - php-version: '8.0' symfony-version: '6.4' + - php-version: '8.0' + symfony-version: '7.0' + - php-version: '8.1' + symfony-version: '7.0' steps: - uses: actions/checkout@v4 From 4f0132676a7d9c93dfa5f15ad605fec191bc11d7 Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 9 Apr 2024 14:00:47 +0200 Subject: [PATCH 4/8] Extract ProblemExceptionNormalizer into AbstractProblemExceptionNormalizer and add Symfony 7 compatible method signature for ProblemExceptionNormalizer::normalize --- .../AbstractProblemExceptionNormalizer.php | 107 ++++++++++++++++++ .../Normalizer/ProblemExceptionNormalizer.php | 93 +++------------ 2 files changed, 121 insertions(+), 79 deletions(-) create mode 100644 src/ExceptionHandling/Normalizer/AbstractProblemExceptionNormalizer.php diff --git a/src/ExceptionHandling/Normalizer/AbstractProblemExceptionNormalizer.php b/src/ExceptionHandling/Normalizer/AbstractProblemExceptionNormalizer.php new file mode 100644 index 0000000..a42cd9e --- /dev/null +++ b/src/ExceptionHandling/Normalizer/AbstractProblemExceptionNormalizer.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer; + +use Nijens\OpenapiBundle\ExceptionHandling\Exception\ProblemExceptionInterface; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Symfony\Component\Serializer\Exception\LogicException; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; +use Throwable; + +/** + * Normalizes a {@see Throwable} implementing the {@see ProblemExceptionInterface}. + * + * @author Niels Nijens + */ +abstract class AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface +{ + use NormalizerAwareTrait; + + private const ALREADY_CALLED = 'nijens_openapi.problem_exception_normalizer.already_called'; + + /** + * @var bool + */ + private $debug; + + public function __construct(bool $debug = false) + { + $this->debug = $debug; + } + + protected function doNormalize($object, $format = null, array $context = []): array + { + if ($object instanceof ProblemExceptionInterface === false) { + throw new InvalidArgumentException(sprintf('The object must implement "%s".', ProblemExceptionInterface::class)); + } + + if (isset($context[self::ALREADY_CALLED])) { + throw new LogicException(sprintf('The normalizer "%s" can only be called once.', get_class($this))); + } + + $context[self::ALREADY_CALLED] = true; + + $data = $this->normalizer->normalize($object, $format, $context); + + $this->removeDetailsToPreventInformationDisclosure($object, $data); + + return $this->unsetKeysWithNullValue($data); + } + + public function supportsNormalization($data, $format = null, array $context = []): bool + { + if (isset($context[self::ALREADY_CALLED])) { + return false; + } + + return $data instanceof ProblemExceptionInterface; + } + + public function getSupportedTypes(?string $format): array + { + return [ + ProblemExceptionInterface::class => false, + ]; + } + + private function removeDetailsToPreventInformationDisclosure(ProblemExceptionInterface $object, array &$data): void + { + if ($this->debug) { + return; + } + + if ($object->getPrevious() === null || $object->getPrevious() instanceof HttpExceptionInterface) { + return; + } + + unset($data['detail']); + } + + private function unsetKeysWithNullValue(array $data): array + { + foreach ($data as $key => $value) { + if (is_array($value)) { + $data[$key] = $this->unsetKeysWithNullValue($value); + } + + if ($value === null) { + unset($data[$key]); + } + } + + return $data; + } +} diff --git a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php index 66003cf..53d89be 100644 --- a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php +++ b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php @@ -14,11 +14,8 @@ namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer; use Nijens\OpenapiBundle\ExceptionHandling\Exception\ProblemExceptionInterface; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; -use Symfony\Component\Serializer\Exception\LogicException; +use Nijens\OpenapiBundle\NijensOpenapiBundle; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; -use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Throwable; /** @@ -26,85 +23,23 @@ * * @author Niels Nijens */ -final class ProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface -{ - use NormalizerAwareTrait; - - private const ALREADY_CALLED = 'nijens_openapi.problem_exception_normalizer.already_called'; - - /** - * @var bool - */ - private $debug; - - public function __construct(bool $debug = false) - { - $this->debug = $debug; - } - - /** - * @return array - */ - public function normalize($object, $format = null, array $context = []) - { - if ($object instanceof ProblemExceptionInterface === false) { - throw new InvalidArgumentException(sprintf('The object must implement "%s".', ProblemExceptionInterface::class)); - } - - if (isset($context[self::ALREADY_CALLED])) { - throw new LogicException(sprintf('The normalizer "%s" can only be called once.', self::class)); - } - - $context[self::ALREADY_CALLED] = true; - - $data = $this->normalizer->normalize($object, $format, $context); - - $this->removeDetailsToPreventInformationDisclosure($object, $data); - - return $this->unsetKeysWithNullValue($data); - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (NijensOpenapiBundle::getSymfonyVersion() < 70000) { + final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface { - if (isset($context[self::ALREADY_CALLED])) { - return false; + /** + * @return array + */ + public function normalize($object, $format = null, array $context = []): float|int|bool|\ArrayObject|array|string|null + { + return $this->doNormalize($object, $format, $context); } - - return $data instanceof ProblemExceptionInterface; - } - - public function getSupportedTypes(?string $format): array - { - return [ - ProblemExceptionInterface::class => false, - ]; } - - private function removeDetailsToPreventInformationDisclosure(ProblemExceptionInterface $object, array &$data): void +} else { + final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface { - if ($this->debug) { - return; - } - - if ($object->getPrevious() === null || $object->getPrevious() instanceof HttpExceptionInterface) { - return; + public function normalize($object, $format = null, array $context = []): array + { + return $this->doNormalize($object, $format, $context); } - - unset($data['detail']); - } - - private function unsetKeysWithNullValue(array $data): array - { - foreach ($data as $key => $value) { - if (is_array($value)) { - $data[$key] = $this->unsetKeysWithNullValue($value); - } - - if ($value === null) { - unset($data[$key]); - } - } - - return $data; } } From e6e89bb243bc45cb7480619e8eedfc9d813e0b33 Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 9 Apr 2024 15:14:03 +0200 Subject: [PATCH 5/8] Add compatibility for HttpKernelInterface::MAIN_REQUEST and HttpKernelInterface::MASTER_REQUEST in tests --- .../JsonRequestBodyDeserializationSubscriberTest.php | 6 +++++- .../EventSubscriber/RequestValidationSubscriberTest.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/Deserialization/EventSubscriber/JsonRequestBodyDeserializationSubscriberTest.php b/tests/Deserialization/EventSubscriber/JsonRequestBodyDeserializationSubscriberTest.php index 4aaaef6..d53319b 100644 --- a/tests/Deserialization/EventSubscriber/JsonRequestBodyDeserializationSubscriberTest.php +++ b/tests/Deserialization/EventSubscriber/JsonRequestBodyDeserializationSubscriberTest.php @@ -137,6 +137,10 @@ private function createRequestEvent(Request $request): RequestEvent { $kernelMock = $this->createMock(HttpKernelInterface::class); - return new RequestEvent($kernelMock, $request, HttpKernelInterface::MASTER_REQUEST); + return new RequestEvent( + $kernelMock, + $request, + defined('Symfony\Component\HttpKernel\HttpKernelInterface::MAIN_REQUEST') ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST + ); } } diff --git a/tests/Validation/EventSubscriber/RequestValidationSubscriberTest.php b/tests/Validation/EventSubscriber/RequestValidationSubscriberTest.php index 5d75bbc..846aaf0 100644 --- a/tests/Validation/EventSubscriber/RequestValidationSubscriberTest.php +++ b/tests/Validation/EventSubscriber/RequestValidationSubscriberTest.php @@ -137,6 +137,10 @@ private function createRequestEvent(Request $request): RequestEvent { $kernelMock = $this->createMock(HttpKernelInterface::class); - return new RequestEvent($kernelMock, $request, HttpKernelInterface::MASTER_REQUEST); + return new RequestEvent( + $kernelMock, + $request, + defined('Symfony\Component\HttpKernel\HttpKernelInterface::MAIN_REQUEST') ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST + ); } } From 0b92d23e7f08728cf0eeed27df437c2a107be03b Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 9 Apr 2024 15:19:12 +0200 Subject: [PATCH 6/8] Change ErrorResponsesTest::testCanReturnProblemJsonObjectForThrownError to be Symfony 7 compatible --- .../ExceptionHandling/ErrorResponsesTest.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/Functional/ExceptionHandling/ErrorResponsesTest.php b/tests/Functional/ExceptionHandling/ErrorResponsesTest.php index 4458fce..29ff31d 100644 --- a/tests/Functional/ExceptionHandling/ErrorResponsesTest.php +++ b/tests/Functional/ExceptionHandling/ErrorResponsesTest.php @@ -13,6 +13,7 @@ namespace Nijens\OpenapiBundle\Tests\Functional\ExceptionHandling; +use Nijens\OpenapiBundle\NijensOpenapiBundle; use RuntimeException; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -57,14 +58,16 @@ public function testCanReturnProblemJsonObjectForTriggeredError(): void public function testCanReturnProblemJsonObjectForThrownError(): void { - /* - * Insulating the client to prevent PHPUnit from catching the error before - * the ThrowableToProblemExceptionSubscriber and ProblemExceptionToJsonResponseSubscriber. - */ - $this->client->insulate(); + if (NijensOpenapiBundle::getSymfonyVersion() < 70000) { + /* + * Insulating the client to prevent PHPUnit from catching the error before + * the ThrowableToProblemExceptionSubscriber and ProblemExceptionToJsonResponseSubscriber. + */ + $this->client->insulate(); - $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('OUTPUT: {"type":"about:blank","title":"An error occurred.","status":500,"detail":"This is an error thrown by the OpenAPI bundle test suite."} ERROR OUTPUT: .'); + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('OUTPUT: {"type":"about:blank","title":"An error occurred.","status":500,"detail":"This is an error thrown by the OpenAPI bundle test suite."} ERROR OUTPUT: .'); + } $this->client->request( Request::METHOD_GET, @@ -75,6 +78,12 @@ public function testCanReturnProblemJsonObjectForThrownError(): void 'CONTENT_TYPE' => 'application/json', ] ); + + static::assertResponseStatusCodeSame(Response::HTTP_INTERNAL_SERVER_ERROR); + static::assertJsonStringEqualsJsonString( + '{"type":"about:blank","title":"An error occurred.","status":500,"detail":"This is an error thrown by the OpenAPI bundle test suite."}', + $this->client->getResponse()->getContent() + ); } public function testCanReturnProblemJsonObjectForThrownHttpException(): void From 2d40beee942f18ec78e64cbe7b6bf86181f43d45 Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 9 Apr 2024 15:34:34 +0200 Subject: [PATCH 7/8] Fix code style of ProblemExceptionNormalizer --- .../Normalizer/ProblemExceptionNormalizer.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php index 53d89be..d17c2d3 100644 --- a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php +++ b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php @@ -13,12 +13,11 @@ namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer; -use Nijens\OpenapiBundle\ExceptionHandling\Exception\ProblemExceptionInterface; +use ArrayObject; use Nijens\OpenapiBundle\NijensOpenapiBundle; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; -use Throwable; -/** +/* * Normalizes a {@see Throwable} implementing the {@see ProblemExceptionInterface}. * * @author Niels Nijens @@ -29,7 +28,7 @@ final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalize /** * @return array */ - public function normalize($object, $format = null, array $context = []): float|int|bool|\ArrayObject|array|string|null + public function normalize($object, $format = null, array $context = []) { return $this->doNormalize($object, $format, $context); } @@ -37,7 +36,7 @@ public function normalize($object, $format = null, array $context = []): float|i } else { final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface { - public function normalize($object, $format = null, array $context = []): array + public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null { return $this->doNormalize($object, $format, $context); } From f06c4aa0c742173f24305ce8a31f3f0d638561cd Mon Sep 17 00:00:00 2001 From: Niels Nijens Date: Tue, 9 Apr 2024 16:09:18 +0200 Subject: [PATCH 8/8] Split ProblemExceptionNormalizer forward-compatibilityinto separate file to be PHP 7.4 compatible --- .../Normalizer/ProblemExceptionNormalizer.php | 9 +----- .../ProblemExceptionNormalizer.php8 | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php8 diff --git a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php index d17c2d3..f668e26 100644 --- a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php +++ b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php @@ -13,7 +13,6 @@ namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer; -use ArrayObject; use Nijens\OpenapiBundle\NijensOpenapiBundle; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; @@ -34,11 +33,5 @@ public function normalize($object, $format = null, array $context = []) } } } else { - final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface - { - public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null - { - return $this->doNormalize($object, $format, $context); - } - } + require_once __DIR__.'/ProblemExceptionNormalizer.php8'; } diff --git a/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php8 b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php8 new file mode 100644 index 0000000..a114bac --- /dev/null +++ b/src/ExceptionHandling/Normalizer/ProblemExceptionNormalizer.php8 @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Nijens\OpenapiBundle\ExceptionHandling\Normalizer; + +use ArrayObject; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; + +/** + * Normalizes a {@see Throwable} implementing the {@see ProblemExceptionInterface}. + * + * @author Niels Nijens + */ +final class ProblemExceptionNormalizer extends AbstractProblemExceptionNormalizer implements NormalizerInterface, NormalizerAwareInterface +{ + public function normalize($object, $format = null, array $context = []): float|int|bool|ArrayObject|array|string|null + { + return $this->doNormalize($object, $format, $context); + } +}