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

@@ -4,6 +4,123 @@ namespace Safe;
use Safe\Exceptions\InfoException;
/**
* Set the various assert control options or just query
* their current settings.
*
* @param int $what
* Assert Options
*
*
*
* Option
* INI Setting
* Default value
* Description
*
*
*
*
* ASSERT_ACTIVE
* assert.active
* 1
* enable assert evaluation
*
*
* ASSERT_WARNING
* assert.warning
* 1
* issue a PHP warning for each failed assertion
*
*
* ASSERT_BAIL
* assert.bail
* 0
* terminate execution on failed assertions
*
*
* ASSERT_QUIET_EVAL
* assert.quiet_eval
* 0
*
* disable error_reporting during assertion expression
* evaluation
*
*
*
* ASSERT_CALLBACK
* assert.callback
* (NULL)
* Callback to call on failed assertions
*
*
*
*
* @param mixed $value An optional new value for the option.
*
* The callback function set via ASSERT_CALLBACK or assert.callback should
* have the following signature:
*
* voidassert_callback
* stringfile
* intline
* stringassertion
* stringdescription
*
*
*
* file
*
*
* The file where assert has been called.
*
*
*
*
* line
*
*
* The line where assert has been called.
*
*
*
*
* assertion
*
*
* The assertion that has been passed to assert,
* converted to a string.
*
*
*
*
* description
*
*
* The description that has been passed to assert.
*
*
*
*
* @return mixed Returns the original setting of any options.
* @throws InfoException
*
*/
function assert_options(int $what, $value = null)
{
error_clear_last();
if ($value !== null) {
$result = \assert_options($what, $value);
} else {
$result = \assert_options($what);
}
if ($result === false) {
throw InfoException::createFromPhpError();
}
return $result;
}
/**
* Sets the process title visible in tools such as top and
* ps. This function is available only in
@@ -25,14 +142,14 @@ function cli_set_process_title(string $title): void
/**
* Loads the PHP extension given by the parameter
* library.
* extension_filename.
*
* Use extension_loaded to test whether a given
* extension is already available or not. This works on both built-in
* extensions and dynamically loaded ones (either through php.ini or
* dl).
*
* @param string $library This parameter is only the filename of the
* @param string $extension_filename This parameter is only the filename of the
* extension to load which also depends on your platform. For example,
* the sockets extension (if compiled
* as a shared module, not the default!) would be called
@@ -77,16 +194,34 @@ function cli_set_process_title(string $title): void
* @throws InfoException
*
*/
function dl(string $library): void
function dl(string $extension_filename): void
{
error_clear_last();
$result = \dl($library);
$result = \dl($extension_filename);
if ($result === false) {
throw InfoException::createFromPhpError();
}
}
/**
*
*
* @return string Returns the path, as a string.
* @throws InfoException
*
*/
function get_include_path(): string
{
error_clear_last();
$result = \get_include_path();
if ($result === false) {
throw InfoException::createFromPhpError();
}
return $result;
}
/**
* Gets the time of the last modification of the main script of execution.
*
@@ -185,23 +320,40 @@ function getmyuid(): int
/**
* Parses options passed to the script.
*
* @param string $options
* @param array $longopts
* @param int|null $optind
* @return array|array|array This function will return an array of option / argument pairs.
* @param string $short_options
* @param array $long_options
* @param int|null $rest_index
* @return \__benevolent This function will return an array of option / argument pairs.
* @throws InfoException
*
*/
function getopt(string $options, array $longopts = null, ?int &$optind = null): array
function getopt(string $short_options, array $long_options = [], ?int &$rest_index = null): array
{
error_clear_last();
if ($optind !== null) {
$result = \getopt($options, $longopts, $optind);
} elseif ($longopts !== null) {
$result = \getopt($options, $longopts);
} else {
$result = \getopt($options);
$result = \getopt($short_options, $long_options, $rest_index);
if ($result === false) {
throw InfoException::createFromPhpError();
}
return $result;
}
/**
* This is an interface to getrusage(2). It gets data returned
* from the system call.
*
* @param int $mode If mode is 1, getrusage will be called with
* RUSAGE_CHILDREN.
* @return array Returns an associative array containing the data returned from the system
* call. All entries are accessible by using their documented field names.
* Returns FALSE on failure.
* @throws InfoException
*
*/
function getrusage(int $mode = 0): array
{
error_clear_last();
$result = \getrusage($mode);
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -212,17 +364,17 @@ function getopt(string $options, array $longopts = null, ?int &$optind = null):
/**
* Returns the value of the configuration option on success.
*
* @param string $varname The configuration option name.
* @param string $option The configuration option name.
* @return string Returns the value of the configuration option as a string on success, or an
* empty string for null values. Returns FALSE if the
* configuration option doesn't exist.
* @throws InfoException
*
*/
function ini_get(string $varname): string
function ini_get(string $option): string
{
error_clear_last();
$result = \ini_get($varname);
$result = \ini_get($option);
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -235,18 +387,45 @@ function ini_get(string $varname): string
* will keep this new value during the script's execution, and will be restored
* at the script's ending.
*
* @param string $varname Not all the available options can be changed using
* @param string $option Not all the available options can be changed using
* ini_set. There is a list of all available options
* in the appendix.
* @param string|int|float|bool $newvalue The new value for the option.
* @param string $value The new value for the option.
* @return string Returns the old value on success, FALSE on failure.
* @throws InfoException
*
*/
function ini_set(string $varname, $newvalue): string
function ini_set(string $option, string $value): string
{
error_clear_last();
$result = \ini_set($varname, $newvalue);
$result = \ini_set($option, $value);
if ($result === false) {
throw InfoException::createFromPhpError();
}
return $result;
}
/**
*
*
* @return string Returns the interface type, as a lowercase string.
*
* Although not exhaustive, the possible return values include
* apache,
* apache2handler,
* cgi (until PHP 5.3),
* cgi-fcgi, cli, cli-server,
* embed, fpm-fcgi,
* litespeed,
* phpdbg.
* @throws InfoException
*
*/
function php_sapi_name(): string
{
error_clear_last();
$result = \php_sapi_name();
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -259,8 +438,8 @@ function ini_set(string $varname, $newvalue): string
* modules, etc. It generates the appropriate HTML codes to insert
* the information in a page.
*
* @param int $flag To generate a custom credits page, you may want to use the
* flag parameter.
* @param int $flags To generate a custom credits page, you may want to use the
* flags parameter.
*
*
* Pre-defined phpcredits flags
@@ -323,10 +502,10 @@ function ini_set(string $varname, $newvalue): string
* @throws InfoException
*
*/
function phpcredits(int $flag = CREDITS_ALL): void
function phpcredits(int $flags = CREDITS_ALL): void
{
error_clear_last();
$result = \phpcredits($flag);
$result = \phpcredits($flags);
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -348,9 +527,9 @@ function phpcredits(int $flag = CREDITS_ALL): void
* phpinfo is also a valuable debugging tool as it
* contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
*
* @param int $what The output may be customized by passing one or more of the
* @param int $flags The output may be customized by passing one or more of the
* following constants bitwise values summed
* together in the optional what parameter.
* together in the optional flags parameter.
* One can also combine the respective constants or bitwise values
* together with the bitwise or operator.
*
@@ -433,10 +612,10 @@ function phpcredits(int $flag = CREDITS_ALL): void
* @throws InfoException
*
*/
function phpinfo(int $what = INFO_ALL): void
function phpinfo(int $flags = INFO_ALL): void
{
error_clear_last();
$result = \phpinfo($what);
$result = \phpinfo($flags);
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -444,19 +623,19 @@ function phpinfo(int $what = INFO_ALL): void
/**
* Adds setting to the server environment. The
* Adds assignment to the server environment. The
* environment variable will only exist for the duration of the current
* request. At the end of the request the environment is restored to its
* original state.
*
* @param string $setting The setting, like "FOO=BAR"
* @param string $assignment The setting, like "FOO=BAR"
* @throws InfoException
*
*/
function putenv(string $setting): void
function putenv(string $assignment): void
{
error_clear_last();
$result = \putenv($setting);
$result = \putenv($assignment);
if ($result === false) {
throw InfoException::createFromPhpError();
}
@@ -467,16 +646,16 @@ function putenv(string $setting): void
* Sets the include_path
* configuration option for the duration of the script.
*
* @param string $new_include_path The new value for the include_path
* @param string $include_path The new value for the include_path
* @return string Returns the old include_path on
* success.
* @throws InfoException
*
*/
function set_include_path(string $new_include_path): string
function set_include_path(string $include_path): string
{
error_clear_last();
$result = \set_include_path($new_include_path);
$result = \set_include_path($include_path);
if ($result === false) {
throw InfoException::createFromPhpError();
}