From 980fa76b332a0a391585be9548c8299b278b3e22 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Thu, 30 Mar 2023 18:21:33 +0200 Subject: [PATCH 1/3] allow doctrine/annotations 2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fcbfafdf..d220600c 100644 --- a/composer.json +++ b/composer.json @@ -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" From 888d48a1abea63bfa111f6d57c978ef81c0be391 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Thu, 30 Mar 2023 18:26:52 +0200 Subject: [PATCH 2/3] bootstrap.php: call registerLoader only if the method exists --- tests/App/bootstrap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/App/bootstrap.php b/tests/App/bootstrap.php index b6e2ee5f..1171c98f 100644 --- a/tests/App/bootstrap.php +++ b/tests/App/bootstrap.php @@ -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; From e940543152f6a5f1ab77e624911f7d91cfda4a48 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Tue, 4 Apr 2023 20:35:06 +0200 Subject: [PATCH 3/3] CI: use doctrine/annotations v1 with PHP 7 --- .github/workflows/tests.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 268a67ab..c9b5b39b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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