Skip to content

Fix the return types in ext/snmp #7068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions ext/snmp/snmp.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

/** @generate-function-entries */

function snmpget(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
function snmpget(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmpgetnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
function snmpgetnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmpwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
function snmpwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmprealwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
function snmprealwalk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

/** @alias snmprealwalk */
function snmpwalkoid(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
function snmpwalkoid(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmpset(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): array|bool {}
function snmpset(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}

function snmp_get_quick_print(): bool {}

Expand All @@ -26,46 +26,46 @@ function snmp_set_oid_output_format(int $format): bool {}
/** @alias snmp_set_oid_output_format */
function snmp_set_oid_numeric_print(int $format): bool {}

function snmp2_get(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
function snmp2_get(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmp2_getnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
function snmp2_getnext(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmp2_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
function snmp2_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmp2_real_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
function snmp2_real_walk(string $hostname, string $community, array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmp2_set(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): array|bool {}
function snmp2_set(string $hostname, string $community, array|string $object_id, array|string $type, array|string $value, int $timeout = -1, int $retries = -1): bool {}

function snmp3_get(
string $hostname, string $security_name, string $security_level,
string $auth_protocol, string $auth_passphrase,
string $privacy_protocol, string $privacy_passphrase,
array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmp3_getnext(
string $hostname, string $security_name, string $security_level,
string $auth_protocol, string $auth_passphrase,
string $privacy_protocol, string $privacy_passphrase,
array|string $object_id, int $timeout = -1, int $retries = -1): stdClass|array|string|bool {}
array|string $object_id, int $timeout = -1, int $retries = -1): mixed {}

function snmp3_walk(
string $hostname, string $security_name, string $security_level,
string $auth_protocol, string $auth_passphrase,
string $privacy_protocol, string $privacy_passphrase,
array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmp3_real_walk(
string $hostname, string $security_name, string $security_level,
string $auth_protocol, string $auth_passphrase,
string $privacy_protocol, string $privacy_passphrase,
array|string $object_id, int $timeout = -1, int $retries = -1): array|bool {}
array|string $object_id, int $timeout = -1, int $retries = -1): array|false {}

function snmp3_set(
string $hostname, string $security_name, string $security_level,
string $auth_protocol, string $auth_passphrase,
string $privacy_protocol, string $privacy_passphrase,
array|string $object_id, array|string $type, array|string $value,
int $timeout = -1, int $retries = -1): array|bool {}
int $timeout = -1, int $retries = -1): bool {}

function snmp_set_valueretrieval(int $method): bool {}

Expand All @@ -86,16 +86,16 @@ public function setSecurity(
string $privacyProtocol = "", string $privacyPassphrase = "",
string $contextName = "", string $contextEngineId = "") {}

/** @return array|bool */
/** @return mixed */
public function get(array|string $objectId, bool $preserveKeys = false) {}

/** @return array|bool */
/** @return mixed */
public function getnext(array|string $objectId) {}

/** @return array|bool */
/** @return array|false */
public function walk(array|string $objectId, bool $suffixAsKey = false, int $maxRepetitions = -1, int $nonRepeaters = -1) {}

/** @return array|bool */
/** @return bool */
public function set(array|string $objectId, array|string $type, array|string $value) {}

/** @return int */
Expand Down
14 changes: 7 additions & 7 deletions ext/snmp/snmp_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 32433e63feea7cc46737000498e248da713ab5a3 */
* Stub hash: dc3f1b78feb7b9c87f6c16aab78a1555e4bcf010 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_snmpget, 0, 3, stdClass, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmpget, 0, 3, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
Expand All @@ -11,7 +11,7 @@ ZEND_END_ARG_INFO()

#define arginfo_snmpgetnext arginfo_snmpget

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpwalk, 0, 3, MAY_BE_ARRAY|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpwalk, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
Expand All @@ -23,7 +23,7 @@ ZEND_END_ARG_INFO()

#define arginfo_snmpwalkoid arginfo_snmpwalk

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpset, 0, 5, MAY_BE_ARRAY|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmpset, 0, 5, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
ZEND_ARG_TYPE_MASK(0, object_id, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
Expand Down Expand Up @@ -58,7 +58,7 @@ ZEND_END_ARG_INFO()

#define arginfo_snmp2_set arginfo_snmpset

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_snmp3_get, 0, 8, stdClass, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp3_get, 0, 8, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_level, IS_STRING, 0)
Expand All @@ -73,7 +73,7 @@ ZEND_END_ARG_INFO()

#define arginfo_snmp3_getnext arginfo_snmp3_get

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_walk, 0, 8, MAY_BE_ARRAY|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_walk, 0, 8, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_level, IS_STRING, 0)
Expand All @@ -88,7 +88,7 @@ ZEND_END_ARG_INFO()

#define arginfo_snmp3_real_walk arginfo_snmp3_walk

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_set, 0, 10, MAY_BE_ARRAY|MAY_BE_BOOL)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp3_set, 0, 10, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, security_level, IS_STRING, 0)
Expand Down