2017-02-11 00:12:59 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2022-01-16 21:45:58 +01:00
|
|
|
* @psalm-template TArray as array
|
2017-02-11 00:12:59 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param TArray $array
|
2020-04-17 21:07:41 +02:00
|
|
|
* @param mixed $search_value
|
|
|
|
* @param bool $strict
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2022-01-16 21:45:58 +01:00
|
|
|
* @return (TArray is non-empty-array ? non-empty-list<key-of<TArray>> : list<key-of<TArray>>)
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-02-11 00:12:59 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_keys(array $array, $search_value = null, bool $strict = false)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2017-02-11 00:12:59 +01:00
|
|
|
|
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2017-02-11 00:12:59 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2017-02-11 00:12:59 +01:00
|
|
|
* @return array<TKey, TValue>
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-02-11 00:12:59 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_intersect(array $array, array ...$arrays)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2017-02-11 00:12:59 +01:00
|
|
|
|
2018-01-25 07:04:26 +01:00
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2018-01-25 07:04:26 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2018-01-25 07:04:26 +01:00
|
|
|
* @return array<TKey, TValue>
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2018-01-25 07:04:26 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_intersect_key(array $array, array ...$arrays)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2018-01-25 07:04:26 +01:00
|
|
|
|
2020-10-06 15:13:19 +02:00
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2020-01-07 17:40:23 +01:00
|
|
|
*
|
|
|
|
* @return array<TKey, TValue>
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_intersect_assoc(array $array, array ...$arrays)
|
2020-01-07 17:40:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-02-11 00:12:59 +01:00
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2017-02-11 00:12:59 +01:00
|
|
|
*
|
2021-07-27 17:05:27 +02:00
|
|
|
* @param array<mixed, TKey> $keys
|
|
|
|
* @param array<mixed, TValue> $values
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2021-03-16 18:43:49 +01:00
|
|
|
* @return (
|
|
|
|
* PHP_MAJOR_VERSION is 8 ?
|
2021-07-27 17:05:27 +02:00
|
|
|
* ($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)
|
2021-03-16 18:43:49 +01:00
|
|
|
* )
|
2019-05-05 22:42:36 +02:00
|
|
|
* @psalm-ignore-falsable-return
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-02-11 00:12:59 +01:00
|
|
|
*/
|
2021-07-27 17:05:27 +02:00
|
|
|
function array_combine(array $keys, array $values)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2017-02-11 00:12:59 +01:00
|
|
|
|
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2017-02-11 00:12:59 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2017-02-11 00:12:59 +01:00
|
|
|
* @return array<TKey, TValue>
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-02-11 00:12:59 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_diff(array $array, array ...$arrays)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2017-02-11 00:12:59 +01:00
|
|
|
|
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2017-02-11 00:12:59 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2017-02-11 00:12:59 +01:00
|
|
|
* @return array<TKey, TValue>
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-02-11 00:12:59 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_diff_key(array $array, array ...$arrays)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2017-02-11 00:12:59 +01:00
|
|
|
|
2020-01-07 17:40:23 +01:00
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
|
|
|
* @param array ...$arrays
|
2020-01-07 17:40:23 +01:00
|
|
|
*
|
|
|
|
* @return array<TKey, TValue>
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_diff_assoc(array $array, array ...$arrays)
|
2020-01-07 17:40:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-02-22 00:59:31 +01:00
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template TValue
|
2018-02-22 00:59:31 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> $array
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2023-04-13 22:19:44 +02:00
|
|
|
* @return ($array is non-empty-array ? non-empty-array<TValue, TKey> : array<TValue, TKey>)
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2018-02-22 00:59:31 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_flip(array $array)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2018-02-22 00:59:31 +01:00
|
|
|
|
2023-02-20 11:46:14 +01:00
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
* @psalm-template TArray as array<TKey, TValue>
|
|
|
|
*
|
|
|
|
* @param TArray $array
|
|
|
|
*
|
|
|
|
* @return (TArray is non-empty-array ? non-empty-array<TKey, TValue> : array<TKey, TValue>)
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
|
|
|
function array_unique(array $array, int $flags = 0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-04-05 06:21:14 +02:00
|
|
|
/**
|
2019-01-05 06:15:53 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2020-07-15 15:49:30 +02:00
|
|
|
* @psalm-template TArray as array<TKey, mixed>
|
2018-04-05 06:21:14 +02:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param TArray $array
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2022-11-08 10:25:04 +01:00
|
|
|
* @return (TArray is array<never, never> ? null : (TArray is non-empty-list ? int<0,max> : (TArray is non-empty-array ? TKey : TKey|null)))
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2020-07-22 05:16:56 +02:00
|
|
|
* @psalm-ignore-nullable-return
|
2018-04-05 06:21:14 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function key($array)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2018-04-05 06:21:14 +02:00
|
|
|
|
2019-11-27 16:59:12 +01:00
|
|
|
/**
|
2022-10-14 00:58:12 +02:00
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
* @psalm-template TArray as array<TKey, TValue>
|
|
|
|
*
|
|
|
|
* @param TArray $array
|
|
|
|
*
|
2022-11-08 10:25:04 +01:00
|
|
|
* @return (TArray is array<never, never> ? false : (TArray is non-empty-array ? TValue : TValue|false))
|
2022-10-14 00:58:12 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*/
|
|
|
|
function current($array)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
* @psalm-template TArray as array<TKey, TValue>
|
|
|
|
*
|
|
|
|
* @param TArray $array
|
|
|
|
*
|
2022-11-08 10:25:04 +01:00
|
|
|
* @return (TArray is array<never, never> ? false : (TArray is non-empty-array ? TValue : TValue|false))
|
2022-10-14 00:58:12 +02:00
|
|
|
*/
|
|
|
|
function reset(&$array)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
* @psalm-template TArray as array<TKey, TValue>
|
|
|
|
*
|
|
|
|
* @param TArray $array
|
|
|
|
*
|
2022-11-08 10:25:04 +01:00
|
|
|
* @return (TArray is array<never, never> ? false : (TArray is non-empty-array ? TValue : TValue|false))
|
2022-10-14 00:58:12 +02:00
|
|
|
*/
|
|
|
|
function end(&$array)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-11-27 16:59:12 +01:00
|
|
|
/**
|
|
|
|
* @psalm-template TKey as array-key
|
2020-07-15 15:49:30 +02:00
|
|
|
* @psalm-template TArray as array<TKey, mixed>
|
2019-11-27 16:59:12 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param TArray $array
|
2019-11-27 16:59:12 +01:00
|
|
|
*
|
2022-01-16 21:45:58 +01:00
|
|
|
* @return (TArray is array<never, never> ? null : (TArray is non-empty-array ? key-of<TArray> : key-of<TArray>|null))
|
2019-11-27 16:59:12 +01:00
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_key_first($array)
|
2019-11-27 16:59:12 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-01-16 21:45:58 +01:00
|
|
|
* @psalm-template TArray as array
|
2019-11-27 16:59:12 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param TArray $array
|
2019-11-27 16:59:12 +01:00
|
|
|
*
|
2022-01-16 21:45:58 +01:00
|
|
|
* @return (TArray is array<never, never> ? null : (TArray is non-empty-array ? key-of<TArray> : key-of<TArray>|null))
|
2019-11-27 16:59:12 +01:00
|
|
|
* @psalm-pure
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_key_last($array)
|
2019-11-27 16:59:12 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-25 22:08:44 +01:00
|
|
|
/**
|
|
|
|
* @psalm-template TArray as array
|
|
|
|
*
|
|
|
|
* @param TArray $array
|
|
|
|
*
|
|
|
|
* @return (TArray is non-empty-array ? non-empty-list<value-of<TArray>> : list<value-of<TArray>>)
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
|
|
|
function array_values($array)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-12-30 14:47:00 +01:00
|
|
|
/**
|
2018-12-02 20:59:08 +01:00
|
|
|
* @psalm-template T
|
2017-12-30 14:47:00 +01:00
|
|
|
*
|
|
|
|
* @param mixed $needle
|
|
|
|
* @param array<T, mixed> $haystack
|
|
|
|
* @param bool $strict
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2017-12-30 14:47:00 +01:00
|
|
|
* @return T|false
|
2019-09-08 17:32:04 +02:00
|
|
|
* @psalm-pure
|
2017-12-30 14:47:00 +01:00
|
|
|
*/
|
2019-07-05 22:24:00 +02:00
|
|
|
function array_search($needle, array $haystack, bool $strict = false)
|
|
|
|
{
|
|
|
|
}
|
2019-01-20 00:11:39 +01:00
|
|
|
|
2020-01-01 21:07:34 +01:00
|
|
|
/**
|
2020-01-07 17:40:23 +01:00
|
|
|
* @psalm-template T
|
2022-04-28 16:07:43 +02:00
|
|
|
* @psalm-template TArray as array<T>
|
2020-01-01 21:07:34 +01:00
|
|
|
*
|
2022-04-28 16:07:43 +02:00
|
|
|
* @param TArray $array
|
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-list<T> : list<T>) $array
|
2020-01-01 21:07:34 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function shuffle(array &$array): bool
|
2020-01-01 21:07:34 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-20 00:11:39 +01:00
|
|
|
/**
|
2020-01-07 17:40:23 +01:00
|
|
|
* @psalm-template T
|
2022-04-28 15:44:39 +02:00
|
|
|
* @psalm-template TArray as array<T>
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2022-04-23 15:51:50 +02:00
|
|
|
* @param TArray $array
|
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-list<T> : list<T>) $array
|
2020-01-07 17:40:23 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function sort(array &$array, int $flags = SORT_REGULAR): bool
|
2020-01-07 17:40:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-template T
|
2022-04-28 16:01:17 +02:00
|
|
|
* @psalm-template TArray as array<T>
|
2020-01-07 17:40:23 +01:00
|
|
|
*
|
2022-04-28 16:01:17 +02:00
|
|
|
* @param TArray $array
|
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-list<T> : list<T>) $array
|
2020-01-07 17:40:23 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function rsort(array &$array, int $flags = SORT_REGULAR): bool
|
2020-01-07 17:40:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-template T
|
2022-04-28 17:36:28 +02:00
|
|
|
* @psalm-template TArray as array<T>
|
2020-01-07 17:40:23 +01:00
|
|
|
*
|
2022-04-28 17:36:28 +02:00
|
|
|
* @param TArray $array
|
2019-01-20 00:11:39 +01:00
|
|
|
* @param callable(T,T):int $callback
|
2022-04-28 17:36:28 +02:00
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-list<T> : list<T>) $array
|
2019-01-20 00:11:39 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function usort(array &$array, callable $callback): bool
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2019-01-20 00:11:39 +01:00
|
|
|
|
2019-12-09 03:30:19 +01:00
|
|
|
/**
|
2020-01-07 17:40:23 +01:00
|
|
|
* @psalm-template TKey
|
|
|
|
* @psalm-template T
|
2022-04-28 16:49:32 +02:00
|
|
|
* @psalm-template TArray as array<TKey,T>
|
2019-12-09 03:30:19 +01:00
|
|
|
*
|
2022-04-28 16:49:32 +02:00
|
|
|
* @param TArray $array
|
2019-12-09 03:30:19 +01:00
|
|
|
* @param callable(T,T):int $callback
|
2022-04-28 16:49:32 +02:00
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-array<TKey,T> : array<TKey,T>) $array
|
2019-12-09 03:30:19 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function uasort(array &$array, callable $callback): bool
|
2019-12-09 03:30:19 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-01-07 17:40:23 +01:00
|
|
|
/**
|
|
|
|
* @psalm-template TKey
|
|
|
|
* @psalm-template T
|
2022-04-28 17:23:57 +02:00
|
|
|
* @psalm-template TArray as array<TKey,T>
|
2020-01-07 17:40:23 +01:00
|
|
|
*
|
2022-04-28 17:23:57 +02:00
|
|
|
* @param TArray $array
|
2020-01-07 17:40:23 +01:00
|
|
|
* @param callable(TKey,TKey):int $callback
|
2022-04-28 17:23:57 +02:00
|
|
|
* @param-out (TArray is non-empty-array ? non-empty-array<TKey,T> : array<TKey,T>) $array
|
2020-01-07 17:40:23 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function uksort(array &$array, callable $callback): bool
|
2020-01-07 17:40:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-01 00:40:40 +01:00
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-04-28 04:49:07 +02:00
|
|
|
* @psalm-template K of array-key
|
2019-02-01 00:40:40 +01:00
|
|
|
* @psalm-template T
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<K,T> $array
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2020-04-28 04:49:07 +02:00
|
|
|
* @return array<K,T>
|
2019-02-01 00:40:40 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_change_key_case(array $array, int $case = CASE_LOWER)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2019-02-01 00:40:40 +01:00
|
|
|
|
2019-03-17 23:52:42 +01:00
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2019-03-17 23:52:42 +01:00
|
|
|
* @psalm-template TKey as array-key
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2019-03-17 23:52:42 +01:00
|
|
|
* @param TKey $key
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, mixed> $array
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2019-03-17 23:52:42 +01:00
|
|
|
* @return bool
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_key_exists($key, array $array) : bool
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2019-03-29 00:43:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2022-12-18 14:52:44 +01:00
|
|
|
* @no-named-arguments
|
|
|
|
*
|
2019-03-29 00:43:14 +01:00
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array<TKey, TValue> ...$arrays
|
2019-07-05 22:24:00 +02:00
|
|
|
*
|
2019-03-29 00:43:14 +01:00
|
|
|
* @return array<TKey, TValue>
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_merge_recursive(array ...$arrays)
|
2019-07-05 22:24:00 +02:00
|
|
|
{
|
|
|
|
}
|
2019-12-27 14:30:42 +01:00
|
|
|
|
2022-12-18 14:50:51 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-02-16 20:34:39 +01:00
|
|
|
*
|
2022-12-18 14:50:51 +01:00
|
|
|
* @no-named-arguments
|
|
|
|
*
|
|
|
|
* @psalm-template TKey as array-key
|
|
|
|
* @psalm-template TValue
|
|
|
|
*
|
|
|
|
* @param array<TKey, TValue> ...$arrays
|
|
|
|
*
|
|
|
|
* @return array<TKey, TValue>
|
|
|
|
*/
|
|
|
|
function array_merge(array ...$arrays)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-12-27 14:30:42 +01:00
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2019-12-27 14:30:42 +01:00
|
|
|
* @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
|
|
|
|
{
|
|
|
|
}
|
2019-12-29 17:05:08 +01:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-01-07 17:40:23 +01:00
|
|
|
* @psalm-template TKey
|
2019-12-29 17:05:08 +01:00
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param non-empty-string $pattern
|
|
|
|
* @param array<TKey, string> $array
|
2019-12-29 17:05:08 +01:00
|
|
|
* @param 0|1 $flags 1=PREG_GREP_INVERT
|
2023-06-30 17:08:03 +02:00
|
|
|
* @return array<TKey, string>
|
2019-12-29 17:05:08 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function preg_grep($pattern, array $array, $flags = 0)
|
2019-12-29 17:05:08 +01:00
|
|
|
{
|
|
|
|
}
|
2020-01-17 19:12:00 +01:00
|
|
|
|
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param resource $stream
|
2021-11-04 16:10:59 +01:00
|
|
|
* @param-out closed-resource $stream
|
2020-01-17 19:12:00 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function fclose(&$stream) : bool
|
2020-01-17 19:12:00 +01:00
|
|
|
{
|
|
|
|
}
|
2020-03-02 21:33:03 +01:00
|
|
|
|
2022-08-23 14:01:44 +02:00
|
|
|
/**
|
|
|
|
* @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 {}
|
|
|
|
|
2020-03-02 21:33:03 +01:00
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param string $string
|
2021-11-04 16:10:59 +01:00
|
|
|
* @param-out null $string
|
2020-03-02 21:33:03 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function sodium_memzero(string &$string): void
|
2020-03-02 21:33:03 +01:00
|
|
|
{
|
2020-04-07 22:48:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param mixed $value
|
2020-04-07 22:48:29 +02:00
|
|
|
* @param bool $return
|
|
|
|
* @return ($return is true ? string : void)
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2020-05-26 20:18:43 +02:00
|
|
|
* @psalm-taint-specialize
|
2021-11-04 16:10:59 +01:00
|
|
|
* @psalm-flow ($value) -> return
|
|
|
|
* @psalm-taint-sink html $value
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function var_export($value, bool $return = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
2021-05-24 22:42:18 +02:00
|
|
|
/**
|
|
|
|
* @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) {}
|
|
|
|
|
2020-04-07 22:48:29 +02:00
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param mixed $value
|
2020-04-07 22:48:29 +02:00
|
|
|
* @param bool $return
|
|
|
|
* @return ($return is true ? string : true)
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2020-05-26 20:18:43 +02:00
|
|
|
* @psalm-taint-specialize
|
2021-11-04 16:10:59 +01:00
|
|
|
* @psalm-flow ($value) -> return
|
|
|
|
* @psalm-taint-sink html $value
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function print_r($value, bool $return = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-taint-sink file $filename
|
|
|
|
* @param mixed $filename
|
2020-04-07 22:48:29 +02:00
|
|
|
* @return ($return is true ? string : bool)
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function highlight_file($filename, bool $return = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
2020-11-22 18:09:55 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-taint-sink file $filename
|
|
|
|
* @param mixed $filename
|
2020-11-22 18:09:55 +01:00
|
|
|
* @return ($return is true ? string : bool)
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function show_source($filename, bool $return = false) {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-sink file $filename
|
|
|
|
*/
|
|
|
|
function php_strip_whitespace(string $filename) : string {}
|
|
|
|
|
2020-04-07 22:48:29 +02:00
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param mixed $string
|
2020-04-07 22:48:29 +02:00
|
|
|
* @return ($return is true ? string : bool)
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2021-11-04 16:10:59 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function highlight_string($string, bool $return = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @return ($as_float is true ? float : string)
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function microtime(bool $as_float = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @return ($as_float is true ? float : array<string, int>)
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function gettimeofday(bool $as_float = false) {}
|
2020-04-07 22:48:29 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param numeric $num
|
2021-12-07 11:52:13 +01:00
|
|
|
* @return ($num is int ? positive-int|0 : ($num is float ? float : positive-int|0|float))
|
2020-04-07 22:48:29 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function abs($num) {}
|
2020-04-08 01:59:20 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-04-08 01:59:20 +02:00
|
|
|
* @template T as string|int|float
|
|
|
|
* @template TStep as int|float
|
|
|
|
* @param T $start
|
|
|
|
* @param T $end
|
|
|
|
* @param TStep $step
|
|
|
|
* @return (
|
|
|
|
* T is int
|
2021-04-09 17:28:48 +02:00
|
|
|
* ? (TStep is int ? non-empty-list<int> : non-empty-list<float>)
|
2020-04-08 01:59:20 +02:00
|
|
|
* : (
|
|
|
|
* T is float
|
2020-11-28 02:09:53 +01:00
|
|
|
* ? non-empty-list<float>
|
2020-04-08 01:59:20 +02:00
|
|
|
* : (
|
|
|
|
* T is string
|
2020-11-28 02:09:53 +01:00
|
|
|
* ? non-empty-list<string>
|
2020-04-08 01:59:20 +02:00
|
|
|
* : (
|
|
|
|
* T is int|float
|
2020-11-28 02:09:53 +01:00
|
|
|
* ? non-empty-list<int|float>
|
|
|
|
* : non-empty-list<int|float|string>
|
2020-04-08 01:59:20 +02:00
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
function range($start, $end, $step = 1) {}
|
2020-04-15 03:07:44 +02:00
|
|
|
|
2020-05-11 05:58:51 +02:00
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-05-11 05:58:51 +02:00
|
|
|
* @param mixed $vars
|
2021-06-07 19:19:17 +02:00
|
|
|
* @param-out string|int|float|null $vars
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string, $format) -> return
|
2021-06-07 19:19:17 +02:00
|
|
|
* @return (func_num_args() is 2 ? (null|list<float|int|string|null>) : int)
|
2020-05-11 05:58:51 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function sscanf(string $string, string $format, &...$vars) {}
|
2020-05-11 17:36:50 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-05-11 17:36:50 +02:00
|
|
|
* @return (
|
|
|
|
* func_num_args() is 1
|
2022-11-12 02:14:21 +01:00
|
|
|
* ? array{dirname: string, basename: string, extension?: string, filename: string}
|
2020-05-11 17:36:50 +02:00
|
|
|
* : string
|
|
|
|
* )
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function pathinfo(string $path, int $flags = \PATHINFO_DIRNAME) {}
|
2020-05-11 17:36:50 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-05-11 17:36:50 +02:00
|
|
|
* @return (func_num_args() is 0 ? array<string, string> : string|false)
|
|
|
|
*/
|
|
|
|
function getenv(string $varname = '', bool $local_only = false) {}
|
2020-05-15 16:18:05 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-05-15 16:18:05 +02:00
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $string is non-empty-string ? non-empty-lowercase-string : lowercase-string
|
2020-05-15 16:18:05 +02:00
|
|
|
* )
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-05-15 16:18:05 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function strtolower(string $string) : string {}
|
2020-05-15 16:18:05 +02:00
|
|
|
|
|
|
|
/**
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-07-15 20:15:08 +02:00
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $string is non-falsy-string
|
2021-07-15 20:40:18 +02:00
|
|
|
* ? non-falsy-string
|
2021-11-04 10:27:07 +01:00
|
|
|
* : ($string is non-empty-string ? non-empty-string : string)
|
2021-07-15 20:15:08 +02:00
|
|
|
* )
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-05-22 04:47:58 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function strtoupper(string $string) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
2020-11-21 23:35:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @param string|array<string> $string
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param string|array<string> $replace
|
|
|
|
* @param int|array<int> $offset
|
2020-11-21 23:35:07 +01:00
|
|
|
* @param null|int|array<int> $length
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @return ($string is array ? array<string> : string)
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string, $replace) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function substr_replace($string, $replace, $offset, $length = null) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
2020-09-01 15:17:57 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-09-01 23:23:26 +02:00
|
|
|
* @param string $haystack
|
2023-05-14 18:52:55 +02:00
|
|
|
* @param string $needle
|
|
|
|
* @param int $offset
|
|
|
|
* @psalm-assert-if-true =non-empty-string $haystack
|
|
|
|
* @psalm-return positive-int|0|false
|
|
|
|
*/
|
|
|
|
function strpos(string $haystack, string $needle, int $offset = 0) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
* @param string $haystack
|
|
|
|
* @param string $needle
|
|
|
|
* @param int $offset
|
|
|
|
* @psalm-assert-if-true =non-empty-string $haystack
|
2020-09-01 15:17:57 +02:00
|
|
|
* @psalm-return positive-int|0|false
|
|
|
|
*/
|
2023-05-14 18:52:55 +02:00
|
|
|
function stripos(string $haystack, string $needle, int $offset = 0) {}
|
2020-09-01 15:17:57 +02:00
|
|
|
|
2020-06-22 23:53:03 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2022-08-31 11:02:20 +02:00
|
|
|
* @return (
|
|
|
|
* $string is class-string
|
|
|
|
* ? ($characters is '\\' ? class-string : string)
|
|
|
|
* : ($string is lowercase-string ? lowercase-string : string)
|
|
|
|
* )
|
|
|
|
*
|
2021-10-07 20:10:36 +02:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-06-22 23:53:03 +02:00
|
|
|
*/
|
2021-10-07 20:10:36 +02:00
|
|
|
function trim(string $string, string $characters = " \t\n\r\0\x0B") : string {}
|
2020-06-22 23:53:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2022-08-31 11:02:20 +02:00
|
|
|
* @return (
|
|
|
|
* $string is class-string
|
|
|
|
* ? ($characters is '\\' ? class-string : string)
|
|
|
|
* : ($string is lowercase-string ? lowercase-string : string)
|
|
|
|
* )
|
2022-07-06 02:36:20 +02:00
|
|
|
*
|
2021-10-07 20:10:36 +02:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-06-22 23:53:03 +02:00
|
|
|
*/
|
2021-10-07 20:10:36 +02:00
|
|
|
function ltrim(string $string, string $characters = " \t\n\r\0\x0B") : string {}
|
2020-06-22 23:53:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2022-08-31 11:02:20 +02:00
|
|
|
* @return ($string is lowercase-string ? lowercase-string : string)
|
|
|
|
*
|
2021-10-07 20:10:36 +02:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-06-22 23:53:03 +02:00
|
|
|
*/
|
2021-10-07 20:10:36 +02:00
|
|
|
function rtrim(string $string, string $characters = " \t\n\r\0\x0B") : string {}
|
2020-06-22 23:53:03 +02:00
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param string|array $separator
|
|
|
|
* @param array<string|float|int|stringable-object|null|bool> $array
|
2020-05-15 16:18:05 +02:00
|
|
|
*
|
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $separator is non-empty-string
|
|
|
|
* ? ($array is non-empty-array
|
|
|
|
* ? ($array is array<literal-string|literal-int>
|
|
|
|
* ? ($separator is literal-string ? non-empty-literal-string : non-empty-string)
|
2021-06-15 05:24:09 +02:00
|
|
|
* : non-empty-string
|
|
|
|
* )
|
2020-05-15 16:18:05 +02:00
|
|
|
* : string)
|
2022-05-14 16:44:43 +02:00
|
|
|
* : ($array is non-empty-array
|
|
|
|
* ? ($array is array<non-empty-literal-string|non-empty-string>
|
|
|
|
* ? ($array is array<non-empty-literal-string> ? non-empty-literal-string : non-empty-string)
|
|
|
|
* : string
|
|
|
|
* )
|
|
|
|
* : string)
|
2020-05-15 16:18:05 +02:00
|
|
|
* )
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($separator) -> return
|
|
|
|
* @psalm-flow ($array) -(array-fetch)-> return
|
2020-05-15 16:18:05 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function implode($separator, array $array = []) : string {}
|
2020-05-18 23:23:21 +02:00
|
|
|
|
2020-11-16 21:50:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param string|array $separator
|
|
|
|
* @param array<string|float|int|stringable-object|null|bool> $array
|
2020-11-16 21:50:07 +01:00
|
|
|
*
|
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $separator is non-empty-string
|
|
|
|
* ? ($array is non-empty-array
|
|
|
|
* ? ($array is array<literal-string|literal-int>
|
|
|
|
* ? ($separator is literal-string ? non-empty-literal-string : non-empty-string)
|
2021-07-12 22:59:34 +02:00
|
|
|
* : non-empty-string
|
|
|
|
* )
|
2020-11-16 21:50:07 +01:00
|
|
|
* : string)
|
2022-05-14 16:47:46 +02:00
|
|
|
* : ($array is non-empty-array
|
|
|
|
* ? ($array is array<non-empty-literal-string|non-empty-string>
|
|
|
|
* ? ($array is array<non-empty-literal-string> ? non-empty-literal-string : non-empty-string)
|
|
|
|
* : string
|
|
|
|
* )
|
|
|
|
* : string)
|
2020-11-16 21:50:07 +01:00
|
|
|
* )
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($separator) -> return
|
|
|
|
* @psalm-flow ($array) -(array-fetch)-> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function join($separator, array $array = []): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-06-22 23:53:03 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
Refined `explode()` types
Fixes #5039
This patch removes the need for a custom function return type
provider for `explode()`, and instead replaces all that with a single
stub for the `explode()` function, which provides types for some of
the most common `$limit` input values.
With this change, the `$delimiter` is enforced to be a `non-empty-string`,
which will lead to downstream consumers having to adjust some code accordingly,
but that shouldn't affect the most common scenario of exploding a string
based with a constant `literal-string` delimiter, which most PHP devs tend to do.
This change didn't come with an accompanying test, since that would be a bit
wasteful, but it was verified locally with following script:
```php
<?php
$possible0 = explode(',', 'hello, world', -100);
$possible1 = explode(',', 'hello, world', -1);
$possible2 = explode(',', 'hello, world', 0);
$possible3 = explode(',', 'hello, world', 1);
$possible4 = explode(',', 'hello, world', 2);
$possible5 = explode(',', 'hello, world', 3);
$possible6 = explode(',', 'hello, world', 4);
try {
$impossible1 = explode('', '', -1);
} catch (Throwable $impossible1) {}
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
/** @psalm-trace $traced */
var_dump($traced);
return $traced;
```
Running psalm locally, this produces:
```
psalm on feature/#5039-more-refined-types-for-explode-core-function [?] via 🐘 v8.1.13 via ❄️ impure (nix-shell)
❯ ./psalm --no-cache explode.php
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidArgument - explode.php:11:28 - Argument 1 of explode expects non-empty-string, but '' provided (see https://psalm.dev/004)
$impossible1 = explode('', '', -1);
ERROR: PossiblyUndefinedGlobalVariable - explode.php:14:96 - Possibly undefined global variable $impossible1 defined in try block (see https://psalm.dev/126)
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
ERROR: ForbiddenCode - explode.php:18:1 - Unsafe var_dump (see https://psalm.dev/002)
/** @psalm-trace $traced */
var_dump($traced);
ERROR: Trace - explode.php:18:1 - $traced: list{0: array<never, never>, 1: non-empty-list<string>, 2: list{string}, 3: list{string}, 4: array{0: string, 1?: string}, 5: array{0: string, 1?: string, 2?: string}, 6: non-empty-list<string>, 7?: Throwable|non-empty-list<string>} (see https://psalm.dev/224)
/** @psalm-trace $traced */
var_dump($traced);
------------------------------
4 errors found
------------------------------
Checks took 6.31 seconds and used 265.386MB of memory
Psalm was unable to infer types in the codebase
```
The actual runtime behavior on PHP 8.x: https://3v4l.org/0NKlW
```
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
object(ValueError)#1 (7) {
["message":protected]=>
string(51) "explode(): Argument #1 ($separator) cannot be empty"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(9) "/in/0NKlW"
["line":protected]=>
int(11)
["trace":"Error":private]=>
array(1) {
[0]=>
array(4) {
["file"]=>
string(9) "/in/0NKlW"
["line"]=>
int(11)
["function"]=>
string(7) "explode"
["args"]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
int(-1)
}
}
}
["previous":"Error":private]=>
NULL
}
}
```
On PHP 7:
```
Warning: explode(): Empty delimiter in /in/0NKlW on line 11
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
bool(false)
}
```
2022-12-28 17:01:46 +01:00
|
|
|
* @param non-empty-string $separator
|
|
|
|
*
|
|
|
|
* @return (
|
2022-12-28 17:26:25 +01:00
|
|
|
* $string is lowercase-string
|
|
|
|
* ? (
|
|
|
|
* $limit is int<min, -2>
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list<empty>
|
2022-12-28 17:26:25 +01:00
|
|
|
* : (
|
|
|
|
* $limit is int<0, 1>
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{lowercase-string}
|
2022-12-28 17:26:25 +01:00
|
|
|
* : (
|
|
|
|
* $limit is 2
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{0: lowercase-string, 1?: lowercase-string}
|
2022-12-28 17:26:25 +01:00
|
|
|
* : (
|
|
|
|
* $limit is 3
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{0: lowercase-string, 1?: lowercase-string, 2?: lowercase-string}
|
2022-12-28 17:26:25 +01:00
|
|
|
* : non-empty-list<lowercase-string>
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
Refined `explode()` types
Fixes #5039
This patch removes the need for a custom function return type
provider for `explode()`, and instead replaces all that with a single
stub for the `explode()` function, which provides types for some of
the most common `$limit` input values.
With this change, the `$delimiter` is enforced to be a `non-empty-string`,
which will lead to downstream consumers having to adjust some code accordingly,
but that shouldn't affect the most common scenario of exploding a string
based with a constant `literal-string` delimiter, which most PHP devs tend to do.
This change didn't come with an accompanying test, since that would be a bit
wasteful, but it was verified locally with following script:
```php
<?php
$possible0 = explode(',', 'hello, world', -100);
$possible1 = explode(',', 'hello, world', -1);
$possible2 = explode(',', 'hello, world', 0);
$possible3 = explode(',', 'hello, world', 1);
$possible4 = explode(',', 'hello, world', 2);
$possible5 = explode(',', 'hello, world', 3);
$possible6 = explode(',', 'hello, world', 4);
try {
$impossible1 = explode('', '', -1);
} catch (Throwable $impossible1) {}
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
/** @psalm-trace $traced */
var_dump($traced);
return $traced;
```
Running psalm locally, this produces:
```
psalm on feature/#5039-more-refined-types-for-explode-core-function [?] via 🐘 v8.1.13 via ❄️ impure (nix-shell)
❯ ./psalm --no-cache explode.php
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidArgument - explode.php:11:28 - Argument 1 of explode expects non-empty-string, but '' provided (see https://psalm.dev/004)
$impossible1 = explode('', '', -1);
ERROR: PossiblyUndefinedGlobalVariable - explode.php:14:96 - Possibly undefined global variable $impossible1 defined in try block (see https://psalm.dev/126)
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
ERROR: ForbiddenCode - explode.php:18:1 - Unsafe var_dump (see https://psalm.dev/002)
/** @psalm-trace $traced */
var_dump($traced);
ERROR: Trace - explode.php:18:1 - $traced: list{0: array<never, never>, 1: non-empty-list<string>, 2: list{string}, 3: list{string}, 4: array{0: string, 1?: string}, 5: array{0: string, 1?: string, 2?: string}, 6: non-empty-list<string>, 7?: Throwable|non-empty-list<string>} (see https://psalm.dev/224)
/** @psalm-trace $traced */
var_dump($traced);
------------------------------
4 errors found
------------------------------
Checks took 6.31 seconds and used 265.386MB of memory
Psalm was unable to infer types in the codebase
```
The actual runtime behavior on PHP 8.x: https://3v4l.org/0NKlW
```
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
object(ValueError)#1 (7) {
["message":protected]=>
string(51) "explode(): Argument #1 ($separator) cannot be empty"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(9) "/in/0NKlW"
["line":protected]=>
int(11)
["trace":"Error":private]=>
array(1) {
[0]=>
array(4) {
["file"]=>
string(9) "/in/0NKlW"
["line"]=>
int(11)
["function"]=>
string(7) "explode"
["args"]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
int(-1)
}
}
}
["previous":"Error":private]=>
NULL
}
}
```
On PHP 7:
```
Warning: explode(): Empty delimiter in /in/0NKlW on line 11
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
bool(false)
}
```
2022-12-28 17:01:46 +01:00
|
|
|
* : (
|
2022-12-28 17:26:25 +01:00
|
|
|
* $limit is int<min, -2>
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list<empty>
|
Refined `explode()` types
Fixes #5039
This patch removes the need for a custom function return type
provider for `explode()`, and instead replaces all that with a single
stub for the `explode()` function, which provides types for some of
the most common `$limit` input values.
With this change, the `$delimiter` is enforced to be a `non-empty-string`,
which will lead to downstream consumers having to adjust some code accordingly,
but that shouldn't affect the most common scenario of exploding a string
based with a constant `literal-string` delimiter, which most PHP devs tend to do.
This change didn't come with an accompanying test, since that would be a bit
wasteful, but it was verified locally with following script:
```php
<?php
$possible0 = explode(',', 'hello, world', -100);
$possible1 = explode(',', 'hello, world', -1);
$possible2 = explode(',', 'hello, world', 0);
$possible3 = explode(',', 'hello, world', 1);
$possible4 = explode(',', 'hello, world', 2);
$possible5 = explode(',', 'hello, world', 3);
$possible6 = explode(',', 'hello, world', 4);
try {
$impossible1 = explode('', '', -1);
} catch (Throwable $impossible1) {}
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
/** @psalm-trace $traced */
var_dump($traced);
return $traced;
```
Running psalm locally, this produces:
```
psalm on feature/#5039-more-refined-types-for-explode-core-function [?] via 🐘 v8.1.13 via ❄️ impure (nix-shell)
❯ ./psalm --no-cache explode.php
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidArgument - explode.php:11:28 - Argument 1 of explode expects non-empty-string, but '' provided (see https://psalm.dev/004)
$impossible1 = explode('', '', -1);
ERROR: PossiblyUndefinedGlobalVariable - explode.php:14:96 - Possibly undefined global variable $impossible1 defined in try block (see https://psalm.dev/126)
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
ERROR: ForbiddenCode - explode.php:18:1 - Unsafe var_dump (see https://psalm.dev/002)
/** @psalm-trace $traced */
var_dump($traced);
ERROR: Trace - explode.php:18:1 - $traced: list{0: array<never, never>, 1: non-empty-list<string>, 2: list{string}, 3: list{string}, 4: array{0: string, 1?: string}, 5: array{0: string, 1?: string, 2?: string}, 6: non-empty-list<string>, 7?: Throwable|non-empty-list<string>} (see https://psalm.dev/224)
/** @psalm-trace $traced */
var_dump($traced);
------------------------------
4 errors found
------------------------------
Checks took 6.31 seconds and used 265.386MB of memory
Psalm was unable to infer types in the codebase
```
The actual runtime behavior on PHP 8.x: https://3v4l.org/0NKlW
```
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
object(ValueError)#1 (7) {
["message":protected]=>
string(51) "explode(): Argument #1 ($separator) cannot be empty"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(9) "/in/0NKlW"
["line":protected]=>
int(11)
["trace":"Error":private]=>
array(1) {
[0]=>
array(4) {
["file"]=>
string(9) "/in/0NKlW"
["line"]=>
int(11)
["function"]=>
string(7) "explode"
["args"]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
int(-1)
}
}
}
["previous":"Error":private]=>
NULL
}
}
```
On PHP 7:
```
Warning: explode(): Empty delimiter in /in/0NKlW on line 11
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
bool(false)
}
```
2022-12-28 17:01:46 +01:00
|
|
|
* : (
|
2022-12-28 17:26:25 +01:00
|
|
|
* $limit is int<0, 1>
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{string}
|
Refined `explode()` types
Fixes #5039
This patch removes the need for a custom function return type
provider for `explode()`, and instead replaces all that with a single
stub for the `explode()` function, which provides types for some of
the most common `$limit` input values.
With this change, the `$delimiter` is enforced to be a `non-empty-string`,
which will lead to downstream consumers having to adjust some code accordingly,
but that shouldn't affect the most common scenario of exploding a string
based with a constant `literal-string` delimiter, which most PHP devs tend to do.
This change didn't come with an accompanying test, since that would be a bit
wasteful, but it was verified locally with following script:
```php
<?php
$possible0 = explode(',', 'hello, world', -100);
$possible1 = explode(',', 'hello, world', -1);
$possible2 = explode(',', 'hello, world', 0);
$possible3 = explode(',', 'hello, world', 1);
$possible4 = explode(',', 'hello, world', 2);
$possible5 = explode(',', 'hello, world', 3);
$possible6 = explode(',', 'hello, world', 4);
try {
$impossible1 = explode('', '', -1);
} catch (Throwable $impossible1) {}
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
/** @psalm-trace $traced */
var_dump($traced);
return $traced;
```
Running psalm locally, this produces:
```
psalm on feature/#5039-more-refined-types-for-explode-core-function [?] via 🐘 v8.1.13 via ❄️ impure (nix-shell)
❯ ./psalm --no-cache explode.php
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidArgument - explode.php:11:28 - Argument 1 of explode expects non-empty-string, but '' provided (see https://psalm.dev/004)
$impossible1 = explode('', '', -1);
ERROR: PossiblyUndefinedGlobalVariable - explode.php:14:96 - Possibly undefined global variable $impossible1 defined in try block (see https://psalm.dev/126)
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
ERROR: ForbiddenCode - explode.php:18:1 - Unsafe var_dump (see https://psalm.dev/002)
/** @psalm-trace $traced */
var_dump($traced);
ERROR: Trace - explode.php:18:1 - $traced: list{0: array<never, never>, 1: non-empty-list<string>, 2: list{string}, 3: list{string}, 4: array{0: string, 1?: string}, 5: array{0: string, 1?: string, 2?: string}, 6: non-empty-list<string>, 7?: Throwable|non-empty-list<string>} (see https://psalm.dev/224)
/** @psalm-trace $traced */
var_dump($traced);
------------------------------
4 errors found
------------------------------
Checks took 6.31 seconds and used 265.386MB of memory
Psalm was unable to infer types in the codebase
```
The actual runtime behavior on PHP 8.x: https://3v4l.org/0NKlW
```
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
object(ValueError)#1 (7) {
["message":protected]=>
string(51) "explode(): Argument #1 ($separator) cannot be empty"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(9) "/in/0NKlW"
["line":protected]=>
int(11)
["trace":"Error":private]=>
array(1) {
[0]=>
array(4) {
["file"]=>
string(9) "/in/0NKlW"
["line"]=>
int(11)
["function"]=>
string(7) "explode"
["args"]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
int(-1)
}
}
}
["previous":"Error":private]=>
NULL
}
}
```
On PHP 7:
```
Warning: explode(): Empty delimiter in /in/0NKlW on line 11
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
bool(false)
}
```
2022-12-28 17:01:46 +01:00
|
|
|
* : (
|
2022-12-28 17:26:25 +01:00
|
|
|
* $limit is 2
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{0: string, 1?: string}
|
2022-12-28 17:26:25 +01:00
|
|
|
* : (
|
|
|
|
* $limit is 3
|
2022-12-28 17:48:33 +01:00
|
|
|
* ? list{0: string, 1?: string, 2?: string}
|
2022-12-28 17:26:25 +01:00
|
|
|
* : non-empty-list<string>
|
|
|
|
* )
|
Refined `explode()` types
Fixes #5039
This patch removes the need for a custom function return type
provider for `explode()`, and instead replaces all that with a single
stub for the `explode()` function, which provides types for some of
the most common `$limit` input values.
With this change, the `$delimiter` is enforced to be a `non-empty-string`,
which will lead to downstream consumers having to adjust some code accordingly,
but that shouldn't affect the most common scenario of exploding a string
based with a constant `literal-string` delimiter, which most PHP devs tend to do.
This change didn't come with an accompanying test, since that would be a bit
wasteful, but it was verified locally with following script:
```php
<?php
$possible0 = explode(',', 'hello, world', -100);
$possible1 = explode(',', 'hello, world', -1);
$possible2 = explode(',', 'hello, world', 0);
$possible3 = explode(',', 'hello, world', 1);
$possible4 = explode(',', 'hello, world', 2);
$possible5 = explode(',', 'hello, world', 3);
$possible6 = explode(',', 'hello, world', 4);
try {
$impossible1 = explode('', '', -1);
} catch (Throwable $impossible1) {}
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
/** @psalm-trace $traced */
var_dump($traced);
return $traced;
```
Running psalm locally, this produces:
```
psalm on feature/#5039-more-refined-types-for-explode-core-function [?] via 🐘 v8.1.13 via ❄️ impure (nix-shell)
❯ ./psalm --no-cache explode.php
Target PHP version: 7.4 (inferred from composer.json) Extensions enabled: dom, simplexml (unsupported extensions: ctype, json, libxml, mbstring, tokenizer)
Scanning files...
Analyzing files...
░
To whom it may concern: Psalm cannot detect unused classes, methods and properties
when analyzing individual files and folders. Run on the full project to enable
complete unused code detection.
ERROR: InvalidArgument - explode.php:11:28 - Argument 1 of explode expects non-empty-string, but '' provided (see https://psalm.dev/004)
$impossible1 = explode('', '', -1);
ERROR: PossiblyUndefinedGlobalVariable - explode.php:14:96 - Possibly undefined global variable $impossible1 defined in try block (see https://psalm.dev/126)
$traced = [$possible0, $possible1, $possible2, $possible3, $possible4, $possible5, $possible6, $impossible1];
ERROR: ForbiddenCode - explode.php:18:1 - Unsafe var_dump (see https://psalm.dev/002)
/** @psalm-trace $traced */
var_dump($traced);
ERROR: Trace - explode.php:18:1 - $traced: list{0: array<never, never>, 1: non-empty-list<string>, 2: list{string}, 3: list{string}, 4: array{0: string, 1?: string}, 5: array{0: string, 1?: string, 2?: string}, 6: non-empty-list<string>, 7?: Throwable|non-empty-list<string>} (see https://psalm.dev/224)
/** @psalm-trace $traced */
var_dump($traced);
------------------------------
4 errors found
------------------------------
Checks took 6.31 seconds and used 265.386MB of memory
Psalm was unable to infer types in the codebase
```
The actual runtime behavior on PHP 8.x: https://3v4l.org/0NKlW
```
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
object(ValueError)#1 (7) {
["message":protected]=>
string(51) "explode(): Argument #1 ($separator) cannot be empty"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(9) "/in/0NKlW"
["line":protected]=>
int(11)
["trace":"Error":private]=>
array(1) {
[0]=>
array(4) {
["file"]=>
string(9) "/in/0NKlW"
["line"]=>
int(11)
["function"]=>
string(7) "explode"
["args"]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
int(-1)
}
}
}
["previous":"Error":private]=>
NULL
}
}
```
On PHP 7:
```
Warning: explode(): Empty delimiter in /in/0NKlW on line 11
array(8) {
[0]=>
array(0) {
}
[1]=>
array(1) {
[0]=>
string(5) "hello"
}
[2]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[3]=>
array(1) {
[0]=>
string(12) "hello, world"
}
[4]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[5]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[6]=>
array(2) {
[0]=>
string(5) "hello"
[1]=>
string(6) " world"
}
[7]=>
bool(false)
}
```
2022-12-28 17:01:46 +01:00
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
*
|
2020-06-22 23:53:03 +02:00
|
|
|
* @psalm-flow ($string) -(array-assignment)-> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function explode(string $separator, string $string, int $limit = -1) : array {}
|
2020-06-22 23:53:03 +02:00
|
|
|
|
2020-10-12 19:04:28 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param non-empty-string $pattern
|
|
|
|
*
|
2020-10-12 19:04:28 +02:00
|
|
|
* @psalm-flow ($subject) -(array-assignment)-> return
|
|
|
|
*
|
2020-10-30 18:22:43 +01:00
|
|
|
* @template TFlags as int-mask<0, 1, 2, 4>
|
2020-10-13 02:25:46 +02:00
|
|
|
*
|
|
|
|
* @param TFlags $flags
|
|
|
|
*
|
2022-11-12 02:14:21 +01:00
|
|
|
* @return (TFlags is 0|2 ? non-empty-list<string>|false : (TFlags is 1|3 ? list<string>|false : list<array{string,int}>|false))
|
2020-10-12 19:04:28 +02:00
|
|
|
*
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
|
|
|
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0) {}
|
|
|
|
|
2020-05-18 23:23:21 +02:00
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array $array
|
2020-05-18 23:23:21 +02:00
|
|
|
*
|
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $array is array<int>
|
2020-05-22 04:47:58 +02:00
|
|
|
* ? int
|
2021-11-04 10:27:07 +01:00
|
|
|
* : ($array is array<float>
|
2020-05-18 23:23:21 +02:00
|
|
|
* ? float
|
|
|
|
* : float|int
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_sum(array $array) {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
2020-10-06 15:13:19 +02:00
|
|
|
/**
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param array $array
|
2020-10-06 15:13:19 +02:00
|
|
|
*
|
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $array is array<int>
|
2020-10-06 15:13:19 +02:00
|
|
|
* ? int
|
2021-11-04 10:27:07 +01:00
|
|
|
* : ($array is array<float>
|
2020-10-06 15:13:19 +02:00
|
|
|
* ? float
|
|
|
|
* : float|int
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function array_product(array $array) {}
|
2020-10-06 15:13:19 +02:00
|
|
|
|
2021-09-27 19:34:58 +02:00
|
|
|
/**
|
2023-01-23 22:09:29 +01:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-09-27 19:34:58 +02:00
|
|
|
* 257 is FILTER_VALIDATE_INT
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'callable' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'unserialize' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'include' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'eval' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'ldap' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'sql' : null)
|
2021-09-27 19:34:58 +02:00
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'html' : null)
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'has_quotes' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'shell' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'ssrf' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'file' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'cookie' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 257 ? 'header' : null)
|
2021-09-27 19:46:01 +02:00
|
|
|
*
|
|
|
|
* 258 is FILTER_VALIDATE_BOOLEAN
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'callable' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'unserialize' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'include' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'eval' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'ldap' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'sql' : null)
|
2021-09-27 19:46:01 +02:00
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'html' : null)
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'has_quotes' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'shell' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'ssrf' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'file' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'cookie' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 258 ? 'header' : null)
|
2021-09-27 19:46:01 +02:00
|
|
|
*
|
|
|
|
* 259 is FILTER_VALIDATE_FLOAT
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'callable' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'unserialize' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'include' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'eval' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'ldap' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'sql' : null)
|
2021-09-27 19:46:01 +02:00
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'html' : null)
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'has_quotes' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'shell' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'ssrf' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'file' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'cookie' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 259 ? 'header' : null)
|
2021-09-27 19:46:01 +02:00
|
|
|
*
|
2022-02-15 21:13:44 +01:00
|
|
|
* 519 is FILTER_SANITIZE_NUMBER_INT
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'callable' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'unserialize' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'include' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'eval' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'ldap' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'sql' : null)
|
2022-02-15 21:13:44 +01:00
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'html' : null)
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'has_quotes' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'shell' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'ssrf' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'file' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'cookie' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 519 ? 'header' : null)
|
2022-02-15 21:13:44 +01:00
|
|
|
*
|
|
|
|
* 520 is FILTER_SANITIZE_NUMBER_FLOAT
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'callable' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'unserialize' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'include' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'eval' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'ldap' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'sql' : null)
|
2022-02-15 21:13:44 +01:00
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'html' : null)
|
2023-02-01 22:41:52 +01:00
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'has_quotes' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'shell' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'ssrf' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'file' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'cookie' : null)
|
|
|
|
* @psalm-taint-escape ($filter is 520 ? 'header' : null)
|
2022-02-15 21:13:44 +01:00
|
|
|
*
|
2021-09-27 19:34:58 +02:00
|
|
|
* @psalm-flow ($value, $filter, $options) -> return
|
|
|
|
*/
|
|
|
|
function filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed {}
|
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-06-22 23:53:03 +02:00
|
|
|
* @psalm-taint-escape html
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-05-22 04:47:58 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function strip_tags(string $string, ?string $allowed_tags = null) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
2020-11-21 23:35:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function stripcslashes(string $string) : string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function stripslashes(string $string) : string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-06-10 23:43:04 +02:00
|
|
|
* Tainting is handled in a plugin
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function htmlentities(string $string, ?int $flags = null, ?string $encoding = null, bool $double_encode = true) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-06-10 23:43:04 +02:00
|
|
|
* Tainting is handled in a plugin
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function html_entity_decode(string $string, ?int $flags = null, ?string $encoding = null) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-06-10 23:43:04 +02:00
|
|
|
* Tainting is handled in a plugin
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
2021-05-18 01:43:08 +02:00
|
|
|
* @psalm-return (
|
|
|
|
* $string is non-empty-string
|
|
|
|
* ? non-empty-string
|
|
|
|
* : string
|
|
|
|
* )
|
2020-05-22 04:47:58 +02:00
|
|
|
*/
|
2021-05-24 01:12:02 +02:00
|
|
|
function htmlspecialchars(string $string, int $flags = ENT_COMPAT | ENT_HTML401, ?string $encoding = 'UTF-8', bool $double_encode = true) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-06-10 23:43:04 +02:00
|
|
|
* Tainting is handled in a plugin
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function htmlspecialchars_decode(string $string, ?int $flags = null) : string {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
2022-12-06 00:25:36 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape html
|
|
|
|
* @psalm-taint-escape has_quotes
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function urlencode(string $string) : string {}
|
|
|
|
|
2021-05-19 21:20:56 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2021-06-07 19:19:17 +02:00
|
|
|
*
|
2021-05-19 21:20:56 +02:00
|
|
|
* @psalm-return (
|
2021-12-05 20:35:58 +01:00
|
|
|
* $string is ''
|
|
|
|
* ? 0
|
|
|
|
* : (
|
|
|
|
* $string is non-empty-string
|
|
|
|
* ? positive-int
|
|
|
|
* : (0|positive-int)
|
|
|
|
* )
|
2021-05-19 21:20:56 +02:00
|
|
|
* )
|
|
|
|
*/
|
|
|
|
function strlen(string $string) : int {}
|
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @template TKey of array-key
|
|
|
|
*
|
2020-05-30 22:59:18 +02:00
|
|
|
* @param string|array<string|int|float> $search
|
|
|
|
* @param string|array<string|int|float> $replace
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param string|array<TKey, string|int|float> $subject
|
|
|
|
* @param int<0, max> $count
|
|
|
|
* @return ($subject is array ? array<TKey, string> : string)
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
|
|
|
* @psalm-flow ($replace, $subject) -> return
|
|
|
|
*/
|
|
|
|
function str_replace($search, $replace, $subject, &$count = null) {}
|
|
|
|
|
2020-11-21 23:35:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @template TKey of array-key
|
|
|
|
*
|
2020-11-21 23:35:07 +01:00
|
|
|
* @param string|array<string|int|float> $search
|
|
|
|
* @param string|array<string|int|float> $replace
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param string|array<TKey, string|int|float> $subject
|
|
|
|
* @param int<0, max> $count
|
|
|
|
* @return ($subject is array ? array<TKey, string> : string)
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($replace, $subject) -> return
|
|
|
|
*/
|
|
|
|
function str_ireplace($search, $replace, $subject, &$count = null) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @return ($string is non-empty-string ? non-empty-string : ($length is positive-int ? non-empty-string: string))
|
2021-07-15 00:54:03 +02:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string, $pad_string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_pad(string $string, int $length, $pad_string = '', int $pad_type = STR_PAD_RIGHT): string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @todo update $times to be `0|positive-int`
|
2021-07-15 00:54:03 +02:00
|
|
|
* @return (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $string is non-empty-string
|
2021-07-15 00:54:03 +02:00
|
|
|
* ? (
|
2021-11-04 10:27:07 +01:00
|
|
|
* $times is positive-int
|
2021-07-15 00:54:03 +02:00
|
|
|
* ? non-empty-string
|
2021-11-04 10:27:07 +01:00
|
|
|
* : ($times is 0 ? '' : string)
|
2021-07-15 00:54:03 +02:00
|
|
|
* )
|
2021-11-04 10:27:07 +01:00
|
|
|
* : ($times is 0 ? '' : string)
|
2021-07-15 00:54:03 +02:00
|
|
|
* )
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_repeat(string $string, int $times): string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_rot13(string $string): string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_shuffle(string $string): string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-03-13 01:02:34 +01:00
|
|
|
* @param positive-int $length
|
|
|
|
* @return non-empty-list<string>
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_split(string $string, int $length = 1) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
2023-03-17 11:39:04 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-03-17 12:58:44 +01:00
|
|
|
* @template T as string
|
|
|
|
* @param T $needle
|
|
|
|
* @psalm-assert-if-true =(T is '' ? string : non-empty-string) $haystack
|
2023-03-17 11:39:04 +01:00
|
|
|
* @return ($needle is '' ? true : ($haystack is '' ? false : bool))
|
|
|
|
*/
|
2023-03-17 11:46:00 +01:00
|
|
|
function str_starts_with(string $haystack, string $needle): bool {}
|
2023-03-17 11:39:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-03-17 12:58:44 +01:00
|
|
|
* @template T as string
|
|
|
|
* @param T $needle
|
|
|
|
* @psalm-assert-if-true =(T is '' ? string : non-empty-string) $haystack
|
2023-03-17 11:39:04 +01:00
|
|
|
* @return ($needle is '' ? true : ($haystack is '' ? false : bool))
|
|
|
|
*/
|
2023-03-17 11:46:00 +01:00
|
|
|
function str_ends_with(string $haystack, string $needle): bool {}
|
2023-03-17 11:39:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-03-17 12:58:44 +01:00
|
|
|
* @template T as string
|
|
|
|
* @param T $needle
|
|
|
|
* @psalm-assert-if-true =(T is '' ? string : non-empty-string) $haystack
|
2023-03-17 11:39:04 +01:00
|
|
|
* @return ($needle is '' ? true : ($haystack is '' ? false : bool))
|
|
|
|
*/
|
2023-03-17 11:46:00 +01:00
|
|
|
function str_contains(string $haystack, string $needle): bool {}
|
2023-03-17 11:39:04 +01:00
|
|
|
|
2020-11-21 23:35:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-11-25 17:49:51 +01:00
|
|
|
* @return string|false
|
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($haystack) -> return
|
|
|
|
*/
|
2020-11-25 17:49:51 +01:00
|
|
|
function strstr(string $haystack, string $needle, bool $before_needle = false) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-11-25 17:49:51 +01:00
|
|
|
* @return string|false
|
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($haystack) -> return
|
|
|
|
*/
|
2020-11-25 17:49:51 +01:00
|
|
|
function stristr(string $haystack, string $needle, bool $before_needle = false) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-11-24 16:44:33 +01:00
|
|
|
* @return string|false
|
2020-11-25 17:49:51 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($haystack) -> return
|
|
|
|
*/
|
2020-11-24 16:44:33 +01:00
|
|
|
function strchr(string $haystack, string $needle, bool $before_needle = false) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-11-24 16:44:33 +01:00
|
|
|
* @return string|false
|
2020-11-25 17:49:51 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function strpbrk(string $string, string $characters) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2020-11-24 16:44:33 +01:00
|
|
|
* @return string|false
|
2020-11-25 17:49:51 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($haystack) -> return
|
|
|
|
*/
|
2020-11-25 17:49:51 +01:00
|
|
|
function strrchr(string $haystack, string $needle) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function strrev(string $string): string {}
|
|
|
|
|
2021-07-09 18:40:55 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-07-09 20:25:12 +02:00
|
|
|
* @param 0|1|2 $format
|
|
|
|
* @return (
|
|
|
|
* $format is 0 ?
|
2021-07-12 22:59:34 +02:00
|
|
|
* int :
|
2021-07-09 20:25:12 +02:00
|
|
|
* (
|
|
|
|
* $format is 1 ?
|
|
|
|
* list<string> :
|
|
|
|
* array<int, string>
|
|
|
|
* )
|
2021-07-09 18:40:55 +02:00
|
|
|
* )
|
|
|
|
*/
|
|
|
|
function str_word_count(string $string, int $format = 0, string|null $characters = null) {}
|
|
|
|
|
2020-11-17 21:15:29 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param non-empty-string|non-empty-string[] $pattern
|
2020-11-17 21:15:29 +01:00
|
|
|
* @param string|array<string|int|float> $replacement
|
|
|
|
* @param string|array<string|int|float> $subject
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param int<0, max> $count
|
2021-09-07 23:02:28 +02:00
|
|
|
* @return ($subject is array ? array<string> : string|null)
|
2020-11-17 21:15:29 +01:00
|
|
|
*
|
|
|
|
* @psalm-flow ($replacement, $subject) -> return
|
|
|
|
*/
|
|
|
|
function preg_filter($pattern, $replacement, $subject, int $limit = -1, &$count = null) {}
|
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @template TKey of array-key
|
|
|
|
*
|
|
|
|
* @param non-empty-string|non-empty-string[] $pattern
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param string|array<string|int|float> $replacement
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param string|array<TKey, string|int|float> $subject
|
|
|
|
* @param int<0, max> $count
|
|
|
|
* @return ($subject is array ? array<TKey, string>|null : string|null)
|
|
|
|
*
|
|
|
|
* @psalm-ignore-nullable-return
|
2020-05-22 04:47:58 +02:00
|
|
|
*
|
2021-11-04 16:10:59 +01:00
|
|
|
* @psalm-flow ($replacement, $subject) -> return
|
2020-05-22 04:47:58 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function preg_replace($pattern, $replacement, $subject, int $limit = -1, &$count = null) {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
2020-06-23 21:28:31 +02:00
|
|
|
/**
|
2023-06-30 17:08:03 +02:00
|
|
|
* @template TKey of array-key
|
|
|
|
*
|
|
|
|
* @param non-empty-string|non-empty-string[] $pattern
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param callable(string[]):string $callback
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param string|array<TKey, string|int|float> $subject
|
|
|
|
* @param int<0, max> $count
|
|
|
|
* @return ($subject is array ? array<TKey, string>|null : string|null)
|
|
|
|
*
|
|
|
|
* @psalm-ignore-nullable-return
|
2020-06-23 21:28:31 +02:00
|
|
|
*
|
2020-06-26 14:58:57 +02:00
|
|
|
* @psalm-taint-specialize
|
2020-06-23 21:28:31 +02:00
|
|
|
* @psalm-flow ($subject) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function preg_replace_callback($pattern, $callback, $subject, int $limit = -1, &$count = null, int $flags = 0) {}
|
2020-06-23 21:28:31 +02:00
|
|
|
|
2020-09-05 00:10:14 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
* @template TFlags as int
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param non-empty-string $pattern
|
2020-09-05 00:10:14 +02:00
|
|
|
* @param string $subject
|
|
|
|
* @param mixed $matches
|
|
|
|
* @param TFlags $flags
|
2020-09-05 00:31:50 +02:00
|
|
|
* @param-out (
|
|
|
|
* TFlags is 1
|
2020-09-05 00:32:51 +02:00
|
|
|
* ? array<list<string>>
|
|
|
|
* : (TFlags is 2
|
|
|
|
* ? list<array<string>>
|
|
|
|
* : (TFlags is 256|257
|
2022-11-12 02:14:21 +01:00
|
|
|
* ? array<list<array{string, int}>>
|
2020-09-05 00:32:51 +02:00
|
|
|
* : (TFlags is 258
|
2022-11-12 02:14:21 +01:00
|
|
|
* ? list<array<array{string, int}>>
|
2020-09-05 00:32:51 +02:00
|
|
|
* : (TFlags is 512|513
|
|
|
|
* ? array<list<?string>>
|
|
|
|
* : (TFlags is 514
|
|
|
|
* ? list<array<?string>>
|
|
|
|
* : (TFlags is 770
|
2022-11-12 02:14:21 +01:00
|
|
|
* ? list<array<array{?string, int}>>
|
2020-09-05 00:32:51 +02:00
|
|
|
* : array
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
2020-09-05 00:31:50 +02:00
|
|
|
* ) $matches
|
2020-10-15 01:59:07 +02:00
|
|
|
* @return int|false
|
|
|
|
* @psalm-ignore-falsable-return
|
2020-09-05 00:10:14 +02:00
|
|
|
*/
|
2020-10-26 16:53:03 +01:00
|
|
|
function preg_match_all($pattern, $subject, &$matches = [], int $flags = 1, int $offset = 0) {}
|
2020-09-05 00:10:14 +02:00
|
|
|
|
2021-11-29 14:21:58 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
* @template TFlags as int-mask<0, 256, 512>
|
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @param non-empty-string $pattern
|
2021-11-29 14:21:58 +01:00
|
|
|
* @param string $subject
|
|
|
|
* @param mixed $matches
|
|
|
|
* @param TFlags $flags
|
2022-11-12 02:14:21 +01:00
|
|
|
* @param-out (TFlags is 256 ? array<array-key, array{string, 0|positive-int}|array{'', -1}> :
|
2021-11-29 14:21:58 +01:00
|
|
|
* TFlags is 512 ? array<array-key, string|null> :
|
2022-11-12 02:14:21 +01:00
|
|
|
* TFlags is 768 ? array<array-key, array{string, 0|positive-int}|array{null, -1}> :
|
2021-11-29 14:21:58 +01:00
|
|
|
* array<array-key, string>
|
|
|
|
* ) $matches
|
|
|
|
* @return 1|0|false
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
|
|
|
function preg_match($pattern, $subject, &$matches = [], int $flags = 0, int $offset = 0) {}
|
|
|
|
|
2020-05-22 04:47:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-11-16 22:31:25 +01:00
|
|
|
* @return (PHP_MAJOR_VERSION is 5|7 ? string|false : string)
|
2020-05-22 04:47:58 +02:00
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function substr(string $string, int $offset, ?int $length = null) {}
|
2020-05-22 04:47:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-flow ($str) -> return
|
|
|
|
*/
|
|
|
|
function preg_quote(string $str, ?string $delimiter = null) : string {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-09-28 10:22:31 +02:00
|
|
|
* @param string|stringable-object|int|float $values
|
2023-06-24 17:31:44 +02:00
|
|
|
* @return (PHP_MAJOR_VERSION is 8 ? string : string|false)
|
2023-06-24 17:46:54 +02:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-05-22 18:33:04 +02:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($format, $values) -> return
|
2020-05-22 04:47:58 +02:00
|
|
|
*/
|
2023-06-06 14:32:47 +02:00
|
|
|
function sprintf(string $format, ...$values) {}
|
2020-05-23 07:11:16 +02:00
|
|
|
|
2020-11-21 23:35:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2023-06-09 12:55:23 +02:00
|
|
|
* @param array<string|int|float> $values
|
2023-06-24 17:31:44 +02:00
|
|
|
* @return (PHP_MAJOR_VERSION is 8 ? string : string|false)
|
2020-11-21 23:35:07 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-24 16:44:33 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($format, $values) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function vsprintf(string $format, array $values) {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
* @return string
|
2020-11-24 16:44:33 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-21 23:35:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function wordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false) : string {}
|
2020-11-21 23:35:07 +01:00
|
|
|
|
2020-11-16 21:50:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-12-29 12:42:41 +01:00
|
|
|
* @param string|int|float $values
|
2023-06-24 17:31:44 +02:00
|
|
|
* @return (PHP_MAJOR_VERSION is 8 ? int<0, max> : int<0, max>|false)
|
2023-06-24 17:46:54 +02:00
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-16 21:50:07 +01:00
|
|
|
*
|
2021-05-24 22:42:18 +02:00
|
|
|
* @psalm-taint-specialize
|
2020-11-16 21:50:07 +01:00
|
|
|
* @psalm-flow ($format, $values) -> return
|
2021-05-24 22:42:18 +02:00
|
|
|
* @psalm-taint-sink html $format
|
|
|
|
* @psalm-taint-sink html $values
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2023-06-06 14:32:47 +02:00
|
|
|
function printf(string $format, ...$values) {}
|
2020-11-16 21:50:07 +01:00
|
|
|
|
2021-11-07 09:25:27 +01:00
|
|
|
/**
|
2023-06-09 12:55:23 +02:00
|
|
|
* @param array<string|int|float> $values
|
2023-06-24 17:31:44 +02:00
|
|
|
* @return (PHP_MAJOR_VERSION is 8 ? int<0, max> : int<0, max>|false)
|
2023-06-24 17:46:54 +02:00
|
|
|
* @psalm-ignore-falsable-return
|
2023-06-09 12:55:23 +02:00
|
|
|
*
|
2023-06-07 13:58:53 +02:00
|
|
|
* @psalm-pure
|
2021-11-07 09:25:27 +01:00
|
|
|
* @psalm-taint-specialize
|
|
|
|
* @psalm-taint-sink html $format
|
|
|
|
* @psalm-taint-sink html $values
|
|
|
|
*/
|
2023-06-06 14:32:47 +02:00
|
|
|
function vprintf(string $format, array $values) {}
|
2021-11-07 09:25:27 +01:00
|
|
|
|
2020-05-23 07:11:16 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @return string|false
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*
|
|
|
|
* @psalm-flow ($path) -> return
|
|
|
|
*/
|
|
|
|
function realpath(string $path) {}
|
2020-05-30 22:55:55 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param numeric-string $num1
|
|
|
|
* @param numeric-string $num2
|
2023-08-12 19:36:00 +02:00
|
|
|
* @param int|null $scale
|
2021-11-04 10:27:07 +01:00
|
|
|
* @return (PHP_MAJOR_VERSION is 8 ? numeric-string : ($num2 is "0" ? null : numeric-string))
|
2020-05-30 22:55:55 +02:00
|
|
|
*/
|
2023-08-12 19:36:00 +02:00
|
|
|
function bcdiv(string $num1, string $num2, ?int $scale = null): ?string {}
|
2020-07-17 16:12:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @param scalar|null|object $value
|
2020-07-17 16:12:04 +02:00
|
|
|
* @return string The string value of var.
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($value) -> return
|
2020-07-17 16:12:04 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function strval ($value): string {}
|
2020-07-22 05:16:56 +02:00
|
|
|
|
|
|
|
/**
|
2022-11-12 02:14:21 +01:00
|
|
|
* @return ($string is non-empty-string ? non-empty-list<string> : non-empty-list<string>|array{null})
|
2020-07-22 05:16:56 +02:00
|
|
|
* @psalm-pure
|
2020-11-21 23:35:07 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-07-22 05:16:56 +02:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function str_getcsv(string $string, string $separator = ',', string $enclosure = '"', string $escape = '\\\\')
|
2020-07-22 05:16:56 +02:00
|
|
|
{
|
|
|
|
}
|
2020-09-17 14:31:31 +02:00
|
|
|
|
2020-10-06 15:13:19 +02:00
|
|
|
/**
|
|
|
|
* @template TKey as array-key
|
2023-06-30 17:08:03 +02:00
|
|
|
* @template TArray as array<TKey>
|
2020-10-06 15:13:19 +02:00
|
|
|
*
|
2021-12-02 03:51:06 +01:00
|
|
|
* @param TArray $array
|
2020-10-06 15:13:19 +02:00
|
|
|
*
|
2023-06-30 17:08:03 +02:00
|
|
|
* @return (TArray is non-empty-array ? non-empty-array<TKey, int<1, max>> : array<TKey, int<1, max>>)
|
2020-10-06 15:13:19 +02:00
|
|
|
*
|
|
|
|
* @psalm-pure
|
|
|
|
*/
|
|
|
|
function array_count_values(array $array): array {}
|
2020-11-16 21:50:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function addcslashes(string $string, string $characters) : string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function addslashes(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function ucfirst(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string, $separators) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function ucwords (string $string, string $separators = " \t\r\n\f\v"): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function lcfirst(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function nl2br(string $string, bool $use_xhtml = false): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function quoted_printable_decode(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function quoted_printable_encode(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function quotemeta(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function chop(string $string, string $characters = " \t\n\r\0\x0B"): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string, $separator) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function chunk_split(string $string, int $length = 76, string $separator= ''): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function convert_uudecode(string $string): string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-16 21:50:07 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function convert_uuencode(string $string) : string
|
2020-11-16 21:50:07 +01:00
|
|
|
{
|
|
|
|
}
|
2020-11-18 17:39:36 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape ldap
|
|
|
|
* @psalm-flow ($value) -> return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function ldap_escape(string $value, string $ignore = "", int $flags = 0) : string {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-03-16 07:08:48 +01:00
|
|
|
* @param int<1, 2147483647> $depth
|
2020-11-22 18:09:55 +01:00
|
|
|
* @return mixed
|
|
|
|
* @psalm-flow ($json) -> return
|
|
|
|
*/
|
|
|
|
function json_decode(string $json, ?bool $associative = null, int $depth = 512, int $flags = 0) {}
|
|
|
|
|
|
|
|
/**
|
2023-05-30 21:34:10 +02:00
|
|
|
* The conditional return type below relies on the fact that JSON_THROW_ON_ERROR is
|
2023-03-16 07:37:14 +01:00
|
|
|
* the highest-valued of JSON constants
|
2020-11-22 18:09:55 +01:00
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-03-16 07:08:48 +01:00
|
|
|
* @param int<1, 2147483647> $depth
|
2023-03-16 07:08:07 +01:00
|
|
|
* @return ($flags is int<4194304, 8388607> ? non-empty-string : non-empty-string|false)
|
2020-11-22 18:09:55 +01:00
|
|
|
*
|
|
|
|
* @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
|
|
|
|
*/
|
2022-07-08 08:08:00 +02:00
|
|
|
function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject) : ?string {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-05-30 21:34:10 +02:00
|
|
|
* @return non-empty-string
|
|
|
|
*
|
2020-11-22 18:09:55 +01:00
|
|
|
* @psalm-flow ($prefix) -> return
|
|
|
|
*/
|
|
|
|
function uniqid(string $prefix = "", bool $more_entropy = false) : string {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-05-06 20:32:17 +02:00
|
|
|
* @return array|false
|
|
|
|
* @psalm-ignore-falsable-return
|
2020-11-22 18:09:55 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-22 18:09:55 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function unpack(string $format, string $string, int $offset = 0) {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2023-05-29 17:16:49 +02:00
|
|
|
* @template T of bool
|
|
|
|
* @param T $strict
|
2020-11-22 18:09:55 +01:00
|
|
|
* @return string|false
|
2023-05-29 17:16:49 +02:00
|
|
|
* @psalm-return (T is false ? string : string|false)
|
2020-11-22 18:09:55 +01:00
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2020-11-22 18:09:55 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function base64_decode(string $string, bool $strict = false) {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-11-04 10:27:07 +01:00
|
|
|
* @psalm-flow ($string) -> return
|
2022-08-23 14:01:44 +02:00
|
|
|
* @template T as string
|
|
|
|
* @param T $string
|
|
|
|
* @return (T is non-empty-string ? non-empty-string : string)
|
2020-11-22 18:09:55 +01:00
|
|
|
*/
|
2021-11-04 10:27:07 +01:00
|
|
|
function base64_encode(string $string) : string {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
2022-08-23 14:01:44 +02:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @template T as string
|
|
|
|
* @param T $string
|
|
|
|
* @return (T is non-empty-string ? non-empty-string : string)
|
|
|
|
*/
|
|
|
|
function bin2hex(string $string): string {}
|
|
|
|
|
2020-11-22 18:09:55 +01:00
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2020-12-04 05:14:43 +01:00
|
|
|
* @param resource|null $context
|
2020-11-22 18:09:55 +01:00
|
|
|
*
|
2023-01-07 18:38:49 +01:00
|
|
|
* @return ($associative is false|0 ? list<string> : array<string, string|list<string>>)|false
|
2021-07-29 20:50:13 +02:00
|
|
|
*
|
2020-11-22 18:09:55 +01:00
|
|
|
* @psalm-taint-sink ssrf $url
|
|
|
|
*/
|
2023-01-07 18:38:49 +01:00
|
|
|
function get_headers(string $url, int $associative = 0, $context = null) : array|false {}
|
2020-11-22 18:09:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
2021-07-29 20:50:13 +02:00
|
|
|
* @return array<lowercase-string, string>|false
|
|
|
|
*
|
2020-11-22 18:09:55 +01:00
|
|
|
* @psalm-taint-sink ssrf $filename
|
|
|
|
*/
|
2021-07-29 20:50:13 +02:00
|
|
|
function get_meta_tags(string $filename, bool $use_include_path = false) : array|false {}
|
2021-07-15 23:39:16 +02:00
|
|
|
|
|
|
|
/**
|
2021-07-15 23:47:00 +02:00
|
|
|
* @return ($categorize is false ? array<string,int|string|float|bool|null|array|resource> : array<string, array<string,int|string|float|bool|null|array|resource>>)
|
2021-07-15 23:39:16 +02:00
|
|
|
*/
|
2021-07-15 23:47:00 +02:00
|
|
|
function get_defined_constants(bool $categorize = false): array {}
|
2021-10-12 20:13:04 +02:00
|
|
|
|
|
|
|
/**
|
2021-10-13 10:33:26 +02:00
|
|
|
* @param mixed $object_or_class
|
|
|
|
* @param class-string $class
|
2022-05-12 15:37:29 +02:00
|
|
|
* @param bool $allow_string
|
2021-10-28 20:08:43 +02:00
|
|
|
* @return ($allow_string is false ? ($object_or_class is object ? bool : false) : bool)
|
2021-10-12 20:13:04 +02:00
|
|
|
*/
|
2021-11-13 22:13:55 +01:00
|
|
|
function is_a($object_or_class, string $class, $allow_string = false): bool{}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @template T of array|string
|
|
|
|
* @param T $string
|
2021-11-14 10:36:03 +01:00
|
|
|
* @return (T is array<int, string> ? array<int, string> : T is array ? array : string|false)
|
2021-11-14 10:59:24 +01:00
|
|
|
* @psalm-ignore-falsable-return
|
2021-11-13 22:13:55 +01:00
|
|
|
*/
|
|
|
|
function mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false{}
|
2022-04-27 07:40:51 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @template TRead of null|array<array-key, resource>
|
|
|
|
* @template TWrite of null|array<array-key, resource>
|
|
|
|
* @template TExcept of null|array<array-key, resource>
|
|
|
|
* @param TRead $read
|
|
|
|
* @param TWrite $write
|
|
|
|
* @param TExcept $except
|
|
|
|
* @return false|int<0, max>
|
|
|
|
* @param-out (TRead is null ? null : array<array-key, resource>) $read
|
|
|
|
* @param-out (TWrite is null ? null : array<array-key, resource>) $write
|
|
|
|
* @param-out (TExcept is null ? null : array<array-key, resource>) $except
|
|
|
|
* @psalm-suppress ReferenceConstraintViolation
|
|
|
|
*/
|
|
|
|
function stream_select(null|array &$read, null|array &$write, null|array &$except, null|int $seconds, null|int $microseconds = null) : bool|int {}
|
2022-12-28 20:39:01 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function mysqli_escape_string($string) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function mysqli_real_escape_string($string) {}
|
2022-12-28 21:19:01 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function db2_escape_string($string) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string) -> return
|
|
|
|
*/
|
|
|
|
function cubrid_real_escape_string($string) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string1, $string2) -> return
|
|
|
|
*/
|
|
|
|
function pg_escape_bytea($string1, $string2 = null) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string1, $string2) -> return
|
|
|
|
*/
|
|
|
|
function pg_escape_identifier($string1, $string2 = null) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string1, $string2) -> return
|
|
|
|
*/
|
|
|
|
function pg_escape_literal($string1, $string2 = null) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @psalm-pure
|
|
|
|
*
|
|
|
|
* @psalm-taint-escape sql
|
|
|
|
* @psalm-flow ($string1, $string2) -> return
|
|
|
|
*/
|
|
|
|
function pg_escape_string($string1, $string2 = null) {}
|
2023-06-06 17:02:28 +02:00
|
|
|
|
2023-06-21 13:54:56 +02:00
|
|
|
if (defined('GLOB_BRACE')) {
|
|
|
|
/**
|
|
|
|
* @psalm-template P of string
|
|
|
|
* @psalm-template F of int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_BRACE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* @psalm-param P $pattern
|
|
|
|
* @psalm-param F $flags
|
|
|
|
* @psalm-return (
|
|
|
|
* P is ''
|
|
|
|
* ? (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOESCAPE, GLOB_BRACE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* ? false|list<never>
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_BRACE, GLOB_ERR>
|
|
|
|
* ? false|list{0:''}
|
|
|
|
* : false|list<never>
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOESCAPE, GLOB_BRACE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* ? false|list<non-empty-string>
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_BRACE, GLOB_ERR>
|
|
|
|
* ? false|list{0:non-empty-string, ...<non-empty-string>}
|
|
|
|
* : false|list<non-empty-string>
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
|
|
|
function glob (string $pattern, int $flags = 0): array|false {}
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
* @psalm-template P of string
|
|
|
|
* @psalm-template F of int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* @psalm-param P $pattern
|
|
|
|
* @psalm-param F $flags
|
|
|
|
* @psalm-return (
|
|
|
|
* P is ''
|
|
|
|
* ? (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOESCAPE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* ? false|list<never>
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_ERR>
|
|
|
|
* ? false|list{0:''}
|
|
|
|
* : false|list<never>
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOESCAPE, GLOB_ONLYDIR, GLOB_ERR>
|
|
|
|
* ? false|list<non-empty-string>
|
|
|
|
* : (F is int-mask<GLOB_MARK, GLOB_NOSORT, GLOB_NOCHECK, GLOB_NOESCAPE, GLOB_ERR>
|
|
|
|
* ? false|list{0:non-empty-string, ...<non-empty-string>}
|
|
|
|
* : false|list<non-empty-string>
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* )
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
|
|
|
function glob (string $pattern, int $flags = 0): array|false {}
|
|
|
|
}
|
2023-06-06 17:02:28 +02:00
|
|
|
|
2023-08-18 14:45:58 +02:00
|
|
|
/**
|
|
|
|
* @psalm-template TOutput of array|null
|
|
|
|
*
|
|
|
|
* @param TOutput $output
|
|
|
|
* @param-out (TOutput is null ? list<string> : array) $output
|
|
|
|
* @param-out int $result_code
|
|
|
|
*
|
|
|
|
* @psalm-taint-specialize
|
|
|
|
* @psalm-taint-sink shell $command
|
|
|
|
*/
|
|
|
|
function exec(string $command, &$output = null, int &$result_code = null): string|false {}
|
2023-10-24 15:03:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ($return_array is true ? array|false : object|false)
|
|
|
|
* @psalm-ignore-falsable-return
|
|
|
|
*/
|
|
|
|
function get_browser(?string $user_agent = null, bool $return_array = false): object|array|false {}
|