Skip to content

Commit

Permalink
Add a bunch of missing argument types to stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Aug 2, 2020
1 parent 6ba24e9 commit 79981a3
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 34 deletions.
16 changes: 14 additions & 2 deletions ext/dba/dba.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

/** @generate-function-entries */

/** @return resource|false */
/**
* @param string $path
* @param string $mode
* @param string $handlername
* @param string $handler_parameters
* @return resource|false
*/
function dba_popen($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}

/** @return resource|false */
/**
* @param string $path
* @param string $mode
* @param string $handlername
* @param string $handler_parameters
* @return resource|false
*/
function dba_open($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}

/** @param resource $handle */
Expand Down
2 changes: 1 addition & 1 deletion ext/dba/dba_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3f28cb0c990d15e6d2f34c40c2f0219b11d2d5e4 */
* Stub hash: 5b43c7cfcb48f3081d5585192eaaa5185df036f8 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
ZEND_ARG_INFO(0, path)
Expand Down
12 changes: 9 additions & 3 deletions ext/ftp/ftp.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ function ftp_rmdir($ftp, string $directory): bool {}
/** @param resource $ftp */
function ftp_chmod($ftp, int $mode, string $filename): int|false {}

/** @param resource $ftp */
/**
* @param resource $ftp
* @param string $response
*/
function ftp_alloc($ftp, int $size, &$response = null): bool {}

/** @param resource $ftp */
Expand Down Expand Up @@ -86,7 +89,7 @@ function ftp_fput($ftp, string $remote_file, $fp, int $mode = FTP_BINARY, int $s
* @param resource $ftp
* @param resource $fp
*/
function ftp_nb_fput($ftp, string $remote_file, $fp, $mode = FTP_BINARY, $startpos = 0): int|false {}
function ftp_nb_fput($ftp, string $remote_file, $fp, int $mode = FTP_BINARY, int $startpos = 0): int|false {}

/** @param resource $ftp */
function ftp_put($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): bool {}
Expand Down Expand Up @@ -121,7 +124,10 @@ function ftp_close($ftp): bool {}
*/
function ftp_quit($ftp): bool {}

/** @param resource $ftp */
/**
* @param resource $ftp
* @param int|bool $value
*/
function ftp_set_option($ftp, int $option, $value): bool {}

/** @param resource $ftp */
Expand Down
6 changes: 3 additions & 3 deletions ext/ftp/ftp_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 0bbaf1b0aed026d0ed32274bc1084b363528bb61 */
* Stub hash: 830fdf6caf2804d49739fc5112c7091c0f6eb4d4 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_connect, 0, 0, 1)
ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
Expand Down Expand Up @@ -131,8 +131,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_fput, 0, 3, MAY_BE_LONG|M
ZEND_ARG_INFO(0, ftp)
ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
ZEND_ARG_INFO(0, fp)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, mode, "FTP_BINARY")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, startpos, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, startpos, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_put, 0, 3, _IS_BOOL, 0)
Expand Down
7 changes: 5 additions & 2 deletions ext/imap/php_imap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function imap_headers($stream_id): array|false {}
/** @param resource $stream_id */
function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {}

/** @alias imap_headerinfo */
/**
* @param resource $stream_id
* @alias imap_headerinfo
*/
function imap_header($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {}

function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): \stdClass {}
Expand Down Expand Up @@ -61,7 +64,7 @@ function imap_fetchmime($stream_id, int $msg_no, string $section, int $options =

/**
* @param resource $stream_id
* @todo: should $file be `resource|string`? it looks like it tries to accept anything?
* @param resource|string|int $file
*/
function imap_savebody($stream_id, $file, int $msg_no, string $section = '', int $options = 0): bool {}

Expand Down
2 changes: 1 addition & 1 deletion ext/imap/php_imap_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 1105c40befb73bbc51cc9438d53404801338a15c */
* Stub hash: 449bab2357a8a83cbe4f630a87776ebb5e0d65f6 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
Expand Down
12 changes: 11 additions & 1 deletion ext/intl/php_intl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function intlcal_after(IntlCalendar $calendarObject, IntlCalendar $calendar): bo

function intlcal_before(IntlCalendar $calendarObject, IntlCalendar $calendar): bool {}

function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): bool {}
function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): bool {}

/** @param int|bool $amountOrUpOrDown */
function intlcal_roll(IntlCalendar $calendar, int $field, $amountOrUpOrDown): bool {}
Expand Down Expand Up @@ -190,8 +190,10 @@ function datefmt_format(IntlDateFormatter $df, $value): string|false {}
*/
function datefmt_format_object($object, $format = null, ?string $locale = null): string|false {}

/** @param int $position */
function datefmt_parse(IntlDateFormatter $df, string $value, &$position = null): int|float|false {}

/** @param int $position */
function datefmt_localtime(IntlDateFormatter $df, string $value, &$position = null): array|false {}

function datefmt_get_error_code(IntlDateFormatter $df): int {}
Expand All @@ -204,10 +206,15 @@ function numfmt_create(string $locale, int $style, string $pattern = ""): ?Numbe

function numfmt_format(NumberFormatter $fmt, int|float $value, int $type = NumberFormatter::TYPE_DEFAULT): string|false {}

/** @param int $position */
function numfmt_parse(NumberFormatter $fmt, string $value, int $type = NumberFormatter::TYPE_DOUBLE, &$position = null): int|float|false {}

function numfmt_format_currency(NumberFormatter $fmt, float $value, string $currency): string|false {}

/**
* @param string $currency
* @param int $position
*/
function numfmt_parse_currency(NumberFormatter $fmt, string $value, &$currency, &$position = null): float|false {}

/** @param int|float $value */
Expand Down Expand Up @@ -251,12 +258,15 @@ function grapheme_strstr(string $haystack, string $needle, bool $before_needle =

function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}

/** @param int $next */
function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null): string|false {}

/* idn */

/** @param array $idna_info */
function idn_to_ascii(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}

/** @param array $idna_info */
function idn_to_utf8(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}

/* locale */
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/php_intl_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: a41f168369315619a8cf4bd3ed341b90b455ea1d */
* Stub hash: ef46b927a82d0bdecea9438ff6ba0000b73b3b56 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timeZone, "null")
Expand Down Expand Up @@ -55,7 +55,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, dayOfMonth, IS_LONG, 0)
ZEND_ARG_INFO(0, hour)
ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
ZEND_END_ARG_INFO()
Expand Down
29 changes: 21 additions & 8 deletions ext/ldap/ldap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ function ldap_control_paged_result($link, int $pagesize, bool $iscritical = fals
/**
* @param resource $link
* @param resource $result
* @param string $cookie
* @param int $estimated
* @deprecated since 7.4
*/
function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
Expand All @@ -220,10 +222,16 @@ function ldap_rename($link_identifier, string $dn, string $newrdn, string $newpa
function ldap_rename_ext($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []) {}


/** @param resource $link_identifier */
/**
* @param resource $link_identifier
* @param array|string|int $retval
*/
function ldap_get_option($link_identifier, int $option, &$retval = null): bool {}

/** @param resource|null $link_identifier */
/**
* @param resource|null $link_identifier
* @param array|string|int|bool $newval
*/
function ldap_set_option($link_identifier, int $option, $newval): bool {}

/**
Expand All @@ -250,6 +258,7 @@ function ldap_next_reference($link, $entry) {}
/**
* @param resource $link
* @param resource $entry
* @param array $referrals
*/
function ldap_parse_reference($link, $entry, &$referrals): bool {}
#endif
Expand All @@ -264,13 +273,12 @@ function ldap_parse_result($link, $result, &$errcode, &$matcheddn = null, &$errm
#endif

#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
/**
* @param resource $link
*/
/** @param resource $link */
function ldap_set_rebind_proc($link, ?callable $callback): bool {}
#endif

#ifdef HAVE_LDAP_START_TLS_S
/** @param resource $link_identifier */
function ldap_start_tls($link_identifier): bool {}
#endif

Expand All @@ -286,13 +294,18 @@ function ldap_8859_to_t61(string $value): string|false {}
#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
/**
* @param resource $link
* @param string $retdata
* @param string $retoid
* @return resource|bool
*/
function ldap_exop($link, string $reqoid, ?string $reqdata = null, ?array $servercontrols = [], &$retdata = null, &$retoid = null) {}
#endif

#ifdef HAVE_LDAP_PASSWD
/** @param resource $link */
/**
* @param resource $link
* @param array $serverctrls
*/
function ldap_exop_passwd($link, string $user = '', string $oldpw = '', string $newpw = '', &$serverctrls = null): string|bool {}
#endif

Expand All @@ -302,17 +315,17 @@ function ldap_exop_passwd($link, string $user = '', string $oldpw = '', string $
function ldap_exop_whoami($link): string|bool {}
#endif


#ifdef HAVE_LDAP_REFRESH_S
/** @param resource $link */
function ldap_exop_refresh($link, string $dn, int $ttl): int|false {}
#endif


#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
/**
* @param resource $link
* @param resource $result
* @param string $retdata
* @param string $retoid
*/
function ldap_parse_exop($link, $result, &$retdata = null, &$retoid = null): bool {}
#endif
4 changes: 2 additions & 2 deletions ext/ldap/ldap_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 63d7fc9e11bd2821a77f6ee709ceaf1fdcbf190e */
* Stub hash: 9ecb7515850d95a20199b3c52aaccb8b2b04e0cd */

#if defined(HAVE_ORALDAP)
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
Expand Down Expand Up @@ -344,7 +344,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_refresh, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, link)
ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
ZEND_ARG_INFO(0, ttl)
ZEND_ARG_TYPE_INFO(0, ttl, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif

Expand Down
2 changes: 2 additions & 0 deletions ext/posix/posix.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ function posix_times(): array|false {}
function posix_ctermid(): string|false {}
#endif

/** @param resource|int $fd */
function posix_ttyname($fd): string|false {}

/** @param resource|int $fd */
function posix_isatty($fd): bool {}

function posix_getcwd(): string|false {}
Expand Down
2 changes: 1 addition & 1 deletion ext/posix/posix_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8b74b3201e5a89a25d69753f3078e72ec0395500 */
* Stub hash: c97ecb9b83ed873ca1ee2046ade191eef5bff25b */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
Expand Down
2 changes: 1 addition & 1 deletion ext/pspell/pspell.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

function pspell_new(string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, int $mode = 0): int|false {}

function pspell_new_personal(string $personal, string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, $mode = 0): int|false {}
function pspell_new_personal(string $personal, string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, int $mode = 0): int|false {}

function pspell_new_config(int $config): int|false {}

Expand Down
4 changes: 2 additions & 2 deletions ext/pspell/pspell_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 83cadd382dfcccf598b743dfdccad09eb39e30c2 */
* Stub hash: 9103420bb4162cad03e7ee06efa0d1c16820a099 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
Expand All @@ -15,7 +15,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_personal, 0, 2, MAY_B
ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, mode, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_config, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/soap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

function use_soap_error_handler(bool $handler = true): bool {}

function is_soap_fault($object): bool {}
function is_soap_fault(mixed $object): bool {}

class SoapParam
{
Expand Down
4 changes: 2 additions & 2 deletions ext/soap/soap_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 82152767dbeda492da7dff97324d7277d3f0213b */
* Stub hash: 14076c21ac68b4d1e88c1067e7d1f87373f1669e */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, handler, _IS_BOOL, 0, "true")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_soap_fault, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, object)
ZEND_ARG_TYPE_INFO(0, object, IS_MIXED, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapParam___construct, 0, 0, 2)
Expand Down
8 changes: 8 additions & 0 deletions ext/sysvmsg/sysvmsg.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ final class SysvMessageQueue

function msg_get_queue(int $key, int $perms = 0666): SysvMessageQueue|false {}

/**
* @param string|int|float|bool $message
* @param int $errorcode
*/
function msg_send(SysvMessageQueue $queue, int $msgtype, $message, bool $serialize = true, bool $blocking = true, &$errorcode = null): bool {}

/**
* @param int $msgtype
* @param int $errorcode
*/
function msg_receive(SysvMessageQueue $queue, int $desiredmsgtype, &$msgtype, int $maxsize, &$message, bool $unserialize = true, int $flags = 0, &$errorcode = null): bool {}

function msg_remove_queue(SysvMessageQueue $queue): bool {}
Expand Down
2 changes: 1 addition & 1 deletion ext/sysvmsg/sysvmsg_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: a4e2f362d86b38827fbbea640e6b8db215c2e4aa */
* Stub hash: 4954f0d4dd0515dea5e4305b9db9d3344bdf40a4 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_msg_get_queue, 0, 1, SysvMessageQueue, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
Expand Down
5 changes: 5 additions & 0 deletions ext/xml/xml.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function xml_set_end_namespace_decl_handler(XmlParser $parser, $hdl): bool {}

function xml_parse(XmlParser $parser, string $data, bool $isfinal = false): int {}

/**
* @param array $values
* @param array $index
*/
function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = null): int {}

function xml_get_error_code(XmlParser $parser): int {}
Expand All @@ -54,6 +58,7 @@ function xml_get_current_byte_index(XmlParser $parser): int {}

function xml_parser_free(XmlParser $parser): bool {}

/** @param string|int $value */
function xml_parser_set_option(XmlParser $parser, int $option, $value): bool {}

function xml_parser_get_option(XmlParser $parser, int $option): string|int|false {}
Expand Down

0 comments on commit 79981a3

Please sign in to comment.