From 029417812f26b5cd52a74232e85155e4712e38a7 Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 4 Dec 2024 19:11:27 +0200 Subject: [PATCH 1/7] :package: Add explicit dependency to supported version of `symfony/config` --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 5e47330..73ed6c9 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "ext-json": "*", "thecodingmachine/graphqlite" : "^6.0", "thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0", + "symfony/config": "^6", "symfony/framework-bundle": "^6", "symfony/validator": "^6", "symfony/translation": "^6", From e7cbdd1d70b3e14b2f410dfd0ceb016d22ffe91d Mon Sep 17 00:00:00 2001 From: Andrii Date: Sun, 17 Nov 2024 01:05:40 +0200 Subject: [PATCH 2/7] :package: Don't enable security bundle with no configs - deprecated since Symfony 6.3 --- Tests/GraphQLiteTestingKernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/GraphQLiteTestingKernel.php b/Tests/GraphQLiteTestingKernel.php index 5939922..2966dec 100644 --- a/Tests/GraphQLiteTestingKernel.php +++ b/Tests/GraphQLiteTestingKernel.php @@ -87,7 +87,7 @@ public function __construct(bool $enableSession = true, public function registerBundles(): iterable { $bundles = [ new FrameworkBundle() ]; - if (class_exists(SecurityBundle::class)) { + if ($this->enableSecurity && class_exists(SecurityBundle::class)) { $bundles[] = new SecurityBundle(); } $bundles[] = new GraphQLiteBundle(); From 5af2cf5ca8435d96f09aec06f02ab6bfb14cd1cd Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 4 Dec 2024 20:04:40 +0200 Subject: [PATCH 3/7] :package: Make bundle compatible with Symfony 7 --- DependencyInjection/Configuration.php | 5 +---- Tests/GraphQLiteTestingKernel.php | 12 +++++++++--- composer.json | 19 ++++++++++--------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 21a29b1..1991328 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -8,10 +8,7 @@ class Configuration implements ConfigurationInterface { - /** - * @return TreeBuilder - */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('graphqlite'); $rootNode = $treeBuilder->getRootNode(); diff --git a/Tests/GraphQLiteTestingKernel.php b/Tests/GraphQLiteTestingKernel.php index 2966dec..5ec06d1 100644 --- a/Tests/GraphQLiteTestingKernel.php +++ b/Tests/GraphQLiteTestingKernel.php @@ -4,6 +4,8 @@ namespace TheCodingMachine\GraphQLite\Bundle\Tests; +use Composer\InstalledVersions; +use Composer\Semver\VersionParser; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\SecurityBundle\SecurityBundle; @@ -118,8 +120,12 @@ public function configureContainer(ContainerBuilder $c, LoaderInterface $loader) $container->loadFromExtension('framework', $frameworkConf); if ($this->enableSecurity) { - $container->loadFromExtension('security', array( - 'enable_authenticator_manager' => true, + $extraConfig = []; + if (InstalledVersions::satisfies(new VersionParser(), 'symfony/security-bundle', '< 7.0.0')) { + $extraConfig['enable_authenticator_manager'] = true; + } + + $container->loadFromExtension('security', array_merge(array( 'providers' => [ 'in_memory' => [ 'memory' => [ @@ -150,7 +156,7 @@ public function configureContainer(ContainerBuilder $c, LoaderInterface $loader) 'password_hashers' => [ InMemoryUser::class => 'plaintext', ], - )); + ), $extraConfig)); } $graphqliteConf = array( diff --git a/composer.json b/composer.json index 73ed6c9..e363144 100644 --- a/composer.json +++ b/composer.json @@ -20,26 +20,27 @@ "ext-json": "*", "thecodingmachine/graphqlite" : "^6.0", "thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0", - "symfony/config": "^6", - "symfony/framework-bundle": "^6", - "symfony/validator": "^6", - "symfony/translation": "^6", + "symfony/config": "^6 || ^7", + "symfony/console": "^6 || ^7", + "symfony/framework-bundle": "^6 || ^7", + "symfony/validator": "^6 || ^7", + "symfony/translation": "^6 || ^7", "doctrine/annotations": "^1.13 || ^2.0.1", "symfony/psr-http-message-bridge": "^2.0", "nyholm/psr7": "^1.1", "laminas/laminas-diactoros": "^2.2.2", "overblog/graphiql-bundle": "^0.2 || ^0.3", - "thecodingmachine/cache-utils": "^1", - "symfony/console": "^6" + "thecodingmachine/cache-utils": "^1" }, "require-dev": { - "symfony/security-bundle": "^6", - "symfony/yaml": "^6", + "symfony/security-bundle": "^6 || ^7", + "symfony/yaml": "^6 || ^7", "beberlei/porpaginas": "^1.2 || ^2.0", "php-coveralls/php-coveralls": "^2.1.0", "symfony/phpunit-bridge": "^6 || ^7", "phpstan/phpstan": "^1.8", - "composer/package-versions-deprecated": "^1.8" + "composer/package-versions-deprecated": "^1.8", + "composer/semver": "^3.4" }, "conflict": { "mouf/classname-mapper": "<1.0.2", From afb902dbcef8fa7622d39a5f612e29ec629c9692 Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 4 Dec 2024 20:09:53 +0200 Subject: [PATCH 4/7] :package: Support only Symfony 6.4+ and 7.0+ to simplify maintaining both versions compatibility --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index e363144..f53e148 100644 --- a/composer.json +++ b/composer.json @@ -20,11 +20,11 @@ "ext-json": "*", "thecodingmachine/graphqlite" : "^6.0", "thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0", - "symfony/config": "^6 || ^7", - "symfony/console": "^6 || ^7", - "symfony/framework-bundle": "^6 || ^7", - "symfony/validator": "^6 || ^7", - "symfony/translation": "^6 || ^7", + "symfony/config": "^6.4 || ^7", + "symfony/console": "^6.4 || ^7", + "symfony/framework-bundle": "^6.4 || ^7", + "symfony/validator": "^6.4 || ^7", + "symfony/translation": "^6.4 || ^7", "doctrine/annotations": "^1.13 || ^2.0.1", "symfony/psr-http-message-bridge": "^2.0", "nyholm/psr7": "^1.1", @@ -33,11 +33,11 @@ "thecodingmachine/cache-utils": "^1" }, "require-dev": { - "symfony/security-bundle": "^6 || ^7", - "symfony/yaml": "^6 || ^7", + "symfony/security-bundle": "^6.4 || ^7", + "symfony/yaml": "^6.4 || ^7", "beberlei/porpaginas": "^1.2 || ^2.0", "php-coveralls/php-coveralls": "^2.1.0", - "symfony/phpunit-bridge": "^6 || ^7", + "symfony/phpunit-bridge": "^6.4 || ^7", "phpstan/phpstan": "^1.8", "composer/package-versions-deprecated": "^1.8", "composer/semver": "^3.4" From b138242b061423f8b9d7905e1f05e1ada52cb136 Mon Sep 17 00:00:00 2001 From: Andrii Date: Thu, 5 Dec 2024 09:49:48 +0200 Subject: [PATCH 5/7] :package: Fix phpstan issues with `symfony/http-kernel` v7 --- GraphQLiteBundle.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GraphQLiteBundle.php b/GraphQLiteBundle.php index 3de2289..b9005ab 100644 --- a/GraphQLiteBundle.php +++ b/GraphQLiteBundle.php @@ -21,9 +21,9 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new OverblogGraphiQLEndpointWiringPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -1); } - public function getContainerExtension(): ?ExtensionInterface + public function getContainerExtension(): ExtensionInterface { - if (null === $this->extension) { + if (null === $this->extension || false === $this->extension) { $this->extension = new GraphQLiteExtension(); } From d44bf1dfddb3602932b8e33bca19dd35fb585a06 Mon Sep 17 00:00:00 2001 From: Andrii Date: Thu, 5 Dec 2024 09:50:25 +0200 Subject: [PATCH 6/7] :package: Add support for `overblog/graphiql-bundle` v1 This unlocks update for more Symfony components to v7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f53e148..2136d0c 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "symfony/psr-http-message-bridge": "^2.0", "nyholm/psr7": "^1.1", "laminas/laminas-diactoros": "^2.2.2", - "overblog/graphiql-bundle": "^0.2 || ^0.3", + "overblog/graphiql-bundle": "^0.2 || ^0.3 || ^1", "thecodingmachine/cache-utils": "^1" }, "require-dev": { From aa40cfe1dc05516f0dfda754094de0b38771e753 Mon Sep 17 00:00:00 2001 From: Andrii Date: Thu, 5 Dec 2024 09:53:13 +0200 Subject: [PATCH 7/7] :package: Add support for `symfony/psr-http-message-bridge` v7 This unlocks update for more Symfony components to v7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2136d0c..9251be4 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "symfony/validator": "^6.4 || ^7", "symfony/translation": "^6.4 || ^7", "doctrine/annotations": "^1.13 || ^2.0.1", - "symfony/psr-http-message-bridge": "^2.0", + "symfony/psr-http-message-bridge": "^2.0 || ^7.0", "nyholm/psr7": "^1.1", "laminas/laminas-diactoros": "^2.2.2", "overblog/graphiql-bundle": "^0.2 || ^0.3 || ^1",