Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9304a6e
adding symfony8 to supported list
achertovsky Jan 26, 2026
c56bdce
one more exclude, monolog bump
achertovsky Jan 26, 2026
205dbed
bump doctrine
achertovsky Jan 26, 2026
4eed432
doctrine annotations also
achertovsky Jan 26, 2026
53063a6
Revert "doctrine annotations also"
achertovsky Jan 26, 2026
a885336
annotations 2.0 once more
achertovsky Jan 26, 2026
09513a4
opt-out from annotation if doctrine/orm >= 3
Nyholm Jan 26, 2026
12a316a
fix: bridge
Nyholm Jan 26, 2026
955125f
eliminate phpstan concenrns
achertovsky Jan 27, 2026
5cb5226
trying to make validation tests pass
achertovsky Jan 27, 2026
779fdcb
Revert "trying to make validation tests pass"
achertovsky Jan 28, 2026
e7b080f
do not skip tests
achertovsky Jan 28, 2026
e2ebc08
Revert "do not skip tests"
achertovsky Jan 28, 2026
39fdcd5
monolog bump
achertovsky Jan 28, 2026
b7a048f
Revert "Revert "trying to make validation tests pass""
achertovsky Jan 28, 2026
caa61b3
Revert "Revert "Revert "trying to make validation tests pass"""
achertovsky Jan 28, 2026
31a2b15
works for php8.4, sf8
achertovsky Jan 28, 2026
ca65eb4
cq
achertovsky Jan 28, 2026
6b8fb8e
cleanup
achertovsky Jan 28, 2026
a5078b8
proper order is now, hmmm ...
achertovsky Jan 28, 2026
8610f32
reduce tests scope
achertovsky Jan 28, 2026
a53de4b
cq
achertovsky Jan 28, 2026
53b01a9
exclude phps prior to 8.4 from testing with sf8
achertovsky Jan 28, 2026
760f103
apply sorting on responses before comparing
achertovsky Jan 28, 2026
6fa6b82
do not test sf7 with 8.1
achertovsky Jan 28, 2026
236e050
exclude 7.2 lowest deps as issue with sorting in tests
achertovsky Jan 28, 2026
27d20fc
sf8 one more exclude
achertovsky Jan 28, 2026
f5f6327
fix CI config
Nyholm Jan 28, 2026
fd68937
handle parameters by name
Nyholm Jan 28, 2026
c80aefe
revert index.md
Nyholm Jan 28, 2026
0000ed0
fix cs and cleanup
Nyholm Jan 28, 2026
480e117
collect coverage information from 2 jobs
Nyholm Jan 28, 2026
7c2d0a4
fix cs
Nyholm Jan 28, 2026
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ jobs:
- php-version: '8.1'
symfony-version: '7.4.*'
include:
- php-version: '8.4'
symfony-version: '8.0.*'
dependencies: 'lowest'
- php-version: '8.4'
symfony-version: '8.0.*'
dependencies: 'highest'
coverage: 'pcov'
- php-version: '8.2'
symfony-version: '5.4.*'
dependencies: 'lowest'
Expand Down
48 changes: 24 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"phpdocumentor/reflection-docblock": "^5.2",
"phpdocumentor/type-resolver": "^1.6.1",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/config": "^5.4.46 || ^6.4.32 || ^7.0",
"symfony/dependency-injection": "^5.4.48 || ^6.4.32 || ^7.0",
"symfony/event-dispatcher": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/expression-language": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/framework-bundle": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/http-foundation": "^5.4.50 || ^6.4.32 || ^7.0",
"symfony/http-kernel": "^5.4.50 || ^6.4.32 || ^7.0",
"symfony/options-resolver": "^5.4.45 || ^6.4.30 || ^7.0",
"symfony/property-access": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/config": "^5.4.46 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/dependency-injection": "^5.4.48 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/event-dispatcher": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/expression-language": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/framework-bundle": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/http-foundation": "^5.4.50 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/http-kernel": "^5.4.50 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/options-resolver": "^5.4.45 || ^6.4.30 || ^7.0 || ^8.0",
"symfony/property-access": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"webonyx/graphql-php": "^15.24"
},
"suggest": {
Expand All @@ -56,8 +56,8 @@
"symfony/translation": "If you want validation error messages to be translated."
},
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/orm": "^2.5",
"doctrine/annotations": "^1.14|^2.0",
"doctrine/orm": "^2.20.9 || ^3.6",
"monolog/monolog": "^2.8.0 || ^3.0",
"php-cs-fixer/shim": "^3.93",
"phpstan/extension-installer": "^1.0",
Expand All @@ -66,20 +66,20 @@
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^10.5.63",
"react/promise": "^2.5",
"symfony/asset": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/browser-kit": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/console": "^5.4.47 || ^6.4.32 || ^7.0",
"symfony/css-selector": "^5.4.45 || ^6.4.24 || ^7.0",
"symfony/dom-crawler": "^5.4.48 || ^6.4.32 || ^7.0",
"symfony/finder": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/monolog-bundle": "^3.7",
"symfony/asset": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/browser-kit": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/console": "^5.4.47 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/css-selector": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/dom-crawler": "^5.4.48 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/finder": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/monolog-bundle": "^3.7 || ^4.0",
"symfony/phpunit-bridge": "^7.4.3",
"symfony/process": "^5.4.47 || ^6.4.32 || ^7.0",
"symfony/routing": "^5.4.48 || ^6.4.32 || ^7.0",
"symfony/security-bundle": "^5.4.45 || ^6.4.32 || ^7.0",
"symfony/validator": "^5.4.48 || ^6.4.31 || ^7.0",
"symfony/var-dumper": "^5.4.48 || ^6.4.32 || ^7.0",
"symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.0",
"symfony/process": "^5.4.47 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/routing": "^5.4.48 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/security-bundle": "^5.4.45 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/validator": "^5.4.48 || ^6.4.31 || ^7.0 || ^8.0",
"symfony/var-dumper": "^5.4.48 || ^6.4.32 || ^7.0 || ^8.0",
"symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.0 || ^8.0",
"twig/twig": "^2.10|^3.0"
},
"conflict": {
Expand Down
19 changes: 19 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -590,3 +590,22 @@ parameters:
count: 1
path: tests/Relay/Connection/Output/DeprecatedPropertyPublicAccessTraitTest.php

-
message: "#^Call to function method_exists\\(\\) with '.*AnnotationRegistry' and 'registerLoader' will always evaluate to false\\.$#"
count: 1
path: src/Config/Parser/AnnotationParser.php

-
message: "#^Call to an undefined static method Doctrine\\\\Common\\\\Annotations\\\\AnnotationRegistry\\:\\:registerLoader\\(\\)\\.$#"
count: 1
path: src/Config/Parser/AnnotationParser.php

-
message: "#^Method Overblog\\\\GraphQLBundle\\\\Config\\\\Parser\\\\MetadataParser\\\\TypeGuesser\\\\DoctrineTypeGuesser\\:\\:getAnnotation\\(\\) has invalid return type Doctrine\\\\ORM\\\\Mapping\\\\Annotation\\.$#"
count: 1
path: src/Config/Parser/MetadataParser/TypeGuesser/DoctrineTypeGuesser.php

-
message: "#^PHPDoc tag @var for variable \\$annotation contains unknown class Doctrine\\\\ORM\\\\Mapping\\\\Annotation\\.$#"
count: 1
path: src/Config/Parser/MetadataParser/TypeGuesser/DoctrineTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public function getName(): string

public function supports(Reflector $reflector): bool
{
return $reflector instanceof ReflectionProperty;
// If we are on doctrine/orm v2
return class_exists(\Doctrine\ORM\Version::class) && $reflector instanceof ReflectionProperty;
}

/**
Expand Down
32 changes: 31 additions & 1 deletion src/Generator/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
use Overblog\GraphQLBundle\Generator\Converter\ExpressionConverter;
use Overblog\GraphQLBundle\Generator\Exception\GeneratorException;
use Overblog\GraphQLBundle\Validator\InputValidator;
use ReflectionClass;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\Video;

use function array_map;
use function class_exists;
Expand Down Expand Up @@ -81,6 +84,7 @@ final class TypeBuilder
private string $type;
private string $currentField;
private string $gqlServices = '$'.TypeGenerator::GRAPHQL_SERVICES;
private bool $isSymfony74Plus;

public function __construct(ExpressionConverter $expressionConverter, string $namespace)
{
Expand All @@ -89,6 +93,7 @@ public function __construct(ExpressionConverter $expressionConverter, string $na

// Register additional converter in the php code generator
Config::registerConverter($expressionConverter, ConverterInterface::TYPE_STRING);
$this->isSymfony74Plus = class_exists(Video::class);
}

/**
Expand Down Expand Up @@ -635,7 +640,32 @@ private function buildConstraints(array $constraints = [], bool $inClosure = tru
}

if (is_array($args)) {
if (isset($args[0]) && is_array($args[0])) {
if ($this->isSymfony74Plus && isset($args[0]) && Choice::class === $fqcn) {
// Handle Choice constraint in Symfony 7.4+
$args = ['choices' => $args];
}

/*
* In Symfony 7.4+, we should not pass an array, but split up parameters in different arguments.
*/
if ($this->isSymfony74Plus && false === isset($args[0]) && [] !== $args) {
$reflectionClass = new ReflectionClass($fqcn);
$constructor = $reflectionClass->getConstructor();
if (null === $constructor) {
throw new GeneratorException("Constraint '$fqcn' doesn't have a constructor.");
}
$parameters = $constructor->getParameters();
foreach ($parameters as $parameter) {
$name = $parameter->getName();
if (isset($args[$name])) {
$instance->addArgument($args[$name]);
} elseif ($parameter->isDefaultValueAvailable()) {
$instance->addArgument($parameter->getDefaultValue());
} else {
throw new GeneratorException("Constraint '$fqcn' requires argument '$name'.");
}
}
} elseif (isset($args[0]) && is_array($args[0])) {
// Nested instance
$instance->addArgument($this->buildConstraints($args, false));
} elseif (isset($args['constraints'][0]) && is_array($args['constraints'][0])) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Config/Parser/TestMetadataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function isDoctrineAnnotationInstalled(): bool

public static function isDoctrineOrmInstalled(): bool
{
return class_exists(Column::class);
return class_exists(Column::class) && class_exists(\Doctrine\ORM\Version::class);
}

protected function expect(string $name, string $type, array $config = []): void
Expand Down