Skip to content

Commit

Permalink
Compatibility with Doctrine Annotations 2 (#296)
Browse files Browse the repository at this point in the history
* Compatibility with Annotations 2

* Suppress UnusedPsalmSuppress

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
  • Loading branch information
derrabus and weirdan committed Dec 23, 2022
1 parent 30c2af8 commit 6a1723f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require-dev": {
"symfony/form": "^4.0 || ^5.0 || ^6.0",
"doctrine/annotations": "^1.8",
"doctrine/annotations": "^1.8|^2",
"doctrine/orm": "^2.7",
"phpunit/phpunit": "~7.5 || ~9.5",
"symfony/cache-contracts": "^1.0 || ^2.0",
Expand Down
5 changes: 5 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.7.3@38c452ae584467e939d55377aaf83b5a26f19dd1">
<file src="src/Plugin.php">
<UnusedPsalmSuppress occurrences="1">
<code>DeprecatedMethod</code>
</UnusedPsalmSuppress>
</file>
<file src="src/Twig/Context.php">
<UnnecessaryVarAnnotation occurrences="2">
<code>int</code>
Expand Down
6 changes: 4 additions & 2 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ public function __invoke(RegistrationInterface $api, SimpleXMLElement $config =

if (class_exists(AnnotationRegistry::class)) {
require_once __DIR__.'/Handler/DoctrineRepositoryHandler.php';
/** @psalm-suppress DeprecatedMethod */
AnnotationRegistry::registerLoader('class_exists');
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
/** @psalm-suppress DeprecatedMethod */
AnnotationRegistry::registerLoader('class_exists');
}
$api->registerHooksFromClass(DoctrineRepositoryHandler::class);

require_once __DIR__.'/Handler/AnnotationHandler.php';
Expand Down

0 comments on commit 6a1723f

Please sign in to comment.