diff options
author | Andrew Dolgov <[email protected]> | 2022-07-31 13:55:09 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-07-31 13:55:09 +0300 |
commit | 26c67dba776e1e6f8ac40eed70fe79995325863d (patch) | |
tree | 862b043fa666e44ed0b2c997a98b1a256b26ee12 /vendor/thecodingmachine/safe | |
parent | d5c043e8467881c00b2cd836f2f37b8479cf0b96 (diff) |
update phpstan to 1.8.2
Diffstat (limited to 'vendor/thecodingmachine/safe')
12 files changed, 144 insertions, 122 deletions
diff --git a/vendor/thecodingmachine/safe/deprecated/array.php b/vendor/thecodingmachine/safe/deprecated/array.php index f0b3a20b7..691ea7394 100644 --- a/vendor/thecodingmachine/safe/deprecated/array.php +++ b/vendor/thecodingmachine/safe/deprecated/array.php @@ -5,6 +5,79 @@ 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; +} + +/** * array_flip returns an array in flip * order, i.e. keys from array become values and values * from array become keys. diff --git a/vendor/thecodingmachine/safe/deprecated/functionsList.php b/vendor/thecodingmachine/safe/deprecated/functionsList.php index 6b39199c8..b75d7abb2 100644 --- a/vendor/thecodingmachine/safe/deprecated/functionsList.php +++ b/vendor/thecodingmachine/safe/deprecated/functionsList.php @@ -12,6 +12,8 @@ return [ 'apc_load_constants', 'apc_sma_info', 'arsort', + 'array_replace', + 'array_replace_recursive', 'array_combine', 'array_flip', 'asort', diff --git a/vendor/thecodingmachine/safe/generated/array.php b/vendor/thecodingmachine/safe/generated/array.php index 37fa077a6..39a77b5e4 100644 --- a/vendor/thecodingmachine/safe/generated/array.php +++ b/vendor/thecodingmachine/safe/generated/array.php @@ -5,81 +5,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 * into deeper arrays. diff --git a/vendor/thecodingmachine/safe/generated/curl.php b/vendor/thecodingmachine/safe/generated/curl.php index a85379a63..3c89871c3 100644 --- a/vendor/thecodingmachine/safe/generated/curl.php +++ b/vendor/thecodingmachine/safe/generated/curl.php @@ -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; } diff --git a/vendor/thecodingmachine/safe/generated/exec.php b/vendor/thecodingmachine/safe/generated/exec.php index c4dd49114..126438d43 100644 --- a/vendor/thecodingmachine/safe/generated/exec.php +++ b/vendor/thecodingmachine/safe/generated/exec.php @@ -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 * */ diff --git a/vendor/thecodingmachine/safe/generated/filesystem.php b/vendor/thecodingmachine/safe/generated/filesystem.php index 7f1b08bb0..f3e5a2081 100644 --- a/vendor/thecodingmachine/safe/generated/filesystem.php +++ b/vendor/thecodingmachine/safe/generated/filesystem.php @@ -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 diff --git a/vendor/thecodingmachine/safe/generated/functionsList.php b/vendor/thecodingmachine/safe/generated/functionsList.php index 3c537d1f6..5a590058e 100644 --- a/vendor/thecodingmachine/safe/generated/functionsList.php +++ b/vendor/thecodingmachine/safe/generated/functionsList.php @@ -14,8 +14,6 @@ return [ 'apcu_inc', 'apcu_sma_info', 'apc_fetch', - 'array_replace', - 'array_replace_recursive', 'array_walk_recursive', 'assert_options', 'base64_decode', diff --git a/vendor/thecodingmachine/safe/generated/json.php b/vendor/thecodingmachine/safe/generated/json.php index 76fc6c17e..e524c6178 100644 --- a/vendor/thecodingmachine/safe/generated/json.php +++ b/vendor/thecodingmachine/safe/generated/json.php @@ -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 diff --git a/vendor/thecodingmachine/safe/generated/ldap.php b/vendor/thecodingmachine/safe/generated/ldap.php index 97b42e5a5..0bfaaaf2b 100644 --- a/vendor/thecodingmachine/safe/generated/ldap.php +++ b/vendor/thecodingmachine/safe/generated/ldap.php @@ -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(); diff --git a/vendor/thecodingmachine/safe/generated/pcntl.php b/vendor/thecodingmachine/safe/generated/pcntl.php index 66cc28d46..d05f7ff3d 100644 --- a/vendor/thecodingmachine/safe/generated/pcntl.php +++ b/vendor/thecodingmachine/safe/generated/pcntl.php @@ -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 * */ diff --git a/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php b/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php index d0dbdb695..3401b57b8 100644 --- a/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php +++ b/vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php @@ -8,8 +8,8 @@ class CurlException extends \Exception implements SafeExceptionInterface /** * @param \CurlHandle $ch */ - public static function createFromPhpError($ch): self + public static function createFromPhpError($ch = null): self { - return new self(\curl_error($ch), \curl_errno($ch)); + return new self($ch ? \curl_error($ch) : '', $ch ? \curl_errno($ch) : 0); } } diff --git a/vendor/thecodingmachine/safe/rector-migrate.php b/vendor/thecodingmachine/safe/rector-migrate.php index efa2a2862..4f17de5e6 100644 --- a/vendor/thecodingmachine/safe/rector-migrate.php +++ b/vendor/thecodingmachine/safe/rector-migrate.php @@ -24,8 +24,6 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'apcu_inc' => 'Safe\apcu_inc', 'apcu_sma_info' => 'Safe\apcu_sma_info', 'apc_fetch' => 'Safe\apc_fetch', - 'array_replace' => 'Safe\array_replace', - 'array_replace_recursive' => 'Safe\array_replace_recursive', 'array_walk_recursive' => 'Safe\array_walk_recursive', 'assert_options' => 'Safe\assert_options', 'base64_decode' => 'Safe\base64_decode', |