Skip to content

Commit

Permalink
More precise signatures for mb_* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Feb 1, 2022
1 parent af38f03 commit 82e98da
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions resources/functionMap.php
Expand Up @@ -6345,18 +6345,18 @@
'mb_split' => ['array|false', 'pattern'=>'string', 'string'=>'string', 'limit='=>'int'],
'mb_strcut' => ['string', 'str'=>'string', 'start'=>'int', 'length='=>'?int', 'encoding='=>'string'],
'mb_strimwidth' => ['string', 'str'=>'string', 'start'=>'int', 'width'=>'int', 'trimmarker='=>'string', 'encoding='=>'string'],
'mb_stripos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_stripos' => ['0|positive-int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_stristr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'part='=>'bool', 'encoding='=>'string'],
'mb_strlen' => ['int|false', 'str'=>'string', 'encoding='=>'string'],
'mb_strpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strlen' => ['0|positive-int|false', 'str'=>'string', 'encoding='=>'string'],
'mb_strpos' => ['0|positive-int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strrchr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'part='=>'bool', 'encoding='=>'string'],
'mb_strrichr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'part='=>'bool', 'encoding='=>'string'],
'mb_strripos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strrpos' => ['int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strripos' => ['0|positive-int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strrpos' => ['0|positive-int|false', 'haystack'=>'string', 'needle'=>'string', 'offset='=>'int', 'encoding='=>'string'],
'mb_strstr' => ['string|false', 'haystack'=>'string', 'needle'=>'string', 'part='=>'bool', 'encoding='=>'string'],
'mb_strtolower' => ['string', 'str'=>'string', 'encoding='=>'string'],
'mb_strtoupper' => ['string', 'str'=>'string', 'encoding='=>'string'],
'mb_strwidth' => ['int', 'str'=>'string', 'encoding='=>'string'],
'mb_strwidth' => ['0|positive-int', 'str'=>'string', 'encoding='=>'string'],
'mb_substitute_character' => ['mixed', 'substchar='=>'mixed'],
'mb_substr' => ['string', 'str'=>'string', 'start'=>'int', 'length='=>'?int', 'encoding='=>'string'],
'mb_substr_count' => ['0|positive-int', 'haystack'=>'string', 'needle'=>'string', 'encoding='=>'string'],
Expand Down
2 changes: 2 additions & 0 deletions resources/functionMap_php80delta.php
Expand Up @@ -75,6 +75,7 @@
'ldap_set_rebind_proc' => ['bool', 'ldap'=>'resource', 'callback'=>'?callable'],
'mb_decode_numericentity' => ['string|false', 'string'=>'string', 'convmap'=>'array', 'encoding='=>'string'],
'mb_str_split' => ['non-empty-array<int,string>', 'str'=>'string', 'split_length='=>'positive-int', 'encoding='=>'string'],
'mb_strlen' => ['0|positive-int', 'str'=>'string', 'encoding='=>'string'],
'mktime' => ['int|false', 'hour'=>'int', 'minute='=>'int', 'second='=>'int', 'month='=>'int', 'day='=>'int', 'year='=>'int'],
'odbc_exec' => ['resource|false', 'connection_id'=>'resource', 'query'=>'string'],
'parse_str' => ['void', 'encoded_string'=>'string', '&w_result'=>'array'],
Expand Down Expand Up @@ -206,6 +207,7 @@
'ldap_sort' => ['bool', 'link_identifier'=>'resource', 'result_identifier'=>'resource', 'sortfilter'=>'string'],
'mb_decode_numericentity' => ['string|false', 'string'=>'string', 'convmap'=>'array', 'encoding='=>'string', 'is_hex='=>'bool'],
'mktime' => ['int|false', 'hour='=>'int', 'minute='=>'int', 'second='=>'int', 'month='=>'int', 'day='=>'int', 'year='=>'int'],
'mb_strlen' => ['0|positive-int', 'str'=>'string', 'encoding='=>'string'],
'odbc_exec' => ['resource|false', 'connection_id'=>'resource', 'query'=>'string', 'flags='=>'int'],
'parse_str' => ['void', 'encoded_string'=>'string', '&w_result='=>'array'],
'password_hash' => ['string|false|null', 'password'=>'string', 'algo'=>'?string|?int', 'options='=>'array'],
Expand Down
10 changes: 5 additions & 5 deletions tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php
Expand Up @@ -5302,27 +5302,27 @@ public function dataFunctions(): array
'$versionCompare8',
],
[
'int',
'int<0, max>',
'$mbStrlenWithoutEncoding',
],
[
'int',
'int<0, max>',
'$mbStrlenWithValidEncoding',
],
[
'int',
'int<0, max>',
'$mbStrlenWithValidEncodingAlias',
],
[
'false',
'$mbStrlenWithInvalidEncoding',
],
[
PHP_VERSION_ID < 80000 ? 'int|false' : 'int',
PHP_VERSION_ID < 80000 ? 'int<0, max>|false' : 'int<0, max>',
'$mbStrlenWithValidAndInvalidEncoding',
],
[
PHP_VERSION_ID < 80000 ? 'int|false' : 'int',
PHP_VERSION_ID < 80000 ? 'int<0, max>|false' : 'int<0, max>',
'$mbStrlenWithUnknownEncoding',
],
[
Expand Down

0 comments on commit 82e98da

Please sign in to comment.