Skip to content

Commit

Permalink
Add native type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Dec 30, 2024
1 parent 09f812f commit 7e950e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 12 additions & 8 deletions src/Deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7e950e6

Please sign in to comment.