Add more specific array return type hints for various extensions - part 6 (#7474)

This commit is contained in:
Máté Kocsis 2021-10-07 14:29:29 +02:00 committed by GitHub
parent 7eab93bcbb
commit d9e5e63032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 78 additions and 6 deletions

View File

@ -299,9 +299,13 @@ static const func_info_t func_infos[] = {
F1("mysqli_stat", MAY_BE_STRING|MAY_BE_FALSE),
F1("mysqli_store_result", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("mysqli_use_result", MAY_BE_OBJECT|MAY_BE_FALSE),
FN("oci_fetch_row", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
FN("oci_fetch_assoc", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
FN("oci_fetch_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
FN("oci_new_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("oci_error", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
FN("oci_parse", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_get_implicit_resultset", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("oci_password_change", MAY_BE_RESOURCE|MAY_BE_BOOL),
@ -333,6 +337,15 @@ static const func_info_t func_infos[] = {
#endif
F1("opcache_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("opcache_get_configuration", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("openssl_x509_parse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("openssl_csr_get_subject", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("openssl_pkey_get_details", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
F1("openssl_get_md_methods", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("openssl_get_cipher_methods", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
#if defined(HAVE_EVP_PKEY_EC)
F1("openssl_get_curve_names", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("openssl_get_cert_locations", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
FN("pcntl_signal_get_handler", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT|MAY_BE_LONG),
FN("preg_replace", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_NULL),
FN("preg_filter", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_NULL),
@ -406,10 +419,19 @@ static const func_info_t func_infos[] = {
F1("session_encode", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_get_cookie_params", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY),
F1("session_cache_limiter", MAY_BE_STRING|MAY_BE_FALSE),
F1("socket_get_option", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_LONG|MAY_BE_FALSE),
FN("socket_export_stream", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("socket_addrinfo_lookup", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_FALSE),
F1("socket_addrinfo_explain", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY),
FN("sodium_crypto_kx_client_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
FN("sodium_crypto_kx_server_session_keys", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F0("sodium_crypto_generichash_update", MAY_BE_TRUE),
#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
FN("sodium_crypto_secretstream_xchacha20poly1305_init_push", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
#endif
#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
FN("sodium_crypto_secretstream_xchacha20poly1305_pull", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("class_implements", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("class_parents", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("class_uses", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),

View File

@ -326,11 +326,16 @@ function oci_pconnect(string $username, string $password, ?string $connection_st
*/
function ociplogon(string $username, string $password, ?string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) {}
/** @param resource|null $connection_or_statement */
/**
* @param resource|null $connection_or_statement
* @return array<string, int|string>|false
* @refcount 1
*/
function oci_error($connection_or_statement = null): array|false {}
/**
* @param resource|null $connection_or_statement
* @return array<string, int|string>|false
* @alias oci_error
* @deprecated
*/

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 1bb2deae12b80335372768e1eb21ec86cfddfae9 */
* Stub hash: 46ee8ce62b36639636b4f5126e20a4b4e1df2e25 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)

View File

@ -39,6 +39,10 @@ function openssl_x509_check_private_key(OpenSSLCertificate|string $certificate,
/** @param OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key */
function openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key): int {}
/**
* @return array<string, int|string|array>|false
* @refcount 1
*/
function openssl_x509_parse(OpenSSLCertificate|string $certificate, bool $short_names = true): array|false {}
function openssl_x509_checkpurpose(OpenSSLCertificate|string $certificate, int $purpose, array $ca_info = [], ?string $untrusted_certificates_file = null): bool|int {}
@ -71,6 +75,10 @@ function openssl_csr_sign(OpenSSLCertificateSigningRequest|string $csr, OpenSSLC
/** @param OpenSSLAsymmetricKey $private_key */
function openssl_csr_new(array $distinguished_names, &$private_key, ?array $options = null, ?array $extra_attributes = null): OpenSSLCertificateSigningRequest|false {}
/**
* @return array<string, string|array>|false
* @refcount 1
*/
function openssl_csr_get_subject(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): array|false {}
function openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): OpenSSLAsymmetricKey|false {}
@ -113,6 +121,10 @@ function openssl_pkey_get_private($private_key, ?string $passphrase = null): Ope
*/
function openssl_get_privatekey($private_key, ?string $passphrase = null): OpenSSLAsymmetricKey|false {}
/**
* @return array<string, int|string|array>|false
* @refcount 1
*/
function openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false {}
function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algo = "sha1"): string|false {}
@ -199,11 +211,23 @@ function openssl_seal(string $data, &$sealed_data, &$encrypted_keys, array $publ
*/
function openssl_open(string $data, &$output, string $encrypted_key, $private_key, string $cipher_algo, ?string $iv = null): bool {}
/**
* @return array<int, string>
* @refcount 1
*/
function openssl_get_md_methods(bool $aliases = false): array {}
/**
* @return array<int, string>
* @refcount 1
*/
function openssl_get_cipher_methods(bool $aliases = false): array {}
#ifdef HAVE_EVP_PKEY_EC
/**
* @return array<int, string>|false
* @refcount 1
*/
function openssl_get_curve_names(): array|false {}
#endif
@ -235,4 +259,8 @@ function openssl_spki_export(string $spki): string|false {}
function openssl_spki_export_challenge(string $spki): string|false {}
/**
* @return array<string, string>
* @refcount 1
*/
function openssl_get_cert_locations(): array {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b0d7811060ba2499a0c2908aad8ab160cd604043 */
* Stub hash: 3ad007a0b29648c29051f9ee00fe43dd6f2a766d */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
ZEND_ARG_OBJ_TYPE_MASK(0, certificate, OpenSSLCertificate, MAY_BE_STRING, NULL)

View File

@ -70,9 +70,16 @@ function socket_recvfrom(Socket $socket, &$data, int $length, int $flags, &$addr
function socket_sendto(Socket $socket, string $data, int $length, int $flags, string $address, ?int $port = null): int|false {}
/**
* @return array<string, mixed>|int|false
* @refcount 1
*/
function socket_get_option(Socket $socket, int $level, int $option): array|int|false {}
/** @alias socket_get_option */
/**
* @return array<string, mixed>|int|false
* @alias socket_get_option
*/
function socket_getopt(Socket $socket, int $level, int $option): array|int|false {}
/** @param array|string|int $value */
@ -109,12 +116,20 @@ function socket_recvmsg(Socket $socket, array &$message, int $flags = 0): int|fa
function socket_cmsg_space(int $level, int $type, int $num = 0): ?int {}
/**
* @return array<int, AddressInfo>|false
* @refcount 1
*/
function socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false {}
function socket_addrinfo_connect(AddressInfo $address): Socket|false {}
function socket_addrinfo_bind(AddressInfo $address): Socket|false {}
/**
* @return array<string, int|string|array>
* @refcount 1
*/
function socket_addrinfo_explain(AddressInfo $address): array {}
#ifdef PHP_WIN32

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 7a34d96387ed5cba14a8a661f31b22bd88b2ec67 */
* Stub hash: bc0f8cd2cab1e077231ed74a9be15a88f5a08e4b */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1)

View File

@ -152,12 +152,14 @@ function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string
#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
/** @return array<int, string> */
function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $message, string $additional_data = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, string $key): string {}
/** @return array<int, int|string>|false */
function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ""): array|false {}
function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: ec5e4bdb70ff9416e66b6b8ffd30063a692be910 */
* Stub hash: 83363d4c65a99ae18e8e475524ce7aa20a768556 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO()