From 8655bcb40aaf13dd78d551a3bad003e6c92ab779 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 29 Nov 2024 19:25:33 +0100 Subject: [PATCH] used attribute Deprecated --- src/DI/ContainerBuilder.php | 4 ++-- src/DI/Definitions/Reference.php | 2 +- src/DI/DependencyChecker.php | 2 +- src/DI/Extensions/InjectExtension.php | 4 ++-- src/DI/Helpers.php | 4 +--- tests/DI/Helpers.parseAnnotation().phpt | 22 +++++++++------------- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/DI/ContainerBuilder.php b/src/DI/ContainerBuilder.php index f2844d508..18b753b39 100644 --- a/src/DI/ContainerBuilder.php +++ b/src/DI/ContainerBuilder.php @@ -22,10 +22,10 @@ class ContainerBuilder ThisService = 'self', ThisContainer = 'container'; - /** @deprecated use ContainerBuilder::ThisService */ + #[\Deprecated('use ContainerBuilder::ThisService')] public const THIS_SERVICE = self::ThisService; - /** @deprecated use ContainerBuilder::ThisContainer */ + #[\Deprecated('use ContainerBuilder::ThisContainer')] public const THIS_CONTAINER = self::ThisContainer; public array $parameters = []; diff --git a/src/DI/Definitions/Reference.php b/src/DI/Definitions/Reference.php index 25625dec7..a23552003 100644 --- a/src/DI/Definitions/Reference.php +++ b/src/DI/Definitions/Reference.php @@ -17,7 +17,7 @@ final class Reference { public const Self = 'self'; - /** @deprecated use Reference::Self */ + #[\Deprecated('use Reference::Self')] public const SELF = self::Self; private string $value; diff --git a/src/DI/DependencyChecker.php b/src/DI/DependencyChecker.php index 94eb9fdc8..cab489c63 100644 --- a/src/DI/DependencyChecker.php +++ b/src/DI/DependencyChecker.php @@ -22,7 +22,7 @@ class DependencyChecker { public const Version = 1; - /** @deprecated use DependencyChecker::Version */ + #[\Deprecated('use DependencyChecker::Version')] public const VERSION = self::Version; /** @var array */ diff --git a/src/DI/Extensions/InjectExtension.php b/src/DI/Extensions/InjectExtension.php index 3714d8753..fea611f86 100644 --- a/src/DI/Extensions/InjectExtension.php +++ b/src/DI/Extensions/InjectExtension.php @@ -22,7 +22,7 @@ final class InjectExtension extends DI\CompilerExtension { public const TagInject = 'nette.inject'; - /** @deprecated use InjectExtension::TagInject */ + #[\Deprecated('use InjectExtension::TagInject')] public const TAG_INJECT = self::TagInject; @@ -119,7 +119,7 @@ public static function getInjectProperties(string $class): array foreach ((new \ReflectionClass($class))->getProperties() as $rp) { if ( $rp->getAttributes(DI\Attributes\Inject::class) - || DI\Helpers::parseAnnotation($rp, 'inject') !== null + || @DI\Helpers::parseAnnotation($rp, 'inject') !== null // @deprecated ) { if (!$rp->getAttributes(DI\Attributes\Inject::class)) { trigger_error('Annotation @inject is deprecated, use #[Nette\\DI\\Attributes\\Inject] (used in ' . Reflection::toString($rp) . ')', E_USER_DEPRECATED); diff --git a/src/DI/Helpers.php b/src/DI/Helpers.php index 3597a3820..32f930cb8 100644 --- a/src/DI/Helpers.php +++ b/src/DI/Helpers.php @@ -200,9 +200,7 @@ public static function prefixServiceName(mixed $config, string $namespace): mixe } - /** - * Returns an annotation value. - */ + #[\Deprecated] public static function parseAnnotation(\Reflector $ref, string $name): ?string { if (!Reflection::areCommentsAvailable()) { diff --git a/tests/DI/Helpers.parseAnnotation().phpt b/tests/DI/Helpers.parseAnnotation().phpt index 3406024bd..44115be43 100644 --- a/tests/DI/Helpers.parseAnnotation().phpt +++ b/tests/DI/Helpers.parseAnnotation().phpt @@ -1,9 +1,5 @@