Skip to content

Commit

Permalink
Detailed return types for str_pad() and str_repeat()
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Jul 14, 2021
1 parent 09b0167 commit a5a2377
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions stubs/CoreGenericFunctions.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,26 @@ function str_ireplace($search, $replace, $subject, &$count = null) {}
/**
* @psalm-pure
*
* @return ($input is non-empty-string ? non-empty-string : ($pad_length is positive-int ? non-empty-string: string))
*
* @psalm-flow ($input, $pad_string) -> return
*/
function str_pad(string $input, int $pad_length, $pad_string = '', int $pad_type = STR_PAD_RIGHT): string {}

/**
* @psalm-pure
*
* @todo update $multiplier to be `0|positive-int`
* @return (
* $input is non-empty-string
* ? (
* $multiplier is positive-int
* ? non-empty-string
* : ($multiplier is 0 ? '' : string)
* )
* : ($multiplier is 0 ? '' : string)
* )
*
* @psalm-flow ($input) -> return
*/
function str_repeat(string $input, int $multiplier): string {}
Expand Down

0 comments on commit a5a2377

Please sign in to comment.