From 11ade70f98e4693a9a7e86c6dcbe786306af64b0 Mon Sep 17 00:00:00 2001 From: Zhangqi Chen Date: Wed, 12 Apr 2023 11:10:33 +0800 Subject: [PATCH 1/2] change signatures for `openssl_sign` to Adapt to php8+ for PHPStan --- generator/config/CustomPhpStanFunctionMap.php | 1 + generator/tests/DocPageTest.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/generator/config/CustomPhpStanFunctionMap.php b/generator/config/CustomPhpStanFunctionMap.php index 241488ec..b8b675d8 100644 --- a/generator/config/CustomPhpStanFunctionMap.php +++ b/generator/config/CustomPhpStanFunctionMap.php @@ -30,6 +30,7 @@ 'openssl_pkey_get_details' => ['array|false', 'key'=>'OpenSSLAsymmetricKey'], 'openssl_pkey_get_private' => ['OpenSSLAsymmetricKey|false', 'private_key'=>'OpenSSLAsymmetricKey|OpenSSLCertificate|array|string', 'passphrase='=>'null|string'], 'openssl_pkey_get_public' => ['OpenSSLAsymmetricKey|false', 'public_key'=>'OpenSSLAsymmetricKey|OpenSSLCertificate|array|string'], + 'openssl_sign' => ['void', 'data'=>'string', '&signature'=>'string|null', 'private_key'=>'OpenSSLAsymmetricKey|resource|string', 'algorithm'=>'int|string'], // theses replace ressource by OpenSSLCertificate 'openssl_verify' => ['-1|0|1|false', 'data'=>'string', 'signature'=>'string', 'pub_key_id'=>' OpenSSLAsymmetricKey|OpenSSLCertificate|string', 'signature_alg='=>'int|string'], 'openssl_x509_read' => ['OpenSSLCertificate|false', 'x509certdata'=>'OpenSSLCertificate|string'], // this replaces ressource by OpenSSLCertificate diff --git a/generator/tests/DocPageTest.php b/generator/tests/DocPageTest.php index 27760ea7..2a5efd42 100644 --- a/generator/tests/DocPageTest.php +++ b/generator/tests/DocPageTest.php @@ -25,12 +25,12 @@ public function testDetectFalsyFunction() $this->assertTrue($pregMatch->detectFalsyFunction()); $this->assertFalse($implode->detectFalsyFunction()); $this->assertTrue($getCwd->detectFalsyFunction()); - $this->assertTrue($setTime->detectFalsyFunction()); + $this->assertFalse($setTime->detectFalsyFunction()); $this->assertTrue($filesize->detectFalsyFunction()); $this->assertTrue($mcryptDecrypt->detectFalsyFunction()); $this->assertTrue($fsockopen->detectFalsyFunction()); $this->assertFalse($arrayReplace->detectFalsyFunction()); - $this->assertTrue($date->detectFalsyFunction()); + $this->assertFalse($date->detectFalsyFunction()); $this->assertTrue($classImplement->detectFalsyFunction()); $this->assertTrue($getHeaders->detectFalsyFunction()); $this->assertTrue($gzopen->detectFalsyFunction()); From 8b2d162e59aec497d1382f4fc7075cbeb2330930 Mon Sep 17 00:00:00 2001 From: Zhangqi Chen Date: Mon, 17 Apr 2023 15:14:03 +0800 Subject: [PATCH 2/2] Fix some excepted exceptions --- composer.json | 2 +- .../{GmpException.php => RnpException.php} | 2 +- generated/array.php | 2 - generated/classobj.php | 3 +- generated/curl.php | 11 +- generated/datetime.php | 104 --- generated/filesystem.php | 2 +- generated/fpm.php | 23 + generated/functionsList.php | 43 +- generated/gmp.php | 25 - generated/hash.php | 38 -- generated/ibmDb2.php | 67 +- generated/image.php | 54 +- generated/imap.php | 63 -- generated/info.php | 10 +- generated/ldap.php | 33 - generated/mbstring.php | 19 - generated/misc.php | 169 ----- generated/openssl.php | 2 +- generated/pspell.php | 44 -- generated/rnp.php | 629 ++++++++++++++++++ generated/sem.php | 4 +- generated/shmop.php | 7 +- generated/sockets.php | 2 +- generated/spl.php | 17 +- generated/ssh2.php | 14 +- generated/zlib.php | 41 -- rector-migrate.php | 42 +- 28 files changed, 817 insertions(+), 655 deletions(-) rename generated/Exceptions/{GmpException.php => RnpException.php} (79%) delete mode 100644 generated/gmp.php create mode 100644 generated/rnp.php diff --git a/composer.json b/composer.json index e85a6593..7d63ef64 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,6 @@ "generated/ftp.php", "generated/funchand.php", "generated/gettext.php", - "generated/gmp.php", "generated/gnupg.php", "generated/hash.php", "generated/ibase.php", @@ -73,6 +72,7 @@ "generated/ps.php", "generated/pspell.php", "generated/readline.php", + "generated/rnp.php", "generated/rpminfo.php", "generated/rrd.php", "generated/sem.php", diff --git a/generated/Exceptions/GmpException.php b/generated/Exceptions/RnpException.php similarity index 79% rename from generated/Exceptions/GmpException.php rename to generated/Exceptions/RnpException.php index d2c91da9..6cf8fb81 100644 --- a/generated/Exceptions/GmpException.php +++ b/generated/Exceptions/RnpException.php @@ -1,7 +1,7 @@ 'Safe\curl_share_setopt', 'curl_unescape' => 'Safe\curl_unescape', 'curl_upkeep' => 'Safe\curl_upkeep', - 'date' => 'Safe\date', - 'date_parse' => 'Safe\date_parse', 'date_parse_from_format' => 'Safe\date_parse_from_format', 'date_sunrise' => 'Safe\date_sunrise', 'date_sunset' => 'Safe\date_sunset', @@ -129,6 +127,7 @@ 'db2_free_result' => 'Safe\db2_free_result', 'db2_free_stmt' => 'Safe\db2_free_stmt', 'db2_get_option' => 'Safe\db2_get_option', + 'db2_num_rows' => 'Safe\db2_num_rows', 'db2_pclose' => 'Safe\db2_pclose', 'db2_rollback' => 'Safe\db2_rollback', 'db2_server_info' => 'Safe\db2_server_info', @@ -202,6 +201,7 @@ 'finfo_open' => 'Safe\finfo_open', 'flock' => 'Safe\flock', 'fopen' => 'Safe\fopen', + 'fpm_get_status' => 'Safe\fpm_get_status', 'fputcsv' => 'Safe\fputcsv', 'fread' => 'Safe\fread', 'fsockopen' => 'Safe\fsockopen', @@ -253,7 +253,6 @@ 'get_meta_tags' => 'Safe\get_meta_tags', 'glob' => 'Safe\glob', 'gmmktime' => 'Safe\gmmktime', - 'gmp_random_seed' => 'Safe\gmp_random_seed', 'gmstrftime' => 'Safe\gmstrftime', 'gnupg_adddecryptkey' => 'Safe\gnupg_adddecryptkey', 'gnupg_addencryptkey' => 'Safe\gnupg_addencryptkey', @@ -274,12 +273,10 @@ 'gzgetss' => 'Safe\gzgetss', 'gzinflate' => 'Safe\gzinflate', 'gzopen' => 'Safe\gzopen', - 'gzpassthru' => 'Safe\gzpassthru', 'gzread' => 'Safe\gzread', 'gzrewind' => 'Safe\gzrewind', 'gzuncompress' => 'Safe\gzuncompress', 'gzwrite' => 'Safe\gzwrite', - 'hash_hkdf' => 'Safe\hash_hkdf', 'hash_update_file' => 'Safe\hash_update_file', 'header_register_callback' => 'Safe\header_register_callback', 'hex2bin' => 'Safe\hex2bin', @@ -389,8 +386,6 @@ 'imagesettile' => 'Safe\imagesettile', 'imagestring' => 'Safe\imagestring', 'imagestringup' => 'Safe\imagestringup', - 'imagesx' => 'Safe\imagesx', - 'imagesy' => 'Safe\imagesy', 'imagetruecolortopalette' => 'Safe\imagetruecolortopalette', 'imagettfbbox' => 'Safe\imagettfbbox', 'imagettftext' => 'Safe\imagettftext', @@ -423,7 +418,6 @@ 'imap_listscan' => 'Safe\imap_listscan', 'imap_lsub' => 'Safe\imap_lsub', 'imap_mail' => 'Safe\imap_mail', - 'imap_mailboxmsginfo' => 'Safe\imap_mailboxmsginfo', 'imap_mail_compose' => 'Safe\imap_mail_compose', 'imap_mail_copy' => 'Safe\imap_mail_copy', 'imap_mail_move' => 'Safe\imap_mail_move', @@ -449,7 +443,6 @@ 'inet_ntop' => 'Safe\inet_ntop', 'inflate_add' => 'Safe\inflate_add', 'inflate_get_read_len' => 'Safe\inflate_get_read_len', - 'inflate_get_status' => 'Safe\inflate_get_status', 'inflate_init' => 'Safe\inflate_init', 'ini_get' => 'Safe\ini_get', 'ini_set' => 'Safe\ini_set', @@ -477,7 +470,6 @@ 'ldap_first_attribute' => 'Safe\ldap_first_attribute', 'ldap_first_entry' => 'Safe\ldap_first_entry', 'ldap_free_result' => 'Safe\ldap_free_result', - 'ldap_get_attributes' => 'Safe\ldap_get_attributes', 'ldap_get_dn' => 'Safe\ldap_get_dn', 'ldap_get_entries' => 'Safe\ldap_get_entries', 'ldap_get_option' => 'Safe\ldap_get_option', @@ -509,7 +501,6 @@ 'mb_chr' => 'Safe\mb_chr', 'mb_convert_encoding' => 'Safe\mb_convert_encoding', 'mb_detect_order' => 'Safe\mb_detect_order', - 'mb_encoding_aliases' => 'Safe\mb_encoding_aliases', 'mb_eregi_replace' => 'Safe\mb_eregi_replace', 'mb_ereg_replace' => 'Safe\mb_ereg_replace', 'mb_ereg_replace_callback' => 'Safe\mb_ereg_replace_callback', @@ -696,7 +687,6 @@ 'openssl_x509_read' => 'Safe\openssl_x509_read', 'output_add_rewrite_var' => 'Safe\output_add_rewrite_var', 'output_reset_rewrite_vars' => 'Safe\output_reset_rewrite_vars', - 'pack' => 'Safe\pack', 'parse_ini_file' => 'Safe\parse_ini_file', 'parse_ini_string' => 'Safe\parse_ini_string', 'parse_url' => 'Safe\parse_url', @@ -780,7 +770,6 @@ 'pspell_add_to_personal' => 'Safe\pspell_add_to_personal', 'pspell_add_to_session' => 'Safe\pspell_add_to_session', 'pspell_clear_session' => 'Safe\pspell_clear_session', - 'pspell_config_create' => 'Safe\pspell_config_create', 'pspell_config_data_dir' => 'Safe\pspell_config_data_dir', 'pspell_config_dict_dir' => 'Safe\pspell_config_dict_dir', 'pspell_config_ignore' => 'Safe\pspell_config_ignore', @@ -874,6 +863,33 @@ 'rename' => 'Safe\rename', 'rewind' => 'Safe\rewind', 'rmdir' => 'Safe\rmdir', + 'rnp_decrypt' => 'Safe\rnp_decrypt', + 'rnp_dump_packets' => 'Safe\rnp_dump_packets', + 'rnp_dump_packets_to_json' => 'Safe\rnp_dump_packets_to_json', + 'rnp_ffi_create' => 'Safe\rnp_ffi_create', + 'rnp_ffi_set_pass_provider' => 'Safe\rnp_ffi_set_pass_provider', + 'rnp_import_keys' => 'Safe\rnp_import_keys', + 'rnp_import_signatures' => 'Safe\rnp_import_signatures', + 'rnp_key_export' => 'Safe\rnp_key_export', + 'rnp_key_export_autocrypt' => 'Safe\rnp_key_export_autocrypt', + 'rnp_key_export_revocation' => 'Safe\rnp_key_export_revocation', + 'rnp_key_get_info' => 'Safe\rnp_key_get_info', + 'rnp_key_remove' => 'Safe\rnp_key_remove', + 'rnp_key_revoke' => 'Safe\rnp_key_revoke', + 'rnp_list_keys' => 'Safe\rnp_list_keys', + 'rnp_load_keys' => 'Safe\rnp_load_keys', + 'rnp_load_keys_from_path' => 'Safe\rnp_load_keys_from_path', + 'rnp_locate_key' => 'Safe\rnp_locate_key', + 'rnp_op_encrypt' => 'Safe\rnp_op_encrypt', + 'rnp_op_generate_key' => 'Safe\rnp_op_generate_key', + 'rnp_op_sign' => 'Safe\rnp_op_sign', + 'rnp_op_sign_cleartext' => 'Safe\rnp_op_sign_cleartext', + 'rnp_op_sign_detached' => 'Safe\rnp_op_sign_detached', + 'rnp_op_verify' => 'Safe\rnp_op_verify', + 'rnp_op_verify_detached' => 'Safe\rnp_op_verify_detached', + 'rnp_save_keys' => 'Safe\rnp_save_keys', + 'rnp_save_keys_to_path' => 'Safe\rnp_save_keys_to_path', + 'rnp_supported_features' => 'Safe\rnp_supported_features', 'rpmaddtag' => 'Safe\rpmaddtag', 'rrd_create' => 'Safe\rrd_create', 'rrd_first' => 'Safe\rrd_first',