Skip to content

Commit

Permalink
Merge pull request #613 from alexislefebvre/allow-doctrine/annotations-2
Browse files Browse the repository at this point in the history
allow doctrine/annotations 2
  • Loading branch information
alexislefebvre authored Apr 4, 2023
2 parents f549dab + e940543 commit add60cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ jobs:
symfony/validator=${{ matrix.symfony-version }}
symfony/yaml=${{ matrix.symfony-version }}
- name: Require Annotations v1 to require for PHP 7
if: startsWith(matrix.php-version, '7.')
run: composer require --no-update "doctrine/annotations:^1.8.0"

- name: Require Annotations v1/v2 to require for PHP 8+
if: startsWith(matrix.php-version, '7.') != true
run: composer require --no-update "doctrine/annotations:^1.8.0|^2.0"

- name: Install Composer dependencies
if: matrix.composer-flags == ''
run: composer install
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"doctrine/annotations": "^1.3",
"doctrine/annotations": "^1.3 || ^2.0",
"phpunit/phpunit": "^7.5.0 || ^8.0 || ^9.0",
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0"
Expand Down
6 changes: 5 additions & 1 deletion tests/App/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

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

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

return $loader;

0 comments on commit add60cc

Please sign in to comment.