diff --git a/composer.json b/composer.json index ff64cc17f..af12218e1 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ ], "require": { "php": "^7.1 || ^8.0", + "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/persistence": "^2.0 || ^3.0" }, "require-dev": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 748a07b21..beddadc4f 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -25,23 +25,15 @@ parameters: - message: '#^Result of method Doctrine\\Tests\\Common\\Proxy\\LazyLoadableObjectWithVoid::(adding|incrementing)AndReturningVoid\(\) \(void\) is used\.$#' path: 'tests/Common/Proxy/ProxyLogicVoidReturnTypeTest.php' - - - message: '#^Property Doctrine\\Tests\\Common\\Proxy\\ProxyLogicTest::\$initializerCallbackMock \(callable\(\): mixed&PHPUnit\\Framework\\MockObject\\MockObject\) does not accept PHPUnit\\Framework\\MockObject\\MockObject&stdClass\.$#' - path: 'tests/Common/Proxy/ProxyLogicTest.php' - message: '#.*LazyLoadableObject.*#' - paths: - - 'tests/Common/Proxy/ProxyLogicTest.php' - - 'tests/Common/Proxy/ProxyLogicVoidReturnTypeTest.php' + path: 'tests/Common/Proxy/ProxyLogicTest.php' - message: '#^Instantiated class Doctrine\\Tests\\Common\\ProxyProxy\\__CG__\\Doctrine\\Tests\\Common\\Proxy\\.* not found.$#' path: 'tests/Common/Proxy/ProxyLogicTest.php' - message: '#^Instantiated class Doctrine\\Tests\\Common\\ProxyProxy\\__CG__\\Doctrine\\Tests\\Common\\Proxy\\.* not found.$#' path: 'tests/Common/Proxy/ProxyLogicVoidReturnTypeTest.php' - - - message: '#^Property Doctrine\\Tests\\Common\\Proxy\\ProxyLogicVoidReturnTypeTest::\$initializerCallbackMock \(callable\(\): mixed&PHPUnit\\Framework\\MockObject\\MockObject\) does not accept PHPUnit\\Framework\\MockObject\\MockObject&stdClass\.$#' - path: 'tests/Common/Proxy/ProxyLogicVoidReturnTypeTest.php' - message: '#^Method Doctrine\\Tests\\Common\\Proxy\\MagicIssetClassWithInteger::__isset\(\) should return bool but returns int\.$#' path: 'tests/Common/Proxy/MagicIssetClassWithInteger.php' diff --git a/src/Proxy/AbstractProxyFactory.php b/src/Proxy/AbstractProxyFactory.php index d487e1a21..a98a57159 100644 --- a/src/Proxy/AbstractProxyFactory.php +++ b/src/Proxy/AbstractProxyFactory.php @@ -15,6 +15,8 @@ /** * Abstract factory for proxy objects. + * + * @deprecated The AbstractProxyFactory class is deprecated and will be removed in doctrine/common 4.0. */ abstract class AbstractProxyFactory { diff --git a/src/Proxy/Autoloader.php b/src/Proxy/Autoloader.php index ec2379ce4..370c3f09d 100644 --- a/src/Proxy/Autoloader.php +++ b/src/Proxy/Autoloader.php @@ -20,7 +20,7 @@ /** * Special Autoloader for Proxy classes, which are not PSR-0 compliant. * - * @internal + * @deprecated The Autoloader class is deprecated and will be removed in doctrine/common 4.0. */ class Autoloader { diff --git a/src/Proxy/Exception/InvalidArgumentException.php b/src/Proxy/Exception/InvalidArgumentException.php index 998600e20..1f91a9384 100644 --- a/src/Proxy/Exception/InvalidArgumentException.php +++ b/src/Proxy/Exception/InvalidArgumentException.php @@ -13,7 +13,7 @@ /** * Proxy Invalid Argument Exception. * - * @link www.doctrine-project.org + * @deprecated The InvalidArgumentException class is deprecated and will be removed in doctrine/common 4.0. */ class InvalidArgumentException extends BaseInvalidArgumentException implements ProxyException { diff --git a/src/Proxy/Exception/OutOfBoundsException.php b/src/Proxy/Exception/OutOfBoundsException.php index 0da3e9139..065c4f647 100644 --- a/src/Proxy/Exception/OutOfBoundsException.php +++ b/src/Proxy/Exception/OutOfBoundsException.php @@ -9,7 +9,7 @@ /** * Proxy Invalid Argument Exception. * - * @link www.doctrine-project.org + * @deprecated The OutOfBoundsException class is deprecated and will be removed in doctrine/common 4.0. */ class OutOfBoundsException extends BaseOutOfBoundsException implements ProxyException { diff --git a/src/Proxy/Exception/ProxyException.php b/src/Proxy/Exception/ProxyException.php index f827fbd03..9d1e7437e 100644 --- a/src/Proxy/Exception/ProxyException.php +++ b/src/Proxy/Exception/ProxyException.php @@ -5,7 +5,7 @@ /** * Base exception interface for proxy exceptions. * - * @link www.doctrine-project.org + * @deprecated The ProxyException interface is deprecated and will be removed in doctrine/common 4.0. */ interface ProxyException { diff --git a/src/Proxy/Exception/UnexpectedValueException.php b/src/Proxy/Exception/UnexpectedValueException.php index 49829f719..7c45bfb72 100644 --- a/src/Proxy/Exception/UnexpectedValueException.php +++ b/src/Proxy/Exception/UnexpectedValueException.php @@ -10,7 +10,7 @@ /** * Proxy Unexpected Value Exception. * - * @link www.doctrine-project.org + * @deprecated The UnexpectedValueException class is deprecated and will be removed in doctrine/common 4.0. */ class UnexpectedValueException extends BaseUnexpectedValueException implements ProxyException { diff --git a/src/Proxy/Proxy.php b/src/Proxy/Proxy.php index f723ac805..d804d3fa4 100644 --- a/src/Proxy/Proxy.php +++ b/src/Proxy/Proxy.php @@ -8,6 +8,8 @@ /** * Interface for proxy classes. * + * @deprecated The Proxy interface is deprecated and will be removed in doctrine/common 4.0. + * * @template T of object * @template-extends BaseProxy */ diff --git a/src/Proxy/ProxyDefinition.php b/src/Proxy/ProxyDefinition.php index a7f395738..f39604a3e 100644 --- a/src/Proxy/ProxyDefinition.php +++ b/src/Proxy/ProxyDefinition.php @@ -6,6 +6,8 @@ /** * Definition structure how to create a proxy. + * + * @deprecated The ProxyDefinition class is deprecated and will be removed in doctrine/common 4.0. */ class ProxyDefinition { diff --git a/src/Proxy/ProxyGenerator.php b/src/Proxy/ProxyGenerator.php index 5d5b67e38..e4d1fcb07 100644 --- a/src/Proxy/ProxyGenerator.php +++ b/src/Proxy/ProxyGenerator.php @@ -6,6 +6,7 @@ use Doctrine\Common\Proxy\Exception\InvalidArgumentException; use Doctrine\Common\Proxy\Exception\UnexpectedValueException; use Doctrine\Common\Util\ClassUtils; +use Doctrine\Deprecations\Deprecation; use Doctrine\Persistence\Mapping\ClassMetadata; use ReflectionIntersectionType; use ReflectionMethod; @@ -67,6 +68,8 @@ /** * This factory is used to generate proxy classes. * It builds proxies from given parameters, a template and class metadata. + * + * @deprecated The ProxyGenerator class is deprecated and will be removed in doctrine/common 4.0. */ class ProxyGenerator { @@ -259,6 +262,14 @@ public function __getLazyProperties(): array */ public function __construct($proxyDirectory, $proxyNamespace) { + if (PHP_VERSION_ID >= 80100) { + Deprecation::trigger( + 'doctrine/common', + 'https://github.com/doctrine/common/pull/1002', + 'The ProxyGenerator class is deprecated and will be removed in doctrine/common 4.0 together with all other symbols in the Doctrine\Common\Proxy namespace.' + ); + } + if (! $proxyDirectory) { throw InvalidArgumentException::proxyDirectoryRequired(); }