8000 Compatibility with doctrine/annotations 2 by derrabus · Pull Request #48718 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"async-aws/sqs": "^1.0",
"async-aws/sns": "^1.0",
"cache/integration-tests": "dev-master",
"doctrine/annotations": "^1.13.1",
"doctrine/annotations": "^1.13.1 || ^2",
"doctrine/cache": "^1.11|^2.0",
"doctrine/collections": "^1.0|^2.0",
"doctrine/data-fixtures": "^1.1",
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Doctrine\DBAL\Types\Type as DBALType;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\ORMSetup;
use Doctrine\ORM\Tools\Setup;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
Expand All @@ -33,7 +34,9 @@ class DoctrineExtractorTest extends TestCase
{
private function createExtractor()
{
$config = Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
$config = class_exists(ORMSetup::class)
? ORMSetup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true)
: Setup::createAnnotationMetadataConfiguration([__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'], true);
$entityManager = EntityManager::create(['driver' => 'pdo_sqlite'], $config);

if (!DBALType::hasType('foo')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"symfony/validator": "^5.2|^6.0",
"symfony/translation": "^4.4|^5.0|^6.0",
"symfony/var-dumper": "^4.4|^5.0|^6.0",
"doctrine/annotations": "^1.10.4",
"doctrine/annotations": "^1.10.4|^2",
"doctrine/collections": "^1.0|^2.0",
"doctrine/data-fixtures": "^1.1",
"doctrine/dbal": "^2.13.1|^3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function startTestSuite($suite)
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');
} else {
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
AnnotationRegistry::registerLoader('class_exists');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/PhpUnit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
AnnotationRegistry::registerUniqueLoader('class_exists');
} else {
} elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) {
AnnotationRegistry::registerLoader('class_exists');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"twig/twig": "^2.13|^3.0.4"
},
"require-dev": {
"doctrine/annotations": "^1.12",
"doctrine/annotations": "^1.12|^2",
"egulias/email-validator": "^2.1.10|^3",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/asset": "^4.4|^5.0|^6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1632,8 +1632,12 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
$loader->load('annotations.php');

if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
$container->getDefinition('annotations.dummy_registry')
->setMethodCalls([['registerLoader', ['class_exists']]]);
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
$container->getDefinition('annotations.dummy_registry')
->setMethodCalls([['registerLoader', ['class_exists']]]);
} else {
$container->removeDefinition('annotations.dummy_registry');
}
}

if ('none' === $config['cache']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
->set('annotations.reader', AnnotationReader::class)
->call('addGlobalIgnoredName', [
'required',
service('annotations.dummy_registry'), // dummy arg to register class_exists as annotation loader only when required
service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
])

->set('annotations.dummy_registry', AnnotationRegistry::class)
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"symfony/routing": "^5.3|^6.0"
},
"require-dev": {
"doctrine/annotations": "^1.13.1",
"doctrine/annotations": "^1.13.1|^2",
"doctrine/cache": "^1.11|^2.0",
"doctrine/persistence": "^1.3|^2|^3",
"symfony/asset": "^5.3|^6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/SecurityBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"symfony/security-http": "^5.4|^6.0"
},
"require-dev": {
"doctrine/annotations": "^1.10.4",
"doctrine/annotations": "^1.10.4|^2",
"symfony/asset": "^4.4|^5.0|^6.0",
"symfony/browser-kit": "^4.4|^5.0|^6.0",
"symfony/console": "^4.4|^5.0|^6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/TwigBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"symfony/yaml": "^4.4|^5.0|^6.0",
"symfony/framework-bundle": "^5.0|^6.0",
"symfony/web-link": "^4.4|^5.0|^6.0",
"doctrine/annotations": "^1.10.4",
"doctrine/annotations": "^1.10.4|^2",
"doctrine/cache": "^1.0|^2.0"
},
"conflict": {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/PropertyInfo/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"phpstan/phpdoc-parser": "^1.0",
"doctrine/annotations": "^1.10.4"
"doctrine/annotations": "^1.10.4|^2"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ protected function configureRoute(Route $route, \ReflectionClass $class, \Reflec
{
}
};
AnnotationRegistry::registerLoader('class_exists');
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
AnnotationRegistry::registerLoader('class_exists');
}
}

public function testDefaultRouteName()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"symfony/yaml": "^4.4|^5.0|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"doctrine/annotations": "^1.12",
"doctrine/annotations": "^1.12|^2",
"psr/log": "^1|^2|^3"
},
"conflict": {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Serializer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"symfony/polyfill-php80": "^1.16"
},
"require-dev": {
"doctrine/annotations": "^1.12",
"doctrine/annotations": "^1.12|^2",
"phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0",
"symfony/cache": "^4.4|^5.0|^6.0",
"symfony/config": "^4.4|^5.0|^6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"symfony/property-access": "^4.4|^5.0|^6.0",
"symfony/property-info": "^5.3|^6.0",
"symfony/translation": "^4.4|^5.0|^6.0",
"doctrine/annotations": "^1.13",
"doctrine/annotations": "^1.13|^2",
"doctrine/cache": "^1.11|^2.0",
"egulias/email-validator": "^2.1.10|^3"
},
Expand Down
0