Skip to content

Commit

Permalink
Convert resources to objects in ext/ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Mar 14, 2021
1 parent d5a15d2 commit 9c491fd
Show file tree
Hide file tree
Showing 36 changed files with 690 additions and 587 deletions.
664 changes: 393 additions & 271 deletions ext/ldap/ldap.c

Large diffs are not rendered by default.

271 changes: 75 additions & 196 deletions ext/ldap/ldap.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,265 +2,151 @@

/** @generate-class-entries */

/** @strict-properties */
final class LDAP
{
}

/** @strict-properties */
final class LDAPResult
{
}

/** @strict-properties */
final class LDAPResultEntry
{
}

#ifdef HAVE_ORALDAP
/** @return resource|false */
function ldap_connect(?string $uri = null, int $port = 389, string $wallet = UNKNOWN, string $password = UNKNOWN, int $auth_mode = GSLC_SSL_NO_AUTH) {}
function ldap_connect(?string $uri = null, int $port = 389, string $wallet = UNKNOWN, string $password = UNKNOWN, int $auth_mode = GSLC_SSL_NO_AUTH): LDAP|false {}
#else
/** @return resource|false */
function ldap_connect(?string $uri = null, int $port = 389) {}
function ldap_connect(?string $uri = null, int $port = 389): LDAP|false {}
#endif

/** @param resource $ldap */
function ldap_unbind($ldap): bool {}
function ldap_unbind(LDAP $ldap): bool {}

/**
* @param resource $ldap
* @alias ldap_unbind
*/
function ldap_close($ldap): bool {}
/** @alias ldap_unbind */
function ldap_close(LDAP $ldap): bool {}

/** @param resource $ldap */
function ldap_bind($ldap, ?string $dn = null, ?string $password = null): bool {}
function ldap_bind(LDAP $ldap, ?string $dn = null, ?string $password = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_bind_ext($ldap, ?string $dn = null, ?string $password = null, ?array $controls = null) {}
function ldap_bind_ext(LDAP $ldap, ?string $dn = null, ?string $password = null, ?array $controls = null): LDAPResult|false {}

#ifdef HAVE_LDAP_SASL
/** @param resource $ldap */
function ldap_sasl_bind($ldap, ?string $dn = null, ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authc_id = null, ?string $authz_id = null, ?string $props = null): bool {}
function ldap_sasl_bind(LDAP $ldap, ?string $dn = null, ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authc_id = null, ?string $authz_id = null, ?string $props = null): bool {}
#endif

/**
* @param resource|array $ldap
* @return resource|array|false
*/
function ldap_read($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null) {}
/** @param LDAP|array $ldap */
function ldap_read($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null): LDAPResult|array|false {}

/**
* @param resource|array $ldap
* @return resource|array|false
*/
function ldap_list($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null) {}
/** @param LDAP|array $ldap */
function ldap_list($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null): LDAPResult|array|false {}

/**
* @param resource|array $ldap
* @return resource|array|false
*/
function ldap_search($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null) {}

/** @param resource $ldap */
function ldap_free_result($ldap): bool {}
/** @param LDAP|array $ldap */
function ldap_search($ldap, array|string $base, array|string $filter, array $attributes = [], int $attributes_only = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, ?array $controls = null): LDAPResult|array|false {}

function ldap_free_result(LDAPResult $result): bool {}

/**
* @param resource $ldap
* @param resource $result
*/
function ldap_count_entries($ldap, $result): int {}
function ldap_count_entries(LDAP $ldap, LDAPResult $result): int {}

/**
* @param resource $ldap
* @param resource $result
* @return resource|false
*/
function ldap_first_entry($ldap, $result) {}
function ldap_first_entry(LDAP $ldap, LDAPResult $result): LDAPResultEntry|false {}

/**
* @param resource $ldap
* @param resource $result
* @return resource|false
*/
function ldap_next_entry($ldap, $result) {}
function ldap_next_entry(LDAP $ldap, LDAPResultEntry $entry): LDAPResultEntry|false {}

/**
* @param resource $ldap
* @param resource $result
*/
function ldap_get_entries($ldap, $result): array|false {}
function ldap_get_entries(LDAP $ldap, LDAPResult $result): array|false {}

/**
* @param resource $ldap
* @param resource $entry
*/
function ldap_first_attribute($ldap, $entry): string|false {}
function ldap_first_attribute(LDAP $ldap, LDAPResultEntry $entry): string|false {}

/**
* @param resource $ldap
* @param resource $entry
*/
function ldap_next_attribute($ldap, $entry): string|false {}
function ldap_next_attribute(LDAP $ldap, LDAPResultEntry $entry): string|false {}

/**
* @param resource $ldap
* @param resource $entry
*/
function ldap_get_attributes($ldap, $entry): array {}
function ldap_get_attributes(LDAP $ldap, LDAPResultEntry $entry): array {}

/**
* @param resource $ldap
* @param resource $entry
*/
function ldap_get_values_len($ldap, $entry, string $attribute): array|false {}
function ldap_get_values_len(LDAP $ldap, LDAPResultEntry $entry, string $attribute): array|false {}

/**
* @param resource $ldap
* @param resource $entry
* @alias ldap_get_values_len
*/
function ldap_get_values($ldap, $entry, string $attribute): array|false {}
/** @alias ldap_get_values_len */
function ldap_get_values(LDAP $ldap, LDAPResultEntry $entry, string $attribute): array|false {}

/**
* @param resource $ldap
* @param resource $entry
*/
function ldap_get_dn($ldap, $entry): string|false {}
function ldap_get_dn(LDAP $ldap, LDAPResultEntry $entry): string|false {}

function ldap_explode_dn(string $dn, int $with_attrib): array|false {}

function ldap_dn2ufn(string $dn): string|false {}

/** @param resource $ldap */
function ldap_add($ldap, string $dn, array $entry, ?array $controls = null): bool {}
function ldap_add(LDAP $ldap, string $dn, array $entry, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_add_ext($ldap, string $dn, array $entry, ?array $controls = null) {}
function ldap_add_ext(LDAP $ldap, string $dn, array $entry, ?array $controls = null): LDAPResult|false {}

/** @param resource $ldap */
function ldap_delete($ldap, string $dn, ?array $controls = null): bool {}
function ldap_delete(LDAP $ldap, string $dn, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_delete_ext($ldap, string $dn, ?array $controls = null) {}
function ldap_delete_ext(LDAP $ldap, string $dn, ?array $controls = null): LDAPResult|false {}

/** @param resource $ldap */
function ldap_modify_batch($ldap, string $dn, array $modifications_info, ?array $controls = null): bool {}
function ldap_modify_batch(LDAP $ldap, string $dn, array $modifications_info, ?array $controls = null): bool {}

/** @param resource $ldap */
function ldap_mod_add($ldap, string $dn, array $entry, ?array $controls = null): bool {}
function ldap_mod_add(LDAP $ldap, string $dn, array $entry, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_mod_add_ext($ldap, string $dn, array $entry, ?array $controls = null) {}
function ldap_mod_add_ext(LDAP $ldap, string $dn, array $entry, ?array $controls = null): LDAPResult|false {}

/** @param resource $ldap */
function ldap_mod_replace($ldap, string $dn, array $entry, ?array $controls = null): bool {}
function ldap_mod_replace(LDAP $ldap, string $dn, array $entry, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @alias ldap_mod_replace
*/
function ldap_modify($ldap, string $dn, array $entry, ?array $controls = null): bool {}
/** @alias ldap_mod_replace */
function ldap_modify(LDAP $ldap, string $dn, array $entry, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_mod_replace_ext($ldap, string $dn, array $entry, ?array $controls = null) {}
function ldap_mod_replace_ext(LDAP $ldap, string $dn, array $entry, ?array $controls = null): LDAPResult|false {}

/** @param resource $ldap */
function ldap_mod_del($ldap, string $dn, array $entry, ?array $controls = null): bool {}
function ldap_mod_del(LDAP $ldap, string $dn, array $entry, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_mod_del_ext($ldap, string $dn, array $entry, ?array $controls = null) {}
function ldap_mod_del_ext(LDAP $ldap, string $dn, array $entry, ?array $controls = null): LDAPResult|false {}

/** @param resource $ldap */
function ldap_errno($ldap): int {}
function ldap_errno(LDAP $ldap): int {}

/** @param resource $ldap */
function ldap_error($ldap): string {}
function ldap_error(LDAP $ldap): string {}

function ldap_err2str(int $errno): string {}

/** @param resource $ldap */
function ldap_compare($ldap, string $dn, string $attribute, string $value, ?array $controls = null): bool|int {}
function ldap_compare(LDAP $ldap, string $dn, string $attribute, string $value, ?array $controls = null): bool|int {}

#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP)
/** @param resource $ldap */
function ldap_rename($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, ?array $controls = null): bool {}

/**
* @param resource $ldap
* @return resource|false
*/
function ldap_rename_ext($ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, ?array $controls = null) {}
function ldap_rename(LDAP $ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, ?array $controls = null): bool {}

function ldap_rename_ext(LDAP $ldap, string $dn, string $new_rdn, string $new_parent, bool $delete_old_rdn, ?array $controls = null): LDAPResult|false {}

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

/**
* @param resource|null $ldap
* @param array|string|int|bool $value
*/
function ldap_set_option($ldap, int $option, $value): bool {}
/** @param array|string|int|bool $value */
function ldap_set_option(?LDAP $ldap, int $option, $value): bool {}

/**
* @param resource $ldap
* @param resource $result
*/
function ldap_count_references($ldap, $result): int {}
function ldap_count_references(LDAP $ldap, LDAPResult $result): int {}

/**
* @param resource $ldap
* @param resource $result
* @return resource|false
*/
function ldap_first_reference($ldap, $result) {}
function ldap_first_reference(LDAP $ldap, LDAPResult $result): LDAPResultEntry|false {}

/**
* @param resource $ldap
* @param resource $entry
* @return resource|false
*/
function ldap_next_reference($ldap, $entry) {}
function ldap_next_reference(LDAP $ldap, LDAPResultEntry $entry): LDAPResultEntry|false {}

#ifdef HAVE_LDAP_PARSE_REFERENCE
/**
* @param resource $ldap
* @param resource $entry
* @param array $referrals
*/
function ldap_parse_reference($ldap, $entry, &$referrals): bool {}
/** @param array $referrals */
function ldap_parse_reference(LDAP $ldap, LDAPResultEntry $entry, &$referrals): bool {}
#endif

#ifdef HAVE_LDAP_PARSE_RESULT
/**
* @param resource $ldap
* @param resource $result
* @param int $error_code
* @param string $matched_dn
* @param string $error_message
* @param array $referrals
* @param array $controls
*/
function ldap_parse_result($ldap, $result, &$error_code, &$matched_dn = null, &$error_message = null, &$referrals = null, &$controls = null): bool {}
function ldap_parse_result(LDAP $ldap, LDAPResult $result, &$error_code, &$matched_dn = null, &$error_message = null, &$referrals = null, &$controls = null): bool {}
#endif
#endif

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

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

function ldap_escape(string $value, string $ignore = "", int $flags = 0): string {}
Expand All @@ -274,39 +160,32 @@ function ldap_8859_to_t61(string $value): string|false {}

#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
/**
* @param resource $ldap
* @param string $response_data
* @param string $response_oid
* @return resource|bool
*/
function ldap_exop($ldap, string $request_oid, ?string $request_data = null, ?array $controls = NULL, &$response_data = UNKNOWN, &$response_oid = null) {}
function ldap_exop(LDAP $ldap, string $request_oid, ?string $request_data = null, ?array $controls = NULL, &$response_data = UNKNOWN, &$response_oid = null): LDAPResult|bool {}
#endif

#ifdef HAVE_LDAP_PASSWD
/**
* @param resource $ldap
* @param array $controls
*/
function ldap_exop_passwd($ldap, string $user = "", string $old_password = "", string $new_password = "", &$controls = null): string|bool {}
function ldap_exop_passwd(LDAP $ldap, string $user = "", string $old_password = "", string $new_password = "", &$controls = null): string|bool {}
#endif


#ifdef HAVE_LDAP_WHOAMI_S
/** @param resource $ldap */
function ldap_exop_whoami($ldap): string|false {}
function ldap_exop_whoami(LDAP $ldap): string|false {}
#endif

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

#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
/**
* @param resource $ldap
* @param resource $result
* @param string $response_data
* @param string $response_oid
*/
function ldap_parse_exop($ldap, $result, &$response_data = null, &$response_oid = null): bool {}
function ldap_parse_exop(LDAP $ldap, LDAPResult $result, &$response_data = null, &$response_oid = null): bool {}
#endif
Loading

0 comments on commit 9c491fd

Please sign in to comment.