mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix return type of str_split()
This commit is contained in:
parent
902a019f0a
commit
39bb7b45a7
@ -12898,7 +12898,7 @@ return [
|
||||
'str_replace' => ['string|string[]', 'search'=>'string|array', 'replace'=>'string|array', 'subject'=>'string|array', '&w_count='=>'int'],
|
||||
'str_rot13' => ['string', 'string'=>'string'],
|
||||
'str_shuffle' => ['string', 'string'=>'string'],
|
||||
'str_split' => ['list<string>', 'string'=>'string', 'length='=>'positive-int'],
|
||||
'str_split' => ['list<non-empty-string>', 'string'=>'string', 'length='=>'positive-int'],
|
||||
'str_starts_with' => ['bool', 'haystack'=>'string', 'needle'=>'string'],
|
||||
'str_word_count' => ['array<int, string>|int', 'string'=>'string', 'format='=>'int', 'characters='=>'?string'],
|
||||
'strcasecmp' => ['int', 'string1'=>'string', 'string2'=>'string'],
|
||||
|
@ -51,7 +51,7 @@ return [
|
||||
],
|
||||
'str_split' => [
|
||||
'old' => ['non-empty-list<string>', 'string'=>'string', 'length='=>'positive-int'],
|
||||
'new' => ['list<string>', 'string'=>'string', 'length='=>'positive-int'],
|
||||
'new' => ['list<non-empty-string>', 'string'=>'string', 'length='=>'positive-int'],
|
||||
],
|
||||
],
|
||||
|
||||
|
@ -108,7 +108,6 @@ class TypeTokenizer
|
||||
* contains the string token and the second element contains its offset,
|
||||
*
|
||||
* @return list<array{0: string, 1: int}>
|
||||
* @psalm-suppress PossiblyUndefinedIntArrayOffset
|
||||
*/
|
||||
public static function tokenize(string $string_type, bool $ignore_space = true): array
|
||||
{
|
||||
|
@ -1050,7 +1050,8 @@ function str_shuffle(string $string): string {}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @return ($length is positive-int ? list<string> : false)
|
||||
* @param positive-int $length
|
||||
* @return non-empty-list<string>
|
||||
*
|
||||
* @psalm-flow ($string) -> return
|
||||
*/
|
||||
|
@ -45,4 +45,13 @@ namespace {
|
||||
{
|
||||
public function __construct() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @param positive-int $length
|
||||
* @return list<non-empty-string>
|
||||
*
|
||||
* @psalm-flow ($string) -> return
|
||||
*/
|
||||
function str_split(string $string, int $length = 1) {}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user