Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations: support doctrine/annotations v1 #208

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@
public function create(): Reader
{
$annotationReader = new AnnotationReader();
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');

Check warning on line 21 in src/Core/DI/LoaderFactory/DualReaderFactory.php

View check run for this annotation

Codecov / codecov/patch

src/Core/DI/LoaderFactory/DualReaderFactory.php#L21

Added line #L21 was not covered by tests
}

$attributeReader = new AttributeReader();

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