Skip to content

Commit

Permalink
Annotations: support doctrine/annotations v1
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik authored and f3l1x committed Mar 15, 2024
1 parent 33ec0d4 commit e5a799a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ parameters:
# Nette changed return typehint
- message: "#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, array\\<int, array\\<string\\>\\|string\\> given\\.$#"
path: %currentWorkingDirectory%/src/OpenApi/SchemaDefinition/Entity/EntityAdapter.php

# Support for doctrine/annotations ^1
- message: "#^Call to function method_exists\\(\\) with 'Doctrine\\\\\\\\Common\\\\\\\\Annotations\\\\\\\\AnnotationRegistry' and 'registerUniqueLoader' will always evaluate to false\\.$#"
path: src/Core/DI/LoaderFactory/DualReaderFactory.php
5 changes: 5 additions & 0 deletions src/Core/DI/LoaderFactory/DualReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Apitte\Core\DI\LoaderFactory;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\Reader;
use Koriym\Attributes\AttributeReader;
use Koriym\Attributes\DualReader;
Expand All @@ -16,6 +17,10 @@ class DualReaderFactory
public function create(): Reader
{
$annotationReader = new AnnotationReader();
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');
}

$attributeReader = new AttributeReader();

return new DualReader($annotationReader, $attributeReader);
Expand Down

0 comments on commit e5a799a

Please sign in to comment.