upgrade idiorm to php8.1-patched version (aaronpk/idiorm)

This commit is contained in:
Andrew Dolgov
2022-07-12 22:26:21 +03:00
parent 4b61618920
commit 80d3db1dcf
189 changed files with 17077 additions and 12739 deletions

View File

@@ -7,14 +7,14 @@ use Safe\Exceptions\MiscException;
/**
* Defines a named constant at runtime.
*
* @param string $name The name of the constant.
* @param string $constant_name The name of the constant.
*
* It is possible to define constants with reserved or
* even invalid names, whose value can (only) be retrieved with
* constant. However, doing so is not recommended.
* @param mixed $value The value of the constant. In PHP 5, value must
* be a scalar value (integer,
* float, string, boolean, or
* be a scalar value (int,
* float, string, bool, or
* NULL). In PHP 7, array values are also accepted.
*
* While it is possible to define resource constants, it is
@@ -28,10 +28,10 @@ use Safe\Exceptions\MiscException;
* @throws MiscException
*
*/
function define(string $name, $value, bool $case_insensitive = false): void
function define(string $constant_name, $value, bool $case_insensitive = false): void
{
error_clear_last();
$result = \define($name, $value, $case_insensitive);
$result = \define($constant_name, $value, $case_insensitive);
if ($result === false) {
throw MiscException::createFromPhpError();
}
@@ -72,7 +72,7 @@ function highlight_file(string $filename, bool $return = false)
/**
*
*
* @param string $str The PHP code to be highlighted. This should include the opening tag.
* @param string $string The PHP code to be highlighted. This should include the opening tag.
* @param bool $return Set this parameter to TRUE to make this function return the
* highlighted code.
* @return string|bool If return is set to TRUE, returns the highlighted
@@ -81,10 +81,34 @@ function highlight_file(string $filename, bool $return = false)
* @throws MiscException
*
*/
function highlight_string(string $str, bool $return = false)
function highlight_string(string $string, bool $return = false)
{
error_clear_last();
$result = \highlight_string($str, $return);
$result = \highlight_string($string, $return);
if ($result === false) {
throw MiscException::createFromPhpError();
}
return $result;
}
/**
*
*
* @param bool $as_number Whether the high resolution time should be returned as array
* or number.
* @return array{0:int,1:int}|int|float Returns an array of integers in the form [seconds, nanoseconds], if the
* parameter as_number is false. Otherwise the nanoseconds
* are returned as int (64bit platforms) or float
* (32bit platforms).
* Returns FALSE on failure.
* @throws MiscException
*
*/
function hrtime(bool $as_number = false)
{
error_clear_last();
$result = \hrtime($as_number);
if ($result === false) {
throw MiscException::createFromPhpError();
}
@@ -232,7 +256,7 @@ function highlight_string(string $str, bool $return = false)
*
*
* Z
* NUL-padded string (new in PHP 5.5)
* NUL-padded string
*
*
* @
@@ -241,16 +265,16 @@ function highlight_string(string $str, bool $return = false)
*
*
*
* @param mixed $params
* @param mixed $values
* @return string Returns a binary string containing data.
* @throws MiscException
*
*/
function pack(string $format, ...$params): string
function pack(string $format, ...$values): string
{
error_clear_last();
if ($params !== []) {
$result = \pack($format, ...$params);
if ($values !== []) {
$result = \pack($format, ...$values);
} else {
$result = \pack($format);
}
@@ -288,14 +312,14 @@ function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject): str
/**
* Set the codepage of the current process.
*
* @param int $cp A codepage identifier.
* @param int $codepage A codepage identifier.
* @throws MiscException
*
*/
function sapi_windows_cp_set(int $cp): void
function sapi_windows_cp_set(int $codepage): void
{
error_clear_last();
$result = \sapi_windows_cp_set($cp);
$result = \sapi_windows_cp_set($codepage);
if ($result === false) {
throw MiscException::createFromPhpError();
}
@@ -324,9 +348,50 @@ function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void
/**
* If enable is omitted, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
* Sets or removes a CTRL event handler, which allows Windows
* CLI processes to intercept or ignore CTRL+C and
* CTRL+BREAK events. Note that in multithreaded environments,
* this is only possible when called from the main thread.
*
* If enable is specified, the function will try to enable or disable the VT100 features of the stream stream.
* @param $handler A callback function to set or remove. If set, this function will be called
* whenever a CTRL+C or CTRL+BREAK event
* occurs. The function is supposed to have the following signature:
*
* voidhandler
* intevent
*
*
*
* event
*
*
* The CTRL event which has been received;
* either PHP_WINDOWS_EVENT_CTRL_C
* or PHP_WINDOWS_EVENT_CTRL_BREAK.
*
*
*
*
* Setting a NULL handler causes the process to ignore
* CTRL+C events, but not CTRL+BREAK events.
* @param bool $add
* @throws MiscException
*
*/
function sapi_windows_set_ctrl_handler($handler, bool $add = true): void
{
error_clear_last();
$result = \sapi_windows_set_ctrl_handler($handler, $add);
if ($result === false) {
throw MiscException::createFromPhpError();
}
}
/**
* If enable is NULL, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
*
* If enable is a bool, the function will try to enable or disable the VT100 features of the stream stream.
* If the feature has been successfully enabled (or disabled).
*
* At startup, PHP tries to enable the VT100 feature of the STDOUT/STDERR streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.
@@ -335,7 +400,7 @@ function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void
* They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.
*
* @param resource $stream The stream on which the function will operate.
* @param bool $enable If specified, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE).
* @param bool $enable If bool, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE).
* @throws MiscException
*
*/
@@ -385,7 +450,7 @@ function sleep(int $seconds): int
*
* @param int $seconds Must be a non-negative integer.
* @param int $nanoseconds Must be a non-negative integer less than 1 billion.
* @return array{0:int,1:int}|bool Returns TRUE on success.
* @return array{0:0|positive-int,1:0|positive-int}|bool Returns TRUE on success.
*
* If the delay was interrupted by a signal, an associative array will be
* returned with the components:
@@ -445,18 +510,33 @@ function time_sleep_until(float $timestamp): void
* then each of the array keys will have a sequence number behind
* the given name.
*
* Changes were made to bring this function into line with Perl:
*
*
* The "a" code now retains trailing NULL bytes.
*
*
* The "A" code now strips all trailing ASCII whitespace (spaces, tabs,
* newlines, carriage returns, and NULL bytes).
*
*
* The "Z" code was added for NULL-padded strings, and removes trailing
* NULL bytes.
*
*
*
* @param string $format See pack for an explanation of the format codes.
* @param string $data The packed data.
* @param string $string The packed data.
* @param int $offset The offset to begin unpacking from.
* @return array Returns an associative array containing unpacked elements of binary
* string.
* @throws MiscException
*
*/
function unpack(string $format, string $data, int $offset = 0): array
function unpack(string $format, string $string, int $offset = 0): array
{
error_clear_last();
$result = \unpack($format, $data, $offset);
$result = \unpack($format, $string, $offset);
if ($result === false) {
throw MiscException::createFromPhpError();
}