From 7e950e6e10ee5ac1222c5ae9d3c4dd5a76a64d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 30 Dec 2024 13:30:07 +0100 Subject: [PATCH] Add native type declarations --- UPGRADE.md | 7 +++++++ src/Deprecation.php | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 UPGRADE.md diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..16d671c --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,7 @@ +# Upgrade to 2.0 + +## Added native type declarations + +Some type declarations that required recent PHP versions were added to the +codebase. This means that some signatures were changed and will have to be +adjusted in sub-classes. diff --git a/src/Deprecation.php b/src/Deprecation.php index 1801e6c..9f61f5e 100644 --- a/src/Deprecation.php +++ b/src/Deprecation.php @@ -72,11 +72,13 @@ class Deprecation * The link should point to a Github issue or Wiki entry detailing the * deprecation. It is additionally used to de-duplicate the trigger of the * same deprecation during a request. - * - * @param float|int|string $args */ - public static function trigger(string $package, string $link, string $message, ...$args): void - { + public static function trigger( + string $package, + string $link, + string $message, + float|int|string ...$args, + ): void { $type = self::$type ?? self::getTypeFromEnv(); if ($type === self::TYPE_NONE) { @@ -124,11 +126,13 @@ public static function trigger(string $package, string $link, string $message, . * Compared to {@link trigger()} this method causes some overhead when * deprecation tracking is enabled even during deduplication, because it * needs to call {@link debug_backtrace()} - * - * @param float|int|string $args */ - public static function triggerIfCalledFromOutside(string $package, string $link, string $message, ...$args): void - { + public static function triggerIfCalledFromOutside( + string $package, + string $link, + string $message, + float|int|string ...$args + ): void { $type = self::$type ?? self::getTypeFromEnv(); if ($type === self::TYPE_NONE) {