From 6cf0657c6a8d9e8964792c4b741531dffc394ae6 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 31 Oct 2022 00:43:40 +0300 Subject: [PATCH 1/5] Add dictionary delta for PHP 8.2 --- dictionaries/CallMap_82_delta.php | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dictionaries/CallMap_82_delta.php diff --git a/dictionaries/CallMap_82_delta.php b/dictionaries/CallMap_82_delta.php new file mode 100644 index 00000000000..30e5e9c6e92 --- /dev/null +++ b/dictionaries/CallMap_82_delta.php @@ -0,0 +1,33 @@ + [ + 'mysqli_execute_query' => ['mysqli_result|bool', 'mysqli'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], + 'mysqli::execute_query' => ['mysqli_result|bool', 'query'=>'non-empty-string', 'params='=>'list|null'], + 'openssl_cipher_key_length' => ['positive-int|false', 'cipher_algo'=>'non-empty-string'], + 'curl_upkeep' => ['bool', 'handle'=>'CurlHandle'], + 'ini_parse_quantity' => ['int', 'shorthand'=>'non-empty-string'], + 'memory_reset_peak_usage' => ['void'], + ], + + 'changed' => [ + 'str_split' => [ + 'old' => ['non-empty-list', 'string'=>'string', 'length='=>'positive-int'], + 'new' => ['list', 'string'=>'string', 'length='=>'positive-int'], + ], + ], +]; From 61e95f948d1172b95898a93b9d3d62a583be479d Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 31 Oct 2022 01:42:05 +0300 Subject: [PATCH 2/5] Add `removed` section --- dictionaries/CallMap_82_delta.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dictionaries/CallMap_82_delta.php b/dictionaries/CallMap_82_delta.php index 30e5e9c6e92..ecbff9d3972 100644 --- a/dictionaries/CallMap_82_delta.php +++ b/dictionaries/CallMap_82_delta.php @@ -30,4 +30,7 @@ 'new' => ['list', 'string'=>'string', 'length='=>'positive-int'], ], ], + + 'removed' => [ + ], ]; From 855eef9205f331259f66e05b355d39b7bfa810f1 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 31 Oct 2022 12:44:08 +0300 Subject: [PATCH 3/5] Increment PHP_MINOR_VERSION (to load delta for PHP 8.2) --- src/Psalm/Internal/Codebase/InternalCallMapHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php index 8af4d0cbd75..2e09fbd70b1 100644 --- a/src/Psalm/Internal/Codebase/InternalCallMapHandler.php +++ b/src/Psalm/Internal/Codebase/InternalCallMapHandler.php @@ -37,7 +37,7 @@ class InternalCallMapHandler { private const PHP_MAJOR_VERSION = 8; - private const PHP_MINOR_VERSION = 1; + private const PHP_MINOR_VERSION = 2; private const LOWEST_AVAILABLE_DELTA = 71; /** From b450eac812547cefc52fc2b62b1382acb1261365 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 31 Oct 2022 13:00:11 +0300 Subject: [PATCH 4/5] Add PHP 8.2 functions to the main delta --- dictionaries/CallMap.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 5284fd27ea7..8b95e378336 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -2,7 +2,7 @@ namespace Phan\Language\Internal; /** - * CURRENT PHP TARGET VERSION: 8.1 + * CURRENT PHP TARGET VERSION: 8.2 * The version above has to match Psalm\Internal\Codebase\InternalCallMapHandler::PHP_(MAJOR|MINOR)_VERSION * * Format @@ -1695,6 +1695,7 @@ 'curl_share_setopt' => ['bool', 'share_handle'=>'CurlShareHandle', 'option'=>'int', 'value'=>'mixed'], 'curl_share_strerror' => ['?string', 'error_code'=>'int'], 'curl_strerror' => ['?string', 'error_code'=>'int'], +'curl_upkeep' => ['bool', 'handle'=>'CurlHandle'], 'curl_unescape' => ['string|false', 'handle'=>'CurlShareHandle', 'string'=>'string'], 'curl_version' => ['array', 'version='=>'int'], 'CURLFile::__construct' => ['void', 'filename'=>'string', 'mimetype='=>'string', 'postfilename='=>'string'], @@ -6136,6 +6137,7 @@ 'ini_get' => ['string|false', 'option'=>'string'], 'ini_get_all' => ['array|false', 'extension='=>'?string', 'details='=>'bool'], 'ini_restore' => ['void', 'option'=>'string'], +'ini_parse_quantity' => ['int', 'shorthand'=>'non-empty-string'], 'ini_set' => ['string|false', 'option'=>'string', 'value'=>'string|int|float|bool|null'], 'inotify_add_watch' => ['int', 'inotify_instance'=>'resource', 'pathname'=>'string', 'mask'=>'int'], 'inotify_init' => ['resource|false'], @@ -7474,6 +7476,7 @@ 'MemcachePool::setServerParams' => ['bool', 'host'=>'string', 'port='=>'int', 'timeout='=>'int', 'retry_interval='=>'int', 'status='=>'bool', 'failure_callback='=>'?callable'], 'memory_get_peak_usage' => ['int', 'real_usage='=>'bool'], 'memory_get_usage' => ['int', 'real_usage='=>'bool'], +'memory_reset_peak_usage' => ['void'], 'MessageFormatter::__construct' => ['void', 'locale'=>'string', 'pattern'=>'string'], 'MessageFormatter::create' => ['MessageFormatter', 'locale'=>'string', 'pattern'=>'string'], 'MessageFormatter::format' => ['false|string', 'args'=>'array'], @@ -8442,6 +8445,7 @@ 'mysqli::disable_reads_from_master' => ['bool'], 'mysqli::dump_debug_info' => ['bool'], 'mysqli::escape_string' => ['string', 'string'=>'string'], +'mysqli::execute_query' => ['mysqli_result|bool', 'query'=>'non-empty-string', 'params='=>'list|null'], 'mysqli::get_charset' => ['object'], 'mysqli::get_client_info' => ['string'], 'mysqli::get_connection_stats' => ['array'], @@ -8503,6 +8507,7 @@ 'mysqli_error_list' => ['array', 'mysql'=>'mysqli'], 'mysqli_escape_string' => ['string', 'mysql'=>'mysqli', 'string'=>'string'], 'mysqli_execute' => ['bool', 'statement'=>'mysqli_stmt', 'params='=>'list|null'], +'mysqli_execute_query' => ['mysqli_result|bool', 'mysqli'=>'mysqli', 'query'=>'non-empty-string', 'params='=>'list|null'], 'mysqli_fetch_all' => ['list>', 'result'=>'mysqli_result', 'mode='=>'3'], 'mysqli_fetch_all\'1' => ['list>', 'result'=>'mysqli_result', 'mode='=>'1'], 'mysqli_fetch_all\'2' => ['list>', 'result'=>'mysqli_result', 'mode='=>'2'], @@ -9353,6 +9358,7 @@ 'opendir' => ['resource|false', 'directory'=>'string', 'context='=>'resource'], 'openlog' => ['bool', 'prefix'=>'string', 'flags'=>'int', 'facility'=>'int'], 'openssl_cipher_iv_length' => ['int|false', 'cipher_algo'=>'string'], +'openssl_cipher_key_length' => ['positive-int|false', 'cipher_algo'=>'non-empty-string'], 'openssl_csr_export' => ['bool', 'csr'=>'OpenSSLCertificateSigningRequest|string', '&w_output'=>'string', 'no_text='=>'bool'], 'openssl_csr_export_to_file' => ['bool', 'csr'=>'OpenSSLCertificateSigningRequest|string', 'output_filename'=>'string', 'no_text='=>'bool'], 'openssl_csr_get_public_key' => ['OpenSSLAsymmetricKey|false', 'csr'=>'OpenSSLCertificateSigningRequest|string', 'short_names='=>'bool'], From 9516baced686a07267179ecf4194aeaa9fa93039 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Mon, 31 Oct 2022 21:27:46 +0300 Subject: [PATCH 5/5] Update `str_split` signature to reflect PHP 8.2 changes --- dictionaries/CallMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index 8b95e378336..2eb740c9f69 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -13824,7 +13824,7 @@ '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' => ['non-empty-list', 'string'=>'string', 'length='=>'positive-int'], +'str_split' => ['list', 'string'=>'string', 'length='=>'positive-int'], 'str_starts_with' => ['bool', 'haystack'=>'string', 'needle'=>'string'], 'str_word_count' => ['array|int', 'string'=>'string', 'format='=>'int', 'characters='=>'string'], 'strcasecmp' => ['int', 'string1'=>'string', 'string2'=>'string'],