Skip to content

Commit fba0567

Browse files
committed
Deprecate methods related to the annotation driver
1 parent 8160e89 commit fba0567

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

UPGRADE.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
Please switch to one of the other mapping drivers. Native attributes which PHP
66
supports since version 8.0 are probably your best option.
77

8+
As a consequence, the following methods are deprecated:
9+
- `ORMSetup::createAnnotationMetadataConfiguration`
10+
- `ORMSetup::createDefaultAnnotationDriver`
11+
812
## Deprecated `Doctrine\ORM\Proxy\Proxy` interface.
913

1014
Use `Doctrine\Persistence\Proxy` instead to check whether proxies are initialized.

lib/Doctrine/ORM/ORMSetup.php

+16
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ final class ORMSetup
3131
/**
3232
* Creates a configuration with an annotation metadata driver.
3333
*
34+
* @deprecated Use another mapping driver.
35+
*
3436
* @param string[] $paths
3537
*/
3638
public static function createAnnotationMetadataConfiguration(
@@ -39,6 +41,12 @@ public static function createAnnotationMetadataConfiguration(
3941
?string $proxyDir = null,
4042
?CacheItemPoolInterface $cache = null
4143
): Configuration {
44+
Deprecation::trigger(
45+
'doctrine/orm',
46+
'https://github.com/doctrine/orm/issues/10098',
47+
'%s is deprecated and will be removed in Doctrine ORM 3.0',
48+
__METHOD__
49+
);
4250
$config = self::createConfiguration($isDevMode, $proxyDir, $cache);
4351
$config->setMetadataDriverImpl(self::createDefaultAnnotationDriver($paths));
4452

@@ -48,12 +56,20 @@ public static function createAnnotationMetadataConfiguration(
4856
/**
4957
* Adds a new default annotation driver with a correctly configured annotation reader.
5058
*
59+
* @deprecated Use another mapping driver.
60+
*
5161
* @param string[] $paths
5262
*/
5363
public static function createDefaultAnnotationDriver(
5464
array $paths = [],
5565
?CacheItemPoolInterface $cache = null
5666
): AnnotationDriver {
67+
Deprecation::trigger(
68+
'doctrine/orm',
69+
'https://github.com/doctrine/orm/issues/10098',
70+
'%s is deprecated and will be removed in Doctrine ORM 3.0',
71+
__METHOD__
72+
);
5773
if (! class_exists(AnnotationReader::class)) {
5874
throw new LogicException(sprintf(
5975
'The annotation metadata driver cannot be enabled because the "doctrine/annotations" library'

psalm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<referencedMethod name="Doctrine\ORM\Configuration::newDefaultAnnotationDriver"/>
7777
<referencedMethod name="Doctrine\ORM\Id\AbstractIdGenerator::generate"/>
7878
<referencedMethod name="Doctrine\ORM\ORMInvalidArgumentException::invalidEntityName"/>
79+
<referencedMethod name="Doctrine\ORM\ORMSetup::createDefaultAnnotationDriver"/>
7980
<referencedMethod name="Doctrine\ORM\Query\TreeWalkerAdapter::_getQueryComponents"/>
8081
<file name="lib/Doctrine/ORM/Query/TreeWalkerChain.php"/>
8182
</errorLevel>

0 commit comments

Comments
 (0)