Issue #3351563 by Spokje, longwave, smustgrave: [11.x] Update doctrine/annotations to v2

merge-requests/6834/head
catch 2024-02-29 16:30:32 +00:00
parent a633060b14
commit 2d1776b364
9 changed files with 27 additions and 59 deletions

28
composer.lock generated
View File

@ -290,30 +290,30 @@
},
{
"name": "doctrine/annotations",
"version": "1.14.3",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af"
"reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af",
"reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f",
"reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f",
"shasum": ""
},
"require": {
"doctrine/lexer": "^1 || ^2",
"doctrine/lexer": "^2 || ^3",
"ext-tokenizer": "*",
"php": "^7.1 || ^8.0",
"php": "^7.2 || ^8.0",
"psr/cache": "^1 || ^2 || ^3"
},
"require-dev": {
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/coding-standard": "^9 || ^10",
"phpstan/phpstan": "~1.4.10 || ^1.8.0",
"doctrine/cache": "^2.0",
"doctrine/coding-standard": "^10",
"phpstan/phpstan": "^1.8.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"symfony/cache": "^4.4 || ^5.4 || ^6",
"symfony/cache": "^5.4 || ^6",
"vimeo/psalm": "^4.10"
},
"suggest": {
@ -360,9 +360,9 @@
],
"support": {
"issues": "https://github.com/doctrine/annotations/issues",
"source": "https://github.com/doctrine/annotations/tree/1.14.3"
"source": "https://github.com/doctrine/annotations/tree/2.0.1"
},
"time": "2023-02-01T09:20:38+00:00"
"time": "2023-02-02T22:02:53+00:00"
},
{
"name": "doctrine/deprecations",
@ -495,13 +495,13 @@
"dist": {
"type": "path",
"url": "core",
"reference": "52e04d4f59d5d77f898e4a3d2a63c1d809f139f7"
"reference": "8e8088fe577c4e4e1e961f9c36ce57b4cbb9ce51"
},
"require": {
"asm89/stack-cors": "^2.1",
"composer-runtime-api": "^2.1",
"composer/semver": "^3.3",
"doctrine/annotations": "^1.14",
"doctrine/annotations": "^2.0",
"egulias/email-validator": "^3.2.1|^4.0",
"ext-date": "*",
"ext-dom": "*",

View File

@ -10,7 +10,7 @@
"drupal/core": "11.x-dev",
"asm89/stack-cors": "~v2.2.0",
"composer/semver": "~3.4.0",
"doctrine/annotations": "~1.14.3",
"doctrine/annotations": "~2.0.1",
"doctrine/deprecations": "~1.1.2",
"doctrine/lexer": "~2.1.0",
"egulias/email-validator": "~4.0.2",

View File

@ -34,7 +34,7 @@
"symfony/polyfill-iconv": "^1.26",
"symfony/yaml": "^6.4",
"twig/twig": "^3.5.0",
"doctrine/annotations": "^1.14",
"doctrine/annotations": "^2.0",
"guzzlehttp/guzzle": "^7.5",
"guzzlehttp/psr7": "^2.4.5",
"egulias/email-validator": "^3.2.1|^4.0",

View File

@ -111,8 +111,6 @@ class AnnotatedClassDiscovery implements DiscoveryInterface {
// Clear the annotation loaders of any previous annotation classes.
AnnotationRegistry::reset();
// Register the namespaces of classes that can be used for annotations.
AnnotationRegistry::registerLoader('class_exists');
// Search for classes within all PSR-4 namespace locations.
foreach ($this->getPluginNamespaces() as $namespace => $dirs) {

View File

@ -8,7 +8,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=8.1.0",
"doctrine/annotations": "^1.14",
"doctrine/annotations": "^2.0",
"drupal/core-class-finder": "11.x-dev",
"drupal/core-file-cache": "11.x-dev",
"drupal/core-plugin": "11.x-dev",

View File

@ -63,9 +63,6 @@ class AttributeDiscoveryWithAnnotations extends AttributeClassDiscovery {
public function getDefinitions() {
// Clear the annotation loaders of any previous annotation classes.
AnnotationRegistry::reset();
// Register the namespaces of classes that can be used for annotations.
// @phpstan-ignore-next-line
AnnotationRegistry::registerLoader('class_exists');
$definitions = parent::getDefinitions();

View File

@ -78,8 +78,6 @@ class AnnotatedClassDiscoveryAutomatedProviders extends AnnotatedClassDiscovery
// Clear the annotation loaders of any previous annotation classes.
AnnotationRegistry::reset();
// Register the namespaces of classes that can be used for annotations.
AnnotationRegistry::registerLoader('class_exists');
// Search for classes within all PSR-4 namespace locations.
foreach ($this->getPluginNamespaces() as $namespace => $dirs) {

View File

@ -49,15 +49,6 @@ parameters:
count: 1
path: includes/theme.maintenance.inc
-
message: """
#^Call to deprecated method registerLoader\\(\\) of class Doctrine\\\\Common\\\\Annotations\\\\AnnotationRegistry\\:
This method is deprecated and will be removed in
doctrine/annotations 2\\.0\\. Annotations will be autoloaded in 2\\.0\\.$#
"""
count: 1
path: lib/Drupal/Component/Annotation/Plugin/Discovery/AnnotatedClassDiscovery.php
-
message: "#^Call to an undefined method Drupal\\\\Component\\\\Datetime\\\\DateTimePlus\\:\\:getTimeZone\\(\\)\\.$#"
count: 1
@ -1416,15 +1407,6 @@ parameters:
count: 1
path: modules/migrate/src/MigrateException.php
-
message: """
#^Call to deprecated method registerLoader\\(\\) of class Doctrine\\\\Common\\\\Annotations\\\\AnnotationRegistry\\:
This method is deprecated and will be removed in
doctrine/annotations 2\\.0\\. Annotations will be autoloaded in 2\\.0\\.$#
"""
count: 1
path: modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
-
message: "#^Missing cache backend declaration for performance\\.$#"
count: 1
@ -2590,15 +2572,6 @@ parameters:
count: 1
path: tests/Drupal/Tests/BrowserTestBase.php
-
message: """
#^Call to deprecated method registerAutoloadNamespace\\(\\) of class Doctrine\\\\Common\\\\Annotations\\\\AnnotationRegistry\\:
This method is deprecated and will be removed in
doctrine/annotations 2\\.0\\. Annotations will be autoloaded in 2\\.0\\.$#
"""
count: 1
path: tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
-
message: "#^Constructor of class Symfony\\\\Component\\\\ExpressionLanguage\\\\Expression has an unused parameter \\$expression\\.$#"
count: 1

View File

@ -7,6 +7,7 @@ namespace Drupal\Tests\Component\Annotation\Doctrine;
use Drupal\Component\Annotation\Doctrine\DocParser;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\Annotation\Target;
use Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation\Autoload;
use Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithConstants;
use Drupal\Tests\Component\Annotation\Doctrine\Fixtures\ClassWithConstants;
use Drupal\Tests\Component\Annotation\Doctrine\Fixtures\IntefaceWithConstants;
@ -1054,19 +1055,20 @@ DOCBLOCK;
*/
public function testAutoloadAnnotation()
{
$this->assertFalse(class_exists('Drupal\Tests\Component\Annotation\Doctrine\Fixture\Annotation\Autoload', false), 'Pre-condition: Drupal\Tests\Component\Annotation\Doctrine\Fixture\Annotation\Autoload not allowed to be loaded.');
self::assertFalse(
class_exists('Drupal\Tests\Component\Annotation\Doctrine\Fixture\Annotation\Autoload', false),
'Pre-condition: Drupal\Tests\Component\Annotation\Doctrine\Fixture\Annotation\Autoload not allowed to be loaded.'
);
$parser = new DocParser();
AnnotationRegistry::registerAutoloadNamespace('Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation', __DIR__ . '/../../../../');
$parser->setImports(array(
'autoload' => 'Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation\Autoload',
));
$parser->setImports([
'autoload' => Autoload::class,
]);
$annotations = $parser->parse('@Autoload');
$this->assertCount(1, $annotations);
$this->assertInstanceOf('Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation\Autoload', $annotations[0]);
self::assertCount(1, $annotations);
self::assertInstanceOf(Autoload::class, $annotations[0]);
}
public function createTestParser()