Skip to content

Commit

Permalink
Bump doctrine/annotations to v2 (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
l-you authored Mar 13, 2023
1 parent 5a9c03b commit fcca091
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"require": {
"php": ">=8.1",
"ext-json": "*",
"doctrine/annotations": "1.13.2",
"doctrine/annotations": "^2.0",
"composer/package-versions-deprecated": "^1.8",
"phpdocumentor/reflection-docblock": "^4.3 || ^5.0",
"phpdocumentor/type-resolver": "^1.4",
Expand Down
8 changes: 1 addition & 7 deletions src/SchemaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,7 @@ public function setDoctrineAnnotationReader(Reader $annotationReader): self
*/
private function getDoctrineAnnotationReader(CacheItemPoolInterface $cache): Reader
{
if ($this->doctrineAnnotationReader === null) {
AnnotationRegistry::registerLoader('class_exists');

return new PsrCachedReader(new DoctrineAnnotationReader(), $cache, true);
}

return $this->doctrineAnnotationReader;
return $this->doctrineAnnotationReader ?? new PsrCachedReader(new DoctrineAnnotationReader(), $cache, true);
}

public function setAuthenticationService(AuthenticationServiceInterface $authenticationService): self
Expand Down
10 changes: 2 additions & 8 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

$autoloader = require_once __DIR__ . '/../vendor/autoload.php';

AnnotationRegistry::registerLoader('class_exists');

return $autoloader;
declare(strict_types=1);
return require __DIR__ . '/../vendor/autoload.php';
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

use TheCodingMachine\GraphQLite\Annotations\ExtendType;

/**
* @ExtendType(class="foo")
*/

#[ExtendType(class: 'foo')]
class ClassWithInvalidExtendTypeAnnotation
{
}
5 changes: 2 additions & 3 deletions tests/Fixtures/BadClassType/TestType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

use TheCodingMachine\GraphQLite\Annotations\Type;

/**
* @Type(class=Foobar::class)
*/

#[Type(class: 'Foobar')]
class TestType
{
}

0 comments on commit fcca091

Please sign in to comment.