mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 09:19:40 +01:00
1297 lines
26 KiB
Plaintext
1297 lines
26 KiB
Plaintext
<?php
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TArray as array<TKey, mixed>
|
|
*
|
|
* @param TArray $arr
|
|
* @param mixed $search_value
|
|
* @param bool $strict
|
|
*
|
|
* @return (TArray is non-empty-array ? non-empty-list<TKey> : list<TKey>)
|
|
* @psalm-pure
|
|
*/
|
|
function array_keys(array $arr, $search_value = null, bool $strict = false)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_intersect(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_intersect_key(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_intersect_assoc(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<mixed, TKey> $keys
|
|
* @param array<mixed, TValue> $values
|
|
*
|
|
* @return (
|
|
* PHP_MAJOR_VERSION is 8 ?
|
|
* ($keys is non-empty-array ? non-empty-array<TKey, TValue> : array<TKey, TValue>) :
|
|
* ($keys is non-empty-array ? non-empty-array<TKey, TValue>|false : array<TKey, TValue>|false)
|
|
* )
|
|
* @psalm-ignore-falsable-return
|
|
* @psalm-pure
|
|
*/
|
|
function array_combine(array $keys, array $values)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_diff(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_diff_key(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array $arr2
|
|
* @param array ...$arr3
|
|
*
|
|
* @return array<TKey, TValue>
|
|
* @psalm-pure
|
|
*/
|
|
function array_diff_assoc(array $arr, array $arr2, array ...$arr3)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
*
|
|
* @return array<TValue, TKey>
|
|
* @psalm-pure
|
|
*/
|
|
function array_flip(array $arr)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TArray as array<TKey, mixed>
|
|
*
|
|
* @param TArray $arr
|
|
*
|
|
* @return (TArray is array<empty, empty> ? null : TKey|null)
|
|
* @psalm-pure
|
|
* @psalm-ignore-nullable-return
|
|
*/
|
|
function key($arr)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TArray as array<TKey, mixed>
|
|
*
|
|
* @param TArray $arr
|
|
*
|
|
* @return (TArray is array<empty, empty> ? null : (TArray is non-empty-array ? TKey : TKey|null))
|
|
* @psalm-pure
|
|
*/
|
|
function array_key_first($arr)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TArray as array<TKey, mixed>
|
|
*
|
|
* @param TArray $arr
|
|
*
|
|
* @return (TArray is array<empty, empty> ? null : (TArray is non-empty-array ? TKey : TKey|null))
|
|
* @psalm-pure
|
|
*/
|
|
function array_key_last($arr)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template T
|
|
*
|
|
* @param mixed $needle
|
|
* @param array<T, mixed> $haystack
|
|
* @param bool $strict
|
|
*
|
|
* @return T|false
|
|
* @psalm-pure
|
|
*/
|
|
function array_search($needle, array $haystack, bool $strict = false)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template T
|
|
*
|
|
* @param T[] $arr
|
|
* @param-out list<T> $arr
|
|
*/
|
|
function shuffle(array &$arr): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template T
|
|
*
|
|
* @param T[] $arr
|
|
* @param-out list<T> $arr
|
|
*/
|
|
function sort(array &$arr, int $sort_flags = SORT_REGULAR): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template T
|
|
*
|
|
* @param T[] $arr
|
|
* @param-out list<T> $arr
|
|
*/
|
|
function rsort(array &$arr, int $sort_flags = SORT_REGULAR): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template T
|
|
*
|
|
* @param T[] $arr
|
|
* @param callable(T,T):int $callback
|
|
* @param-out list<T> $arr
|
|
*/
|
|
function usort(array &$arr, callable $callback): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey
|
|
* @psalm-template T
|
|
*
|
|
* @param array<TKey,T> $arr
|
|
* @param callable(T,T):int $callback
|
|
* @param-out array<TKey,T> $arr
|
|
*/
|
|
function uasort(array &$arr, callable $callback): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-template TKey
|
|
* @psalm-template T
|
|
*
|
|
* @param array<TKey,T> $arr
|
|
* @param callable(TKey,TKey):int $callback
|
|
* @param-out array<TKey,T> $arr
|
|
*/
|
|
function uksort(array &$arr, callable $callback): bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-template K of array-key
|
|
* @psalm-template T
|
|
*
|
|
* @param array<K,T> $arr
|
|
*
|
|
* @return array<K,T>
|
|
*/
|
|
function array_change_key_case(array $arr, int $case = CASE_LOWER)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-template TKey as array-key
|
|
*
|
|
* @param TKey $key
|
|
* @param array<TKey, mixed> $search
|
|
*
|
|
* @return bool
|
|
*/
|
|
function array_key_exists($key, array $search) : bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey, TValue> $arr
|
|
* @param array<TKey, TValue> ...$arr2
|
|
*
|
|
* @return array<TKey, TValue>
|
|
*/
|
|
function array_merge_recursive(array $arr, array ...$arr2)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-template TKey as array-key
|
|
* @psalm-template TValue
|
|
*
|
|
* @param array<TKey> $keys
|
|
* @param TValue $value
|
|
*
|
|
* @return array<TKey, TValue>
|
|
*/
|
|
function array_fill_keys(array $keys, $value): array
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-template TKey
|
|
*
|
|
* @param string $pattern
|
|
* @param array<TKey,string> $input
|
|
* @param 0|1 $flags 1=PREG_GREP_INVERT
|
|
* @return array<TKey,string>
|
|
*/
|
|
function preg_grep($pattern, array $input, $flags = 0)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param resource $handle
|
|
* @param-out closed-resource $handle
|
|
*/
|
|
function fclose(&$handle) : bool
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param string $reference
|
|
* @param-out null $reference
|
|
*/
|
|
function sodium_memzero(string &$reference): void
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param mixed $var
|
|
* @param bool $return
|
|
* @return ($return is true ? string : void)
|
|
*
|
|
* @psalm-taint-specialize
|
|
* @psalm-flow ($var) -> return
|
|
* @psalm-taint-sink html $var
|
|
*/
|
|
function var_export($var, bool $return = false) {}
|
|
|
|
/**
|
|
* @param mixed $value
|
|
* @param list<mixed> $values
|
|
* @return string
|
|
*
|
|
* @psalm-taint-specialize
|
|
* @psalm-flow ($value, $values) -> return
|
|
* @psalm-taint-sink html $value
|
|
* @psalm-taint-sink html $values
|
|
*/
|
|
function var_dump($value, ...$values) {}
|
|
|
|
/**
|
|
* @param mixed $var
|
|
* @param bool $return
|
|
* @return ($return is true ? string : true)
|
|
*
|
|
* @psalm-taint-specialize
|
|
* @psalm-flow ($var) -> return
|
|
* @psalm-taint-sink html $var
|
|
*/
|
|
function print_r($var, bool $return = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-taint-sink file $var
|
|
* @param mixed $var
|
|
* @return ($return is true ? string : bool)
|
|
*/
|
|
function highlight_file($var, bool $return = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-taint-sink file $var
|
|
* @param mixed $var
|
|
* @return ($return is true ? string : bool)
|
|
*/
|
|
function show_source($var, bool $return = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-taint-sink file $filename
|
|
*/
|
|
function php_strip_whitespace(string $filename) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param mixed $var
|
|
* @return ($return is true ? string : bool)
|
|
*
|
|
* @psalm-flow ($var) -> return
|
|
*/
|
|
function highlight_string($var, bool $return = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return ($get_as_float is true ? float : string)
|
|
*/
|
|
function microtime(bool $get_as_float = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return ($return_float is true ? float : array<string, int>)
|
|
*/
|
|
function gettimeofday(bool $return_float = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param numeric $number
|
|
* @return ($number is int ? int : ($number is float ? float : int|float))
|
|
*/
|
|
function abs($number) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @template T as string|int|float
|
|
* @template TStep as int|float
|
|
* @param T $start
|
|
* @param T $end
|
|
* @param TStep $step
|
|
* @return (
|
|
* T is int
|
|
* ? (TStep is int ? non-empty-list<int> : non-empty-list<float>)
|
|
* : (
|
|
* T is float
|
|
* ? non-empty-list<float>
|
|
* : (
|
|
* T is string
|
|
* ? non-empty-list<string>
|
|
* : (
|
|
* T is int|float
|
|
* ? non-empty-list<int|float>
|
|
* : non-empty-list<int|float|string>
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
function range($start, $end, $step = 1) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (
|
|
* $format is 'd'|'j'|'N'|'w'|'z'|'W'|'m'|'n'|'t'|'L'|'o'|'Y'|'y'|'B'|'g'|'G'|'h'|'H'|'i'|'s'|'u'|'v'|'Z'|'U'|'I'
|
|
* ? numeric-string
|
|
* : ($timestamp is numeric ? string : string|false)
|
|
* )
|
|
*/
|
|
function date(string $format, int $timestamp = 0) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param mixed $vars
|
|
* @param-out string|int|float|null $vars
|
|
* @psalm-flow ($str, $format) -> return
|
|
* @return (func_num_args() is 2 ? (null|list<float|int|string|null>) : int)
|
|
*/
|
|
function sscanf(string $str, string $format, &...$vars) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (
|
|
* func_num_args() is 1
|
|
* ? array{dirname: string, basename: string, extension?: string, filename: string}
|
|
* : string
|
|
* )
|
|
*/
|
|
function pathinfo(string $path, int $options = \PATHINFO_DIRNAME) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (func_num_args() is 0 ? array<string, string> : string|false)
|
|
*/
|
|
function getenv(string $varname = '', bool $local_only = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (
|
|
* $str is non-empty-string ? non-empty-lowercase-string : lowercase-string
|
|
* )
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function strtolower(string $str) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (
|
|
* $str is non-falsy-string
|
|
* ? non-falsy-string
|
|
* : ($str is non-empty-string ? non-empty-string : string)
|
|
* )
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function strtoupper(string $str) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|array<string> $string
|
|
* @param string|array<string> $replacement
|
|
* @param int|array<int> $start
|
|
* @param null|int|array<int> $length
|
|
*
|
|
* @return ($string is array<string> ? array<string> : string)
|
|
*
|
|
* @psalm-flow ($string, $replacement) -> return
|
|
*/
|
|
function substr_replace($string, $replacement, $start, $length = null) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string $haystack
|
|
*
|
|
* @psalm-return positive-int|0|false
|
|
*/
|
|
function strpos($haystack, $needle, int $offset = 0) : int {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function trim(string $str, string $character_mask = " \t\n\r\0\x0B") : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function ltrim(string $str, string $character_mask = " \t\n\r\0\x0B") : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function rtrim(string $str, string $character_mask = " \t\n\r\0\x0B") : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|array $glue
|
|
* @param array<string|float|int|stringable-object|null|bool> $pieces
|
|
*
|
|
* @return (
|
|
* $glue is non-empty-string
|
|
* ? ($pieces is non-empty-array
|
|
* ? ($pieces is array<literal-string|literal-int>
|
|
* ? ($glue is literal-string ? non-empty-literal-string : non-empty-string)
|
|
* : non-empty-string
|
|
* )
|
|
* : string)
|
|
* : string
|
|
* )
|
|
*
|
|
* @psalm-flow ($glue) -> return
|
|
* @psalm-flow ($pieces) -(array-fetch)-> return
|
|
*/
|
|
function implode($glue, array $pieces = []) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|array $glue
|
|
* @param array<string|float|int|stringable-object|null|bool> $pieces
|
|
*
|
|
* @return (
|
|
* $glue is non-empty-string
|
|
* ? ($pieces is non-empty-array
|
|
* ? ($pieces is array<literal-string|literal-int>
|
|
* ? ($glue is literal-string ? non-empty-literal-string : non-empty-string)
|
|
* : non-empty-string
|
|
* )
|
|
* : string)
|
|
* : string
|
|
* )
|
|
*
|
|
* @psalm-flow ($glue) -> return
|
|
* @psalm-flow ($pieces) -(array-fetch)-> return
|
|
*/
|
|
function join($glue, array $pieces = []): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($string) -(array-assignment)-> return
|
|
*/
|
|
function explode(string $delimiter, string $string, int $limit = -1) : array {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($subject) -(array-assignment)-> return
|
|
*
|
|
* @template TFlags as int-mask<0, 1, 2, 4>
|
|
*
|
|
* @param TFlags $flags
|
|
*
|
|
* @return (TFlags is 0|2 ? non-empty-list<string>|false : (TFlags is 1|3 ? list<string>|false : list<array{string,int}>|false))
|
|
*
|
|
* @psalm-ignore-falsable-return
|
|
*/
|
|
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0) {}
|
|
|
|
/**
|
|
* @param array $input
|
|
*
|
|
* @return (
|
|
* $input is array<int>
|
|
* ? int
|
|
* : ($input is array<float>
|
|
* ? float
|
|
* : float|int
|
|
* )
|
|
* )
|
|
*/
|
|
function array_sum(array $input) {}
|
|
|
|
/**
|
|
* @param array $input
|
|
*
|
|
* @return (
|
|
* $input is array<int>
|
|
* ? int
|
|
* : ($input is array<float>
|
|
* ? float
|
|
* : float|int
|
|
* )
|
|
* )
|
|
*/
|
|
function array_product(array $input) {}
|
|
|
|
/**
|
|
* 257 is FILTER_VALIDATE_INT
|
|
* @psalm-taint-escape ($filter is 257 ? 'html' : null)
|
|
*
|
|
* 258 is FILTER_VALIDATE_BOOLEAN
|
|
* @psalm-taint-escape ($filter is 258 ? 'html' : null)
|
|
*
|
|
* 259 is FILTER_VALIDATE_FLOAT
|
|
* @psalm-taint-escape ($filter is 259 ? 'html' : null)
|
|
*
|
|
* @psalm-flow ($value, $filter, $options) -> return
|
|
*/
|
|
function filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-taint-escape html
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function strip_tags(string $str, ?string $allowable_tags = null) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function stripcslashes(string $str) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function stripslashes(string $str) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* Tainting is handled in a plugin
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function htmlentities(string $string, ?int $quote_style = null, ?string $charset = null, bool $double_encode = true) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* Tainting is handled in a plugin
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function html_entity_decode(string $string, ?int $quote_style = null, ?string $charset = null) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* Tainting is handled in a plugin
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
* @psalm-return (
|
|
* $string is non-empty-string
|
|
* ? non-empty-string
|
|
* : string
|
|
* )
|
|
*/
|
|
function htmlspecialchars(string $string, int $flags = ENT_COMPAT | ENT_HTML401, ?string $encoding = 'UTF-8', bool $double_encode = true) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* Tainting is handled in a plugin
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function htmlspecialchars_decode(string $string, ?int $quote_style = null) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-return (
|
|
* $string is non-empty-string
|
|
* ? positive-int
|
|
* : int
|
|
* )
|
|
*/
|
|
function strlen(string $string) : int {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|array<string|int|float> $search
|
|
* @param string|array<string|int|float> $replace
|
|
* @param string|array<string|int|float> $subject
|
|
* @param int $count
|
|
* @return ($subject is array ? array<string> : string)
|
|
*
|
|
* @psalm-flow ($replace, $subject) -> return
|
|
*/
|
|
function str_replace($search, $replace, $subject, &$count = null) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|array<string|int|float> $search
|
|
* @param string|array<string|int|float> $replace
|
|
* @param string|array<string|int|float> $subject
|
|
* @param int $count
|
|
* @return ($subject is array ? array<string> : string)
|
|
*
|
|
* @psalm-flow ($replace, $subject) -> return
|
|
*/
|
|
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 {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function str_rot13(string $str): string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function str_shuffle(string $str): string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return ($split_length is positive-int ? list<string> : false)
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function str_split(string $string, int $split_length = 1) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($haystack) -> return
|
|
*/
|
|
function strstr(string $haystack, string $needle, bool $before_needle = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($haystack) -> return
|
|
*/
|
|
function stristr(string $haystack, string $needle, bool $before_needle = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($haystack) -> return
|
|
*/
|
|
function strchr(string $haystack, string $needle, bool $before_needle = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($haystack) -> return
|
|
*/
|
|
function strpbrk(string $haystack, string $char_list) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($haystack) -> return
|
|
*/
|
|
function strrchr(string $haystack, string $needle) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function strrev(string $string): string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param 0|1|2 $format
|
|
* @return (
|
|
* $format is 0 ?
|
|
* int :
|
|
* (
|
|
* $format is 1 ?
|
|
* list<string> :
|
|
* array<int, string>
|
|
* )
|
|
* )
|
|
*/
|
|
function str_word_count(string $string, int $format = 0, string|null $characters = null) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|string[] $pattern
|
|
* @param string|array<string|int|float> $replacement
|
|
* @param string|array<string|int|float> $subject
|
|
* @param int $count
|
|
* @return ($subject is array ? array<string> : string|null)
|
|
*
|
|
* @psalm-flow ($replacement, $subject) -> return
|
|
*/
|
|
function preg_filter($pattern, $replacement, $subject, int $limit = -1, &$count = null) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|string[] $search
|
|
* @param string|array<string|int|float> $replace
|
|
* @param string|array<string|int|float> $subject
|
|
* @param int $count
|
|
* @return ($subject is array ? array<string>|null : string|null)
|
|
*
|
|
* @psalm-flow ($replace, $subject) -> return
|
|
*/
|
|
function preg_replace($search, $replace, $subject, int $limit = -1, &$count = null) {}
|
|
|
|
/**
|
|
* @param string|string[] $search
|
|
* @param callable(string[]):string $replace
|
|
* @param string|array<string|int|float> $subject
|
|
* @param int $count
|
|
* @return ($subject is array ? array<string>|null : string|null)
|
|
*
|
|
* @psalm-taint-specialize
|
|
* @psalm-flow ($subject) -> return
|
|
*/
|
|
function preg_replace_callback($search, $replace, $subject, int $limit = -1, &$count = null, int $flags = 0) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @template TFlags as int
|
|
*
|
|
* @param string $pattern
|
|
* @param string $subject
|
|
* @param mixed $matches
|
|
* @param TFlags $flags
|
|
* @param-out (
|
|
* TFlags is 1
|
|
* ? array<list<string>>
|
|
* : (TFlags is 2
|
|
* ? list<array<string>>
|
|
* : (TFlags is 256|257
|
|
* ? array<list<array{string, int}>>
|
|
* : (TFlags is 258
|
|
* ? list<array<array{string, int}>>
|
|
* : (TFlags is 512|513
|
|
* ? array<list<?string>>
|
|
* : (TFlags is 514
|
|
* ? list<array<?string>>
|
|
* : (TFlags is 770
|
|
* ? list<array<array{?string, int}>>
|
|
* : array
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* ) $matches
|
|
* @return int|false
|
|
* @psalm-ignore-falsable-return
|
|
*/
|
|
function preg_match_all($pattern, $subject, &$matches = [], int $flags = 1, int $offset = 0) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return (PHP_MAJOR_VERSION is 5|7 ? string|false : string)
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($string) -> return
|
|
*/
|
|
function substr(string $string, int $start, ?int $length = null) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function preg_quote(string $str, ?string $delimiter = null) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|int|float $args
|
|
*
|
|
* @psalm-flow ($format, $args) -> return
|
|
*/
|
|
function sprintf(string $format, ...$args) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($format, $args) -> return
|
|
*/
|
|
function vsprintf(string $format, array $args) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @return string
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|int|float $values
|
|
*
|
|
* @psalm-taint-specialize
|
|
* @psalm-flow ($format, $values) -> return
|
|
* @psalm-taint-sink html $format
|
|
* @psalm-taint-sink html $values
|
|
*/
|
|
function printf(string $format, ...$values) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return string|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($path) -> return
|
|
*/
|
|
function realpath(string $path) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param numeric-string $left_operand
|
|
* @param numeric-string $right_operand
|
|
* @return (PHP_MAJOR_VERSION is 8 ? numeric-string : ($right_operand is "0" ? null : numeric-string))
|
|
*/
|
|
function bcdiv(string $left_operand, string $right_operand, int $scale = 0): ?string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param scalar|null|object $var
|
|
* @return string The string value of var.
|
|
*
|
|
* @psalm-flow ($var) -> return
|
|
*/
|
|
function strval ($var): string {}
|
|
|
|
/**
|
|
* @return ($input is non-empty-string ? non-empty-list<string> : non-empty-list<string>|array{null})
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($input) -> return
|
|
*/
|
|
function str_getcsv(string $input, string $delimiter = ',', string $enclosure = '"', string $escape = '\\\\')
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @template TKey as array-key
|
|
*
|
|
* @param array<mixed, TKey> $array
|
|
*
|
|
* @return array<TKey, positive-int>
|
|
*
|
|
* @psalm-pure
|
|
*/
|
|
function array_count_values(array $array): array {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function addcslashes(string $str, string $charlist) : string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function addslashes(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function ucfirst(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str, $delimiters) -> return
|
|
*/
|
|
function ucwords (string $str, string $delimiters = " \t\r\n\f\v"): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function lcfirst(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function nl2br(string $str, bool $is_xhtml = false): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function quoted_printable_decode(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function quoted_printable_encode(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function quotemeta(string $str): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($str) -> return
|
|
*/
|
|
function chop(string $str, string $character_mask = " \t\n\r\0\x0B"): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
* @psalm-flow ($str, $end) -> return
|
|
*/
|
|
function chunk_split(string $str, int $chunklen = 76, string $end= ''): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($data) -> return
|
|
*/
|
|
function convert_uudecode(string $data): string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($data) -> return
|
|
*/
|
|
function convert_uuencode(string $data) : string
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-taint-escape ldap
|
|
* @psalm-flow ($value) -> return
|
|
*/
|
|
function ldap_escape(string $value, string $ignore = "", int $flag = 0) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return mixed
|
|
* @psalm-flow ($json) -> return
|
|
*/
|
|
function json_decode(string $json, ?bool $associative = null, int $depth = 512, int $flags = 0) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return ($flags is 4194304 ? string : string|false)
|
|
*
|
|
* @psalm-flow ($value) -> return
|
|
* @psalm-ignore-falsable-return
|
|
*/
|
|
function json_encode(mixed $value, int $flags = 0, int $depth = 512) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return string|false
|
|
*
|
|
* @psalm-flow ($values) -> return
|
|
* @psalm-ignore-falsable-return
|
|
*/
|
|
function pack(string $format, mixed ...$values) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param string|int $in_codepage
|
|
* @param string|int $out_codepage
|
|
* @psalm-flow ($subject) -> return
|
|
*/
|
|
function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($prefix) -> return
|
|
*/
|
|
function uniqid(string $prefix = "", bool $more_entropy = false) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return array|false
|
|
* @psalm-ignore-falsable-return
|
|
*
|
|
* @psalm-flow ($data) -> return
|
|
*/
|
|
function unpack(string $format, string $data, int $offset = 0) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return string|false
|
|
*
|
|
* @psalm-flow ($data) -> return
|
|
* @psalm-ignore-falsable-return
|
|
*/
|
|
function base64_decode(string $data, bool $strict = false) {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @psalm-flow ($data) -> return
|
|
*/
|
|
function base64_encode(string $data) : string {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @param resource|null $context
|
|
*
|
|
* @return ($format is 0 ? list<string> : array<string, string|list<string>>)|false
|
|
*
|
|
* @psalm-taint-sink ssrf $url
|
|
*/
|
|
function get_headers(string $url, int $format = 0, $context = null) : array|false {}
|
|
|
|
/**
|
|
* @psalm-pure
|
|
*
|
|
* @return array<lowercase-string, string>|false
|
|
*
|
|
* @psalm-taint-sink ssrf $filename
|
|
*/
|
|
function get_meta_tags(string $filename, bool $use_include_path = false) : array|false {}
|
|
|
|
/**
|
|
* @return ($categorize is false ? array<string,int|string|float|bool|null|array|resource> : array<string, array<string,int|string|float|bool|null|array|resource>>)
|
|
*/
|
|
function get_defined_constants(bool $categorize = false): array {}
|