summaryrefslogtreecommitdiff
path: root/ext/hash
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2019-11-08 23:29:12 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2019-11-11 14:54:55 +0100
commit27e83d0fb87c04b61441fb77e963dd4e14ad187e (patch)
tree1b35b21c48c54f353e643d29dd2306d8e1ba084a /ext/hash
parent2804ea612779b89d3c62d974eb35783dd31f7dee (diff)
downloadphp-git-27e83d0fb87c04b61441fb77e963dd4e14ad187e.tar.gz
Add union return types for function stubs
Diffstat (limited to 'ext/hash')
-rw-r--r--ext/hash/hash.stub.php25
-rw-r--r--ext/hash/hash_arginfo.h16
2 files changed, 17 insertions, 24 deletions
diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php
index 5f28ad9799..d874a0ab18 100644
--- a/ext/hash/hash.stub.php
+++ b/ext/hash/hash.stub.php
@@ -1,20 +1,15 @@
<?php
-/** @return string|false */
-function hash(string $algo, string $data, bool $raw_output = false) {}
+function hash(string $algo, string $data, bool $raw_output = false): string|false {}
-/** @return string|false */
-function hash_file(string $algo, string $filename, bool $raw_output = false) {}
+function hash_file(string $algo, string $filename, bool $raw_output = false): string|false {}
-/** @return string|false */
-function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false) {}
+function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
-/** @return string|false */
-function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false) {}
+function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
function hash_init(string $algo, int $options = 0, string $key = UNKNOWN): HashContext {}
-/** @return true */
function hash_update(HashContext $context, string $data): bool {}
/** @param resource $handle */
@@ -40,19 +35,15 @@ function hash_equals(string $known_string, string $user_string) : bool {}
function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = '', string $salt = ''): string {}
#ifdef PHP_MHASH_BC
-/** @return int|false */
-function mhash_get_block_size(int $hash) {}
+function mhash_get_block_size(int $hash): int|false {}
-/** @return string|false */
-function mhash_get_hash_name(int $hash) {}
+function mhash_get_hash_name(int $hash): string|false {}
-/** @return string|false */
-function mhash_keygen_s2k(int $hash, string $input_password, string $salt, int $bytes) {}
+function mhash_keygen_s2k(int $hash, string $input_password, string $salt, int $bytes): string|false {}
function mhash_count(): int {}
-/** @return string|false */
-function mhash(int $hash, string $data, string $key = UNKNOWN) {}
+function mhash(int $hash, string $data, string $key = UNKNOWN): string|false {}
#endif
class HashContext {
diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h
index 6ba7a403cb..41d22f4a8e 100644
--- a/ext/hash/hash_arginfo.h
+++ b/ext/hash/hash_arginfo.h
@@ -1,18 +1,18 @@
/* This is a generated file, edit the .stub.php file instead. */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_file, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac, 0, 0, 3)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
@@ -79,17 +79,19 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0)
ZEND_END_ARG_INFO()
#if defined(PHP_MHASH_BC)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash_get_block_size, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_block_size, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
#if defined(PHP_MHASH_BC)
-#define arginfo_mhash_get_hash_name arginfo_mhash_get_block_size
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_hash_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ZEND_END_ARG_INFO()
#endif
#if defined(PHP_MHASH_BC)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash_keygen_s2k, 0, 0, 4)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_keygen_s2k, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, input_password, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
@@ -103,7 +105,7 @@ ZEND_END_ARG_INFO()
#endif
#if defined(PHP_MHASH_BC)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)