1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Update password function types for PHP 7.4 (#2396)

* Support NULL predefined constants

* Fix #2395 - update password_hash() and password_needs_rehash() types for PHP 7.4

* Change $fq_const_name check so it still uses isset
This commit is contained in:
Pavel Batečko 2019-11-29 15:30:01 +01:00 committed by Matthew Brown
parent a4e18f9b5e
commit dc78e9c57b
3 changed files with 7 additions and 4 deletions

View File

@ -17,6 +17,7 @@ use Psalm\Issue\ParentNotFound;
use Psalm\Issue\UndefinedConstant;
use Psalm\IssueBuffer;
use Psalm\Type;
use function array_key_exists;
use function implode;
use function strtolower;
use function explode;
@ -102,7 +103,7 @@ class ConstFetchAnalyzer
$predefined_constants = $codebase->config->getPredefinedConstants();
if (isset($predefined_constants[$fq_const_name])
if (($fq_const_name && isset($predefined_constants[$fq_const_name]))
|| isset($predefined_constants[$const_name])
) {
switch ($const_name) {

View File

@ -9356,9 +9356,9 @@ return [
'parsekit_func_arginfo' => ['array', 'function'=>'mixed'],
'passthru' => ['void', 'command'=>'string', '&w_return_value='=>'int'],
'password_get_info' => ['array', 'hash'=>'string'],
'password_hash' => ['string|false|null', 'password'=>'string', 'algo'=>'int', 'options='=>'array'],
'password_hash' => ['string|null', 'password'=>'string', 'algo'=>'int|string|null', 'options='=>'array'],
'password_make_salt' => ['bool', 'password'=>'string', 'hash'=>'string'],
'password_needs_rehash' => ['bool', 'hash'=>'string', 'algo'=>'int', 'options='=>'array'],
'password_needs_rehash' => ['bool', 'hash'=>'string', 'algo'=>'int|string|null', 'options='=>'array'],
'password_verify' => ['bool', 'password'=>'string', 'hash'=>'string'],
'pathinfo' => ['array|string', 'path'=>'string', 'options='=>'int'],
'pclose' => ['int', 'fp'=>'resource'],

View File

@ -15,9 +15,11 @@
*/
return [
'new' => [
'password_hash' => ['string|null', 'password'=>'string', 'algo'=>'int', 'options='=>'array'],
'password_hash' => ['string|null', 'password'=>'string', 'algo'=>'int|string|null', 'options='=>'array'],
'password_needs_rehash' => ['bool', 'hash'=>'string', 'algo'=>'int|string|null', 'options='=>'array'],
],
'old' => [
'password_hash' => ['string|false', 'password'=>'string', 'algo'=>'int', 'options='=>'array'],
'password_needs_rehash' => ['bool', 'hash'=>'string', 'algo'=>'int', 'options='=>'array'],
]
];