-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update functionMaps #2699
Update functionMaps #2699
Conversation
@@ -3912,14 +3912,14 @@ | |||
'HaruPage::textOut' => ['bool', 'x'=>'float', 'y'=>'float', 'text'=>'string'], | |||
'HaruPage::textRect' => ['bool', 'left'=>'float', 'top'=>'float', 'right'=>'float', 'bottom'=>'float', 'text'=>'string', 'align='=>'int'], | |||
'hash' => ['non-empty-string|false', 'algo'=>'string', 'data'=>'string', 'raw_output='=>'bool'], | |||
'hash_algos' => ['list<non-empty-string>'], | |||
'hash_algos' => ['non-empty-list<non-falsy-string>'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function always returns non-empty-list and neither '0'
nor ''
. https://www.php.net/manual/en/function.hash-algos.php
'hash_copy' => ['HashContext', 'context'=>'HashContext'], | ||
'hash_equals' => ['bool', 'known_string'=>'string', 'user_string'=>'string'], | ||
'hash_file' => ['non-empty-string|false', 'algo'=>'string', 'filename'=>'string', 'raw_output='=>'bool'], | ||
'hash_final' => ['non-empty-string', 'context'=>'HashContext', 'raw_output='=>'bool'], | ||
'hash_hkdf' => ['non-empty-string|false', 'algo'=>'string', 'key'=>'string', 'length='=>'int', 'info='=>'string', 'salt='=>'string'], | ||
'hash_hmac' => ['non-empty-string|false', 'algo'=>'string', 'data'=>'string', 'key'=>'string', 'raw_output='=>'bool'], | ||
'hash_hmac_algos' => ['list<non-empty-string>'], | ||
'hash_hmac_algos' => ['non-empty-list<non-falsy-string>'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function always returns non-empty-list and neither '0'
nor ''
.
https://www.php.net/manual/en/function.hash-hmac-algos.php
'sha1' => ['non-empty-string', 'str'=>'string', 'raw_output='=>'bool'], | ||
'sha1_file' => ['non-empty-string|false', 'filename'=>'string', 'raw_output='=>'bool'], | ||
'sha1' => ['non-falsy-string', 'str'=>'string', 'raw_output='=>'bool'], | ||
'sha1_file' => ['non-falsy-string|false', 'filename'=>'string', 'raw_output='=>'bool'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MD5 and SHA1 are fixed lengths, so they will never return either '0'
or ''
.
'min' => ['', '...arg1'=>'non-empty-array'], | ||
'file' => ['list<string>|false', 'filename'=>'string', 'flags='=>'int-mask<FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES|FILE_NO_DEFAULT_CONTEXT>', 'context='=>'resource'], | ||
'flock' => ['bool', 'fp'=>'resource', 'operation'=>'int-mask<LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB>', '&w_wouldblock='=>'int'], | ||
'flock' => ['bool', 'fp'=>'resource', 'operation'=>'int-mask<LOCK_SH, LOCK_EX, LOCK_UN, LOCK_NB>', '&w_wouldblock='=>'0|1'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function sets only 0
and 1
in the variable by reference.
https://github.com/php/php-src/blob/php-8.2.5/ext/standard/file.c#L212-L221
@@ -5,6 +5,9 @@ | |||
'error_log' => ['bool', 'message'=>'string', 'message_type='=>'0|1|3|4', 'destination='=>'string', 'extra_headers='=>'string'], | |||
'filter_input' => ['mixed', 'type'=>'INPUT_GET|INPUT_POST|INPUT_COOKIE|INPUT_SERVER|INPUT_ENV', 'variable_name'=>'string', 'filter='=>'int', 'options='=>'array|int'], | |||
'filter_input_array' => ['array|false|null', 'type'=>'INPUT_GET|INPUT_POST|INPUT_COOKIE|INPUT_SERVER|INPUT_ENV', 'definition='=>'int|array', 'add_empty='=>'bool'], | |||
'hash_hkdf' => ['non-empty-string', 'algo'=>'non-falsy-string', 'key'=>'string', 'length='=>'0|positive-int', 'info='=>'string', 'salt='=>'string'], | |||
'hash_pbkdf2' => ['non-empty-string', 'algo'=>'non-falsy-string', 'password'=>'string', 'salt'=>'string', 'iterations'=>'positive-int', 'length='=>'0|positive-int', 'raw_output='=>'bool'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$length = 0
means the default length, so an empty string will never be returned.
Hi, this looks good but I can't merge it because some tests are still failing. |
Sorry, I'll fix it tonight (UTC+9). |
@@ -6320,10 +6320,10 @@ | |||
'mb_decode_mimeheader' => ['string', 'string'=>'string'], | |||
'mb_decode_numericentity' => ['string', 'string'=>'string', 'convmap'=>'array', 'encoding'=>'string'], | |||
'mb_detect_encoding' => ['string|false', 'str'=>'string', 'encoding_list='=>'mixed', 'strict='=>'bool'], | |||
'mb_detect_order' => ['bool|list<string>', 'encoding_list='=>'mixed'], | |||
'mb_detect_order' => ['bool|list<non-falsy-string>', 'encoding_list='=>'mixed'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this kind of changes actually bring any value at all? I feel like it's counterproductive and might lead to possible mistakes if something is overlooked (i.e. are we 100% sure there can be no falsy string in that list, ever under all circumstances and system setups?).
Please fix the build https://github.com/phpstan/phpstan-src/actions/runs/6711125445/job/18237809504 |
'session_id' => ['string|false', 'newid='=>'string'], | ||
'session_is_registered' => ['bool', 'name'=>'string'], | ||
'session_module_name' => ['string|false', 'newname='=>'string'], | ||
'session_name' => ['string|false', 'newname='=>'string'], | ||
'session_name' => ['non-falsy-string|false', 'newname='=>'string'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both '0'
and ''
are not valid session names.
@@ -10373,11 +10373,11 @@ | |||
'session_destroy' => ['bool'], | |||
'session_encode' => ['string|false'], | |||
'session_gc' => ['int|false'], | |||
'session_get_cookie_params' => ['array'], | |||
'session_get_cookie_params' => ['array{lifetime:0|positive-int,path:non-falsy-string,domain:string,secure:bool,httponly:bool,samesite:string}'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes Sorry to keep you waiting, I've pushed the fix. |
Thank you. |
No description provided.