Skip to content

Commit

Permalink
Merge pull request #8431 from LeSuisse/bin2hex-base64-stub
Browse files Browse the repository at this point in the history
Allow *bin2hex and *bin2base64 functions to keep non-empty-string type
  • Loading branch information
AndrolGenhald committed Aug 23, 2022
2 parents 0b790e0 + 4b1adaa commit 034a796
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions stubs/CoreGenericFunctions.phpstub
Expand Up @@ -334,6 +334,22 @@ function fclose(&$stream) : bool
{
}

/**
* @psalm-pure
* @template T as string
* @param T $string
* @return (T is non-empty-string ? non-empty-string : string)
*/
function sodium_bin2base64(string $string, int $id): string

/**
* @psalm-pure
* @template T as string
* @param T $string
* @return (T is non-empty-string ? non-empty-string : string)
*/
function sodium_bin2hex(string $string): string {}

/**
* @param string $string
* @param-out null $string
Expand Down Expand Up @@ -1308,9 +1324,21 @@ function base64_decode(string $string, bool $strict = false) {}
* @psalm-pure
*
* @psalm-flow ($string) -> return
* @template T as string
* @param T $string
* @return (T is non-empty-string ? non-empty-string : string)
*/
function base64_encode(string $string) : string {}

/**
* @psalm-pure
*
* @template T as string
* @param T $string
* @return (T is non-empty-string ? non-empty-string : string)
*/
function bin2hex(string $string): string {}

/**
* @psalm-pure
*
Expand Down

0 comments on commit 034a796

Please sign in to comment.