Skip to content

Commit a1dfb6e

Browse files
committed
📦 Use dev-master for graphqlite because of improved performance, dropped support for doctrine annotations. Drop support for doctrine annotations
1 parent ff06ee1 commit a1dfb6e

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818
"require" : {
1919
"php" : ">=8.1",
2020
"ext-json": "*",
21-
"thecodingmachine/graphqlite" : "^7.0",
21+
"thecodingmachine/graphqlite" : "dev-master as 7.1",
2222
"thecodingmachine/graphqlite-symfony-validator-bridge": "^6.0 || ^7.0",
2323
"symfony/framework-bundle": "^6.4 || ^7.0",
2424
"symfony/validator": "^6.4 || ^7.0",
2525
"symfony/translation": "^6.4 || ^7.0",
26-
"doctrine/annotations": "^1.13 || ^2.0.1",
2726
"symfony/psr-http-message-bridge": "^6.4 || ^7.0",
2827
"nyholm/psr7": "^1.1",
2928
"laminas/laminas-diactoros": "^2.2 || ^3.0",
@@ -50,7 +49,7 @@
5049
"phpstan": "phpstan analyse GraphQLiteBundle.php DependencyInjection/ Controller/ Resources/ Security/ -c phpstan.neon --level=7 --no-progress"
5150
},
5251
"suggest": {
53-
"symfony/security-bundle": "To use @Logged or @Right annotations"
52+
"symfony/security-bundle": "To use #[Logged] or #[Right] attributes"
5453
},
5554
"autoload" : {
5655
"psr-4" : {

src/DependencyInjection/GraphQLiteCompilerPass.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
namespace TheCodingMachine\GraphQLite\Bundle\DependencyInjection;
55

6-
use Doctrine\Common\Annotations\AnnotationReader as DoctrineAnnotationReader;
7-
use Doctrine\Common\Annotations\AnnotationRegistry;
8-
use Doctrine\Common\Annotations\PsrCachedReader;
96
use Generator;
107
use GraphQL\Server\ServerConfig;
118
use GraphQL\Validator\Rules\DisableIntrospection;
@@ -59,7 +56,7 @@
5956
class GraphQLiteCompilerPass implements CompilerPassInterface
6057
{
6158
/**
62-
* @var AnnotationReader
59+
* @var AnnotationReader|null
6360
*/
6461
private $annotationReader;
6562

@@ -422,26 +419,12 @@ private static function getParametersByName(ReflectionMethod $method): array
422419
}
423420

424421
/**
425-
* Returns a cached Doctrine annotation reader.
422+
* Returns a GraphQLite annotation reader.
426423
* Note: we cannot get the annotation reader service in the container as we are in a compiler pass.
427424
*/
428425
private function getAnnotationReader(): AnnotationReader
429426
{
430-
if ($this->annotationReader === null) {
431-
// @phpstan-ignore-next-line "registerLoader exists in doctrine/annotations:v1.x"
432-
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
433-
AnnotationRegistry::registerLoader('class_exists');
434-
}
435-
436-
$doctrineAnnotationReader = new DoctrineAnnotationReader();
437-
438-
if (ApcuAdapter::isSupported()) {
439-
$doctrineAnnotationReader = new PsrCachedReader($doctrineAnnotationReader, new ApcuAdapter('graphqlite'), true);
440-
}
441-
442-
$this->annotationReader = new AnnotationReader(/*$doctrineAnnotationReader, AnnotationReader::LAX_MODE*/);
443-
}
444-
return $this->annotationReader;
427+
return $this->annotationReader ??= new AnnotationReader();
445428
}
446429

447430
/**

src/Resources/config/container/graphqlite.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services
66
http://symfony.com/schema/dic/services/services-1.0.xsd"
77
>
8-
<parameters>
9-
<parameter key="graphqlite.annotations.error_mode">LAX_MODE</parameter>
10-
</parameters>
11-
128
<services>
139
<defaults autowire="true" autoconfigure="true" public="false" />
1410

@@ -40,9 +36,7 @@
4036
<service id="GraphQL\Type\Schema" alias="TheCodingMachine\GraphQLite\Schema" />
4137

4238

43-
<service id="TheCodingMachine\GraphQLite\AnnotationReader" >
44-
<argument key="$mode">%graphqlite.annotations.error_mode%</argument>
45-
</service>
39+
<service id="TheCodingMachine\GraphQLite\AnnotationReader" />
4640

4741
<service id="TheCodingMachine\GraphQLite\Bundle\Security\AuthenticationService">
4842
<argument type="service" id="security.token_storage" on-invalid="null" />

0 commit comments

Comments
 (0)