Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.3']
php-version: ['8.3', '8.4', '8.5']
symfony-version: ['6.4.*', '7.*', '8.*']

steps:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.1.0

- extend php version support
- add support php v8.3+
- integrate ampphp executor

3.0.0

- Upgrade base lib to 3.0 with breaking changes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Symfony bundle for [Flexible Graphql PHP](https://github.com/axtiva/flexible-gra
- Fast integration to any project without breaking changes
- Lazy loading on schema definition
- Apollo Federation Support
- Amphp v3 support for async executions
- Executable directives
- Support symfony native opcache preload file generation

Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"require": {
"php": "^8.3",
"axtiva/flexible-graphql-php": "^3.0.1",
"axtiva/flexible-graphql-php": "^3.0.2",
"symfony/console": "^6.4 | ^7.0 | ^8.0",
"symfony/config": "^6.4 | ^7.0 | ^8.0",
"symfony/dependency-injection": "^6.4 | ^7.0 | ^8.0",
Expand All @@ -26,6 +26,10 @@
},
"require-dev": {
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^12"
"phpunit/phpunit": "^12",
"amphp/amp": "^3"
},
"suggest": {
"amphp/amp": "Needed for async execution support"
}
}
2 changes: 1 addition & 1 deletion src/Command/GenerateFieldResolverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
$this->codeGeneratorBuilder = $codeGeneratorBuilder;
}

protected function configure()
protected function configure(): void
{
$this
->setDescription('generate field resolver')
Expand Down
2 changes: 1 addition & 1 deletion src/Command/GenerateScalarResolverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
$this->codeGeneratorBuilder = $codeGeneratorBuilder;
}

protected function configure()
protected function configure(): void
{
$this
->setDescription('generate custom scalar resolver')
Expand Down
2 changes: 1 addition & 1 deletion src/Command/GenerateTypeRegistryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
$this->codeGeneratorBuilder = $codeGeneratorBuilder;
}

protected function configure()
protected function configure(): void
{
$this
->setDescription('generate type registry class for lazy load schema')
Expand Down
8 changes: 4 additions & 4 deletions src/DependencyInjection/FlexibleGraphqlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,28 @@ private function registerCommands(array $config, ContainerBuilder $container): v
new Reference(TypeRegistryGeneratorBuilderInterface::class),
new Reference(CodeGeneratorBuilderInterface::class),
])
->addTag('console.command', ['command' => GenerateTypeRegistryCommand::getDefaultName()]);
->addTag('console.command');

$container->register(GenerateDirectiveResolverCommand::class)
->setArguments([
$config['schema_files'],
new Reference(CodeGeneratorBuilderInterface::class),
])
->addTag('console.command', ['command' => GenerateDirectiveResolverCommand::getDefaultName()]);
->addTag('console.command');

$container->register(GenerateFieldResolverCommand::class)
->setArguments([
$config['schema_files'],
new Reference(CodeGeneratorBuilderInterface::class),
])
->addTag('console.command', ['command' => GenerateFieldResolverCommand::getDefaultName()]);
->addTag('console.command');

$container->register(GenerateScalarResolverCommand::class)
->setArguments([
$config['schema_files'],
new Reference(CodeGeneratorBuilderInterface::class),
])
->addTag('console.command', ['command' => GenerateScalarResolverCommand::getDefaultName()]);
->addTag('console.command');
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/DependencyInjection/FlexibleGraphqlExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static function provideBuilderVariants(): iterable
{
yield 'sync graphql' => ['graphql', 'sync', TypeRegistryGeneratorBuilder::class, null];
yield 'amphp v2 graphql' => ['graphql', 'amphp_v2', TypeRegistryGeneratorBuilder::class, TypeRegistryGeneratorBuilderAmphpV2::class];
yield 'amphp v3 graphql' => ['graphql', 'amphp_v3', TypeRegistryGeneratorBuilder::class, TypeRegistryGeneratorBuilderAmphp::class];
yield 'amphp v3 federation' => ['federation', 'amphp_v3', TypeRegistryGeneratorBuilderFederated::class, TypeRegistryGeneratorBuilderAmphp::class];
}

Expand Down
17 changes: 16 additions & 1 deletion tests/E2e/FixtureAppConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ public function testFixtureAppGenerationSupportsConfigurationVariantsAndFederati
self::assertStringContainsString('directive_federation__shareable', $registryCode);
}

public function testFixtureAppGenerationSupportsAmphpV3Executor(): void
{
$registryFile = self::fixtureAppDir() . '/var/generated/TypeRegistry.php';

$this->runConsoleCommand('flexible_graphql:generate-type-registry', [
'FLEXIBLE_GRAPHQL_EXECUTOR' => 'amphp_v3',
'FLEXIBLE_GRAPHQL_SCHEMA_TYPE' => 'graphql',
]);
self::assertFileExists($registryFile);

$registryCode = (string) file_get_contents($registryFile);
self::assertStringContainsString('\Amp\async(', $registryCode, 'AMP v3 executor must wrap resolvers with \Amp\async()');
self::assertStringNotContainsString('\Amp\call(', $registryCode, 'AMP v3 executor must not use \Amp\call() (that is the v2 API)');
self::assertStringContainsString('ServiceCollectionInterface', $registryCode);
}

public function testGeneratedTypeRegistryUsesScopedLocatorOnly(): void
{
$registryFile = self::fixtureAppDir() . '/var/generated/TypeRegistry.php';
Expand All @@ -84,7 +100,6 @@ public function testGeneratedTypeRegistryUsesScopedLocatorOnly(): void
self::assertSame(ServiceCollectionInterface::class, $constructorType->getName());

$getService = new ReflectionMethod($registryClass, 'getService');
$getService->setAccessible(true);

self::assertIsObject($getService->invoke($registry, $serviceId));

Expand Down
Loading