Skip to content

Commit

Permalink
Merge pull request #77 from greg0ire/type-declarations
Browse files Browse the repository at this point in the history
Add native type declarations
  • Loading branch information
greg0ire authored Dec 30, 2024
2 parents 09f812f + 7e950e6 commit 7769877
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 7769877

Please sign in to comment.