Skip to content

Commit add60cc

Browse files
Merge pull request #613 from alexislefebvre/allow-doctrine/annotations-2
allow doctrine/annotations 2
2 parents f549dab + e940543 commit add60cc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
symfony/validator=${{ matrix.symfony-version }}
6666
symfony/yaml=${{ matrix.symfony-version }}
6767
68+
- name: Require Annotations v1 to require for PHP 7
69+
if: startsWith(matrix.php-version, '7.')
70+
run: composer require --no-update "doctrine/annotations:^1.8.0"
71+
72+
- name: Require Annotations v1/v2 to require for PHP 8+
73+
if: startsWith(matrix.php-version, '7.') != true
74+
run: composer require --no-update "doctrine/annotations:^1.8.0|^2.0"
75+
6876
- name: Install Composer dependencies
6977
if: matrix.composer-flags == ''
7078
run: composer install

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"require": {
1818
"php": "^7.2 || ^8.0",
19-
"doctrine/annotations": "^1.3",
19+
"doctrine/annotations": "^1.3 || ^2.0",
2020
"phpunit/phpunit": "^7.5.0 || ^8.0 || ^9.0",
2121
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
2222
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0"

tests/App/bootstrap.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
$loader = require __DIR__.'/../../vendor/autoload.php';
1717

18-
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
18+
// This method only exist on doctrine/annotations:^1.3,
19+
// it is missing but not needed with doctrine/annotations:^2.0
20+
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
21+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
22+
}
1923

2024
return $loader;

0 commit comments

Comments
 (0)