Skip to content

Commit fcca091

Browse files
authored
Bump doctrine/annotations to v2 (#580)
1 parent 5a9c03b commit fcca091

File tree

5 files changed

+8
-22
lines changed

5 files changed

+8
-22
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require": {
1313
"php": ">=8.1",
1414
"ext-json": "*",
15-
"doctrine/annotations": "1.13.2",
15+
"doctrine/annotations": "^2.0",
1616
"composer/package-versions-deprecated": "^1.8",
1717
"phpdocumentor/reflection-docblock": "^4.3 || ^5.0",
1818
"phpdocumentor/type-resolver": "^1.4",

src/SchemaFactory.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,7 @@ public function setDoctrineAnnotationReader(Reader $annotationReader): self
224224
*/
225225
private function getDoctrineAnnotationReader(CacheItemPoolInterface $cache): Reader
226226
{
227-
if ($this->doctrineAnnotationReader === null) {
228-
AnnotationRegistry::registerLoader('class_exists');
229-
230-
return new PsrCachedReader(new DoctrineAnnotationReader(), $cache, true);
231-
}
232-
233-
return $this->doctrineAnnotationReader;
227+
return $this->doctrineAnnotationReader ?? new PsrCachedReader(new DoctrineAnnotationReader(), $cache, true);
234228
}
235229

236230
public function setAuthenticationService(AuthenticationServiceInterface $authenticationService): self

tests/Bootstrap.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
<?php
2-
3-
use Doctrine\Common\Annotations\AnnotationRegistry;
4-
5-
$autoloader = require_once __DIR__ . '/../vendor/autoload.php';
6-
7-
AnnotationRegistry::registerLoader('class_exists');
8-
9-
return $autoloader;
2+
declare(strict_types=1);
3+
return require __DIR__ . '/../vendor/autoload.php';

tests/Fixtures/Annotations/ClassWithInvalidExtendTypeAnnotation.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
use TheCodingMachine\GraphQLite\Annotations\ExtendType;
77

8-
/**
9-
* @ExtendType(class="foo")
10-
*/
8+
9+
#[ExtendType(class: 'foo')]
1110
class ClassWithInvalidExtendTypeAnnotation
1211
{
1312
}

tests/Fixtures/BadClassType/TestType.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
use TheCodingMachine\GraphQLite\Annotations\Type;
77

8-
/**
9-
* @Type(class=Foobar::class)
10-
*/
8+
9+
#[Type(class: 'Foobar')]
1110
class TestType
1211
{
1312
}

0 commit comments

Comments
 (0)