Skip to content

Commit

Permalink
Merge pull request #227 from andrew-demb/support-symfony-7
Browse files Browse the repository at this point in the history
Support Symfony 7
  • Loading branch information
andrew-demb authored Dec 31, 2024
2 parents c6f7149 + aa40cfe commit 4661c25
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
5 changes: 1 addition & 4 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

class Configuration implements ConfigurationInterface
{
/**
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('graphqlite');
$rootNode = $treeBuilder->getRootNode();
Expand Down
4 changes: 2 additions & 2 deletions GraphQLiteBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
14 changes: 10 additions & 4 deletions Tests/GraphQLiteTestingKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,7 +89,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();
Expand Down Expand Up @@ -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' => [
Expand Down Expand Up @@ -150,7 +156,7 @@ public function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
'password_hashers' => [
InMemoryUser::class => 'plaintext',
],
));
), $extraConfig));
}

$graphqliteConf = array(
Expand Down
24 changes: 13 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,27 @@
"ext-json": "*",
"thecodingmachine/graphqlite" : "^6.0",
"thecodingmachine/graphqlite-symfony-validator-bridge" : "^6.0",
"symfony/framework-bundle": "^6",
"symfony/validator": "^6",
"symfony/translation": "^6",
"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",
"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",
"thecodingmachine/cache-utils": "^1",
"symfony/console": "^6"
"overblog/graphiql-bundle": "^0.2 || ^0.3 || ^1",
"thecodingmachine/cache-utils": "^1"
},
"require-dev": {
"symfony/security-bundle": "^6",
"symfony/yaml": "^6",
"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/package-versions-deprecated": "^1.8",
"composer/semver": "^3.4"
},
"conflict": {
"mouf/classname-mapper": "<1.0.2",
Expand Down

0 comments on commit 4661c25

Please sign in to comment.