Skip to content

Commit b247fb9

Browse files
committed
uniqid: Tighten return type to non-falsy-string
This commit tightens the return type of the 'uniqid' function from non-empty-string to non-falsy-string. The official documentation [1] of the uniqid function says: > With an empty prefix, the returned string will be 13 characters long. If more_entropy is true, it will be 23 characters. This implies that the returned string will be of length strlen(prefix) + (more_entropy ? 23 : 13). In either case, it will be of at least length 13. But the only falsy strings are '0' and '' (both of length less than 13) [2]. Hence the return value will always be a non-falsy-string. [1] https://www.php.net/manual/en/function.uniqid.php [2] https://www.php.net/manual/en/language.types.boolean.php
1 parent 8f78985 commit b247fb9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11282,7 +11282,7 @@
1128211282
'UnexpectedValueException::getPrevious' => ['Throwable|UnexpectedValueException|null'],
1128311283
'UnexpectedValueException::getTrace' => ['list<array{function:string,line?:int,file?:string,class?:class-string,type?:\'::\'|\'->\',args?:list<mixed>,object?:object}>'],
1128411284
'UnexpectedValueException::getTraceAsString' => ['string'],
11285-
'uniqid' => ['non-empty-string', 'prefix='=>'string', 'more_entropy='=>'bool'],
11285+
'uniqid' => ['non-falsy-string', 'prefix='=>'string', 'more_entropy='=>'bool'],
1128611286
'unixtojd' => ['int|false', 'timestamp='=>'int'],
1128711287
'unlink' => ['bool', 'filename'=>'string', 'context='=>'resource'],
1128811288
'unpack' => ['array|false', 'format'=>'string', 'data'=>'string', 'offset='=>'int'],

0 commit comments

Comments
 (0)