Skip to content

Commit

Permalink
improve some types on phpdoc (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamband authored Feb 23, 2023
1 parent 06a1dd0 commit 818404c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/Hashids.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public function __construct(
}
}

/**
* Encode parameters to generate a hash.
*
* @param int|string|array<int, int|string> $numbers
*/
public function encode(...$numbers): string
{
$ret = '';
Expand Down Expand Up @@ -150,10 +145,6 @@ public function encode(...$numbers): string
return $ret;
}

/**
* Decode a hash to the original parameter values.
* @return array<int, string>
*/
public function decode(string $hash): array
{
$ret = [];
Expand Down Expand Up @@ -196,7 +187,6 @@ public function decode(string $hash): array
return $ret;
}

/** Encode hexadecimal values and generate a hash string. */
public function encodeHex(string $str): string
{
if (!ctype_xdigit($str)) {
Expand All @@ -213,7 +203,6 @@ public function encodeHex(string $str): string
return $this->encode(...$numbers);
}

/** Decode a hexadecimal hash. */
public function decodeHex(string $hash): string
{
$ret = '';
Expand Down
7 changes: 5 additions & 2 deletions src/HashidsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ interface HashidsInterface
{
/**
* Encode parameters to generate a hash.
* @param int|string|array<int, int|string> $numbers
* @param int|string|array<int, int|string> ...$numbers
*/
public function encode(...$numbers): string;

/** Decode a hash to the original parameter values. */
/**
* Decode a hash to the original parameter values.
* @return array<int, int>|array{}
*/
public function decode(string $hash): array;

/** Encode hexadecimal values and generate a hash string. */
Expand Down

0 comments on commit 818404c

Please sign in to comment.