update phpstan to 1.8.2

This commit is contained in:
Andrew Dolgov
2022-07-31 13:55:09 +03:00
parent d5c043e846
commit 26c67dba77
34 changed files with 1442 additions and 859 deletions

View File

@@ -4,81 +4,6 @@ namespace Safe;
use Safe\Exceptions\ArrayException;
/**
* array_replace_recursive replaces the values of
* array with the same values from all the following
* arrays. If a key from the first array exists in the second array, its value
* will be replaced by the value from the second array. If the key exists in the
* second array, and not the first, it will be created in the first array.
* If a key only exists in the first array, it will be left as is.
* If several arrays are passed for replacement, they will be processed
* in order, the later array overwriting the previous values.
*
* array_replace_recursive is recursive : it will recurse into
* arrays and apply the same process to the inner value.
*
* When the value in the first array is scalar, it will be replaced
* by the value in the second array, may it be scalar or array.
* When the value in the first array and the second array
* are both arrays, array_replace_recursive will replace
* their respective value recursively.
*
* @param array $array The array in which elements are replaced.
* @param array $replacements Arrays from which elements will be extracted.
* @return array Returns an array.
* @throws ArrayException
*
*/
function array_replace_recursive(array $array, array ...$replacements): array
{
error_clear_last();
if ($replacements !== []) {
$result = \array_replace_recursive($array, ...$replacements);
} else {
$result = \array_replace_recursive($array);
}
if ($result === null) {
throw ArrayException::createFromPhpError();
}
return $result;
}
/**
* array_replace replaces the values of
* array with values having the same keys in each of the following
* arrays. If a key from the first array exists in the second array, its value
* will be replaced by the value from the second array. If the key exists in the
* second array, and not the first, it will be created in the first array.
* If a key only exists in the first array, it will be left as is.
* If several arrays are passed for replacement, they will be processed
* in order, the later arrays overwriting the previous values.
*
* array_replace is not recursive : it will replace
* values in the first array by whatever type is in the second array.
*
* @param array $array The array in which elements are replaced.
* @param array $replacements Arrays from which elements will be extracted.
* Values from later arrays overwrite the previous values.
* @return array Returns an array.
* @throws ArrayException
*
*/
function array_replace(array $array, array ...$replacements): array
{
error_clear_last();
if ($replacements !== []) {
$result = \array_replace($array, ...$replacements);
} else {
$result = \array_replace($array);
}
if ($result === null) {
throw ArrayException::createFromPhpError();
}
return $result;
}
/**
* Applies the user-defined callback function to each
* element of the array. This function will recurse

View File

@@ -18,7 +18,7 @@ function curl_copy_handle(\CurlHandle $handle): \CurlHandle
error_clear_last();
$result = \curl_copy_handle($handle);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
return $result;
}
@@ -39,7 +39,7 @@ function curl_escape(\CurlHandle $handle, string $string): string
error_clear_last();
$result = \curl_escape($handle, $string);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
return $result;
}
@@ -64,7 +64,7 @@ function curl_exec(\CurlHandle $handle)
error_clear_last();
$result = \curl_exec($handle);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
return $result;
}
@@ -541,7 +541,7 @@ function curl_getinfo(\CurlHandle $handle, int $option = null)
$result = \curl_getinfo($handle);
}
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
return $result;
}
@@ -627,7 +627,7 @@ function curl_multi_info_read(\CurlMultiHandle $multi_handle, ?int &$queued_mess
error_clear_last();
$result = \curl_multi_info_read($multi_handle, $queued_messages);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($multi_handle);
}
return $result;
}
@@ -791,7 +791,7 @@ function curl_multi_setopt(\CurlMultiHandle $multi_handle, int $option, $value):
error_clear_last();
$result = \curl_multi_setopt($multi_handle, $option, $value);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($multi_handle);
}
}
@@ -1284,6 +1284,18 @@ function curl_multi_setopt(\CurlMultiHandle $multi_handle, int $option, $value):
*
*
*
* CURLOPT_SAFE_UPLOAD
*
* Always TRUE, what disables support for the @ prefix for
* uploading files in CURLOPT_POSTFIELDS, which
* means that values starting with @ can be safely
* passed as fields. CURLFile may be used for
* uploads instead.
*
*
*
*
*
* CURLOPT_SUPPRESS_CONNECT_HEADERS
*
* TRUE to suppress proxy CONNECT response headers from the user callback functions
@@ -2576,7 +2588,7 @@ function curl_multi_setopt(\CurlMultiHandle $multi_handle, int $option, $value):
*
* CURLOPT_PROXY_TLSAUTH_USERNAME
*
* Tusername to use for the HTTPS proxy TLS authentication method specified with the
* The username to use for the HTTPS proxy TLS authentication method specified with the
* CURLOPT_PROXY_TLSAUTH_TYPE option. Requires that the
* CURLOPT_PROXY_TLSAUTH_PASSWORD option to also be set.
*
@@ -3142,7 +3154,7 @@ function curl_setopt(\CurlHandle $handle, int $option, $value): void
error_clear_last();
$result = \curl_setopt($handle, $option, $value);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
}
@@ -3161,7 +3173,7 @@ function curl_share_errno(\CurlShareHandle $share_handle): int
error_clear_last();
$result = \curl_share_errno($share_handle);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($share_handle);
}
return $result;
}
@@ -3238,7 +3250,7 @@ function curl_share_setopt(\CurlShareHandle $share_handle, int $option, $value):
error_clear_last();
$result = \curl_share_setopt($share_handle, $option, $value);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($share_handle);
}
}
@@ -3258,7 +3270,7 @@ function curl_unescape(\CurlHandle $handle, string $string): string
error_clear_last();
$result = \curl_unescape($handle, $string);
if ($result === false) {
throw CurlException::createFromPhpError();
throw CurlException::createFromPhpError($handle);
}
return $result;
}

View File

@@ -85,10 +85,10 @@ function passthru(string $command, ?int &$result_code = null): void
* @param int $priority The new priority value, the value of this may differ on platforms.
*
* On Unix, a low value, such as -20 means high priority
* wheras a positive value have a lower priority.
* whereas positive values have a lower priority.
*
* For Windows the priority parameter have the
* following meanings:
* For Windows the priority parameter has the
* following meaning:
* @throws ExecException
*
*/

View File

@@ -1240,6 +1240,13 @@ function lstat(string $filename): array
* Attempts to create the directory specified by directory.
*
* @param string $directory The directory path.
* A URL can be used as a
* filename with this function if the fopen wrappers have been enabled.
* See fopen for more details on how to specify the
* filename. See the for links to information
* about what abilities the various wrappers have, notes on their usage,
* and information on any predefined variables they may
* provide.
* @param int $permissions The permissions are 0777 by default, which means the widest possible
* access. For more information on permissions, read the details
* on the chmod page.
@@ -1250,8 +1257,8 @@ function lstat(string $filename): array
* which means it should have a leading zero. The permissions is also modified
* by the current umask, which you can change using
* umask.
* @param bool $recursive Allows the creation of nested directories specified in the
* directory.
* @param bool $recursive If TRUE, then any parent directories to the directory specified will
* also be created, with the same permissions.
* @param resource $context A context stream
* resource.
* @throws FilesystemException

View File

@@ -14,8 +14,6 @@ return [
'apcu_inc',
'apcu_sma_info',
'apc_fetch',
'array_replace',
'array_replace_recursive',
'array_walk_recursive',
'assert_options',
'base64_decode',

View File

@@ -6,7 +6,12 @@ use Safe\Exceptions\JsonException;
/**
* Returns a string containing the JSON representation of the supplied
* value.
* value. If the parameter is an array or object,
* it will be serialized recursively.
*
* If a value to be serialized is an object, then by default only publicly visible
* properties will be included. Alternatively, a class may implement JsonSerializable
* to control how its values are serialized to JSON.
*
* The encoding is affected by the supplied flags
* and additionally the encoding of float values depends on the value of

View File

@@ -239,36 +239,36 @@ function ldap_exop_whoami($ldap)
/**
* Performs an extended operation on the specified link with
* reqoid the OID of the operation and
* reqdata the data.
* Performs an extended operation on the specified ldap with
* request_oid the OID of the operation and
* request_data the data.
*
* @param resource $ldap An LDAP\Connection instance, returned by ldap_connect.
* @param string $reqoid The extended operation request OID. You may use one of LDAP_EXOP_START_TLS, LDAP_EXOP_MODIFY_PASSWD, LDAP_EXOP_REFRESH, LDAP_EXOP_WHO_AM_I, LDAP_EXOP_TURN, or a string with the OID of the operation you want to send.
* @param string $reqdata The extended operation request data. May be NULL for some operations like LDAP_EXOP_WHO_AM_I, may also need to be BER encoded.
* @param array|null $serverctrls Array of LDAP Controls to send with the request.
* @param string|null $retdata Will be filled with the extended operation response data if provided.
* @param string $request_oid The extended operation request OID. You may use one of LDAP_EXOP_START_TLS, LDAP_EXOP_MODIFY_PASSWD, LDAP_EXOP_REFRESH, LDAP_EXOP_WHO_AM_I, LDAP_EXOP_TURN, or a string with the OID of the operation you want to send.
* @param string $request_data The extended operation request data. May be NULL for some operations like LDAP_EXOP_WHO_AM_I, may also need to be BER encoded.
* @param array|null $controls Array of LDAP Controls to send with the request.
* @param string|null $response_data Will be filled with the extended operation response data if provided.
* If not provided you may use ldap_parse_exop on the result object
* later to get this data.
* @param string|null $retoid Will be filled with the response OID if provided, usually equal to the request OID.
* @return resource|bool When used with retdata, returns TRUE on success.
* When used without retdata, returns a result identifier.
* @param string|null $response_oid Will be filled with the response OID if provided, usually equal to the request OID.
* @return resource|bool When used with response_data, returns TRUE on success.
* When used without response_data, returns a result identifier.
* @throws LdapException
*
*/
function ldap_exop($ldap, string $reqoid, string $reqdata = null, ?array $serverctrls = null, ?string &$retdata = null, ?string &$retoid = null)
function ldap_exop($ldap, string $request_oid, string $request_data = null, ?array $controls = null, ?string &$response_data = null, ?string &$response_oid = null)
{
error_clear_last();
if ($retoid !== null) {
$result = \ldap_exop($ldap, $reqoid, $reqdata, $serverctrls, $retdata, $retoid);
} elseif ($retdata !== null) {
$result = \ldap_exop($ldap, $reqoid, $reqdata, $serverctrls, $retdata);
} elseif ($serverctrls !== null) {
$result = \ldap_exop($ldap, $reqoid, $reqdata, $serverctrls);
} elseif ($reqdata !== null) {
$result = \ldap_exop($ldap, $reqoid, $reqdata);
if ($response_oid !== null) {
$result = \ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data, $response_oid);
} elseif ($response_data !== null) {
$result = \ldap_exop($ldap, $request_oid, $request_data, $controls, $response_data);
} elseif ($controls !== null) {
$result = \ldap_exop($ldap, $request_oid, $request_data, $controls);
} elseif ($request_data !== null) {
$result = \ldap_exop($ldap, $request_oid, $request_data);
} else {
$result = \ldap_exop($ldap, $reqoid);
$result = \ldap_exop($ldap, $request_oid);
}
if ($result === false) {
throw LdapException::createFromPhpError();

View File

@@ -11,8 +11,9 @@ use Safe\Exceptions\PcntlException;
* man page for specific details.
*
* @param int $process_id If NULL, the process id of the current process is used.
* @param int $mode One of PRIO_PGRP, PRIO_USER
* or PRIO_PROCESS.
* @param int $mode One of PRIO_PGRP, PRIO_USER,
* PRIO_PROCESS,
* PRIO_DARWIN_BG or PRIO_DARWIN_THREAD.
* @return int pcntl_getpriority returns the priority of the process. A lower numerical value causes more favorable
* scheduling.
* @throws PcntlException
@@ -46,8 +47,9 @@ function pcntl_getpriority(int $process_id = null, int $mode = PRIO_PROCESS): in
* system types and kernel versions, please see your system's setpriority(2)
* man page for specific details.
* @param int $process_id If NULL, the process id of the current process is used.
* @param int $mode One of PRIO_PGRP, PRIO_USER
* or PRIO_PROCESS.
* @param int $mode One of PRIO_PGRP, PRIO_USER,
* PRIO_PROCESS,
* PRIO_DARWIN_BG or PRIO_DARWIN_THREAD.
* @throws PcntlException
*
*/