8000 bug #48718 Compatibility with doctrine/annotations 2 (derrabus) · symfony/symfony@ff94390 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff94390

Browse files
committed
bug #48718 Compatibility with doctrine/annotations 2 (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- Compatibility with doctrine/annotations 2 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48717 | License | MIT | Doc PR | N/A Doctrine Annotations 2 has been released, including the removal of deprecated classes and methods that were still called. Unfortunately, we have never declared a conflict with Annotations 2. Commits ------- 650f7bd Compatibility with doctrine/annotations 2
2 parents 27a9df3 + 650f7bd commit ff94390

File tree

16 files changed

+26
-17
lines changed

16 files changed

+26
-17
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"async-aws/sqs": "^1.0",
125125
"async-aws/sns": "^1.0",
126126
"cache/integration-tests": "dev-master",
127-
"doctrine/annotations": "^1.13.1",
127+
"doctrine/annotations": "^1.13.1 || ^2",
128128
"doctrine/cache": "^1.11|^2.0",
129129
"doctrine/collections": "^1.0|^2.0",
130130
"doctrine/data-fixtures": "^1.1",

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\DBAL\Types\Type as DBALType;
1616
use Doctrine\ORM\EntityManager;
1717
use Doctrine\ORM\Mapping\Column;
18+
use Doctrine\ORM\ORMSetup;
1819
use Doctrine\ORM\Tools\Setup;
1920
use PHPUnit\Framework\TestCase;
2021
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
@@ -33,7 +34,9 @@ class DoctrineExtractorTest extends TestCase
3334
{
3435
private function createExtractor()
3536
{
36-
$config = Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
37+
$config = class_exists(ORMSetup::class)
38+
? ORMSetup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true)
39+
: Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
3740
$entityManager = EntityManager::create(['driver' => 'pdo_sqlite'], $config);
3841

3942
if (!DBALType::hasType('foo')) {

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"symfony/validator": "^5.2|^6.0",
4444
"symfony/translation": "^4.4|^5.0|^6.0",
4545
"symfony/var-dumper": "^4.4|^5.0|^6.0",
46-
"doctrine/annotations": "^1.10.4",
46+
"doctrine/annotations": "^1.10.4|^2",
4747
"doctrine/collections": "^1.0|^2.0",
4848
"doctrine/data-fixtures": "^1.1",
4949
"doctrine/dbal": "^2.13.1|^3.0",

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function startTestSuite($suite)
138138
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
139139
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
140140
AnnotationRegistry::registerUniqueLoader('class_exists');
141-
} else {
141+
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
142142
AnnotationRegistry::registerLoader('class_exists');
143143
}
144144
}

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
3131
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
3232
AnnotationRegistry::registerUniqueLoader('class_exists');
33-
} else {
33+
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
3434
AnnotationRegistry::registerLoader('class_exists');
3535
}
3636
}

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"twig/twig": "^2.13|^3.0.4"
2323
},
2424
"require-dev": {
25-
"doctrine/annotations": "^1.12",
25+
"doctrine/annotations": "^1.12|^2",
2626
"egulias/email-validator": "^2.1.10|^3",
2727
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
2828
"symfony/asset": "^4.4|^5.0|^6.0",

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,12 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16321632
$loader->load('annotations.php');
16331633

16341634
if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
1635-
$container->getDefinition('annotations.dummy_registry')
1636-
->setMethodCalls([['registerLoader', ['class_exists']]]);
1635+
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
1636+
$container->getDefinition('annotations.dummy_registry')
1637+
->setMethodCalls([['registerLoader', ['class_exists']]]);
1638+
} else {
1639+
$container->removeDefinition('annotations.dummy_registry');
1640+
}
16371641
}
16381642

16391643
if ('none' === $config['cache']) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
->set('annotations.reader', AnnotationReader::class)
2727
->call('addGlobalIgnoredName', [
2828
'required',
29-
service('annotations.dummy_registry'), // dummy arg to register class_exists as annotation loader only when required
29+
service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
3030
])
3131

3232
->set('annotations.dummy_registry', AnnotationRegistry::class)

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/routing": "^5.3|^6.0"
3535
},
3636
"require-dev": {
37-
"doctrine/annotations": "^1.13.1",
37+
"doctrine/annotations": "^1.13.1|^2",
3838
"doctrine/cache": "^1.11|^2.0",
3939
"doctrine/persistence": "^1.3|^2|^3",
4040
"symfony/asset": "^5.3|^6.0",

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"symfony/security-http": "^5.4|^6.0"
3333
},
3434
"require-dev": {
35-
"doctrine/annotations": "^1.10.4",
35+
"doctrine/annotations": "^1.10.4|^2",
3636
"symfony/asset": "^4.4|^5.0|^6.0",
3737
"symfony/browser-kit": "^4.4|^5.0|^6.0",
3838
"symfony/console": "^4.4|^5.0|^6.0",

src/Symfony/Bundle/TwigBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"symfony/yaml": "^4.4|^5.0|^6.0",
3838
"symfony/framework-bundle": "^5.0|^6.0",
3939
"symfony/web-link": "^4.4|^5.0|^6.0",
40-
"doctrine/annotations": "^1.10.4",
40+
"doctrine/annotations": "^1.10.4|^2",
4141
"doctrine/cache": "^1.0|^2.0"
4242
},
4343
"conflict": {

src/Symfony/Component/PropertyInfo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
3535
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
3636
"phpstan/phpdoc-parser": "^1.0",
37-
"doctrine/annotations": "^1.10.4"
37+
"doctrine/annotations": "^1.10.4|^2"
3838
},
3939
"conflict": {
4040
"phpdocumentor/reflection-docblock": "<3.2.2",

src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderWithAnnotationsTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ protected function configureRoute(Route $route, \ReflectionClass $class, \Reflec
2626
{
2727
}
2828
};
29-
AnnotationRegistry::registerLoader('class_exists');
29+
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
30+
AnnotationRegistry::registerLoader('class_exists');
31+
}
3032
}
3133

3234
public function testDefaultRouteName()

src/Symfony/Component/Routing/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"symfony/yaml": "^4.4|^5.0|^6.0",
2727
"symfony/expression-language": "^4.4|^5.0|^6.0",
2828
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
29-
"doctrine/annotations": "^1.12",
29+
"doctrine/annotations": "^1.12|^2",
3030
"psr/log": "^1|^2|^3"
3131
},
3232
"conflict": {

src/Symfony/Component/Serializer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"symfony/polyfill-php80": "^1.16"
2323
},
2424
"require-dev": {
25-
"doctrine/annotations": "^1.12",
25+
"doctrine/annotations": "^1.12|^2",
2626
"phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0",
2727
"symfony/cache": "^4.4|^5.0|^6.0",
2828
"symfony/config": "^4.4|^5.0|^6.0",

src/Symfony/Component/Validator/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"symfony/property-access": "^4.4|^5.0|^6.0",
4242
"symfony/property-info": "^5.3|^6.0",
4343
"symfony/translation": "^4.4|^5.0|^6.0",
44-
"doctrine/annotations": "^1.13",
44+
"doctrine/annotations": "^1.13|^2",
4545
"doctrine/cache": "^1.11|^2.0",
4646
"egulias/email-validator": "^2.1.10|^3"
4747
},

0 commit comments

Comments
 (0)
0