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

@@ -5,9 +5,9 @@ namespace Safe;
use Safe\Exceptions\FileinfoException;
/**
* This function closes the resource opened by finfo_open.
* This function closes the instance opened by finfo_open.
*
* @param resource $finfo Fileinfo resource returned by finfo_open.
* @param resource $finfo An finfo instance, returned by finfo_open.
* @throws FileinfoException
*
*/
@@ -24,13 +24,13 @@ function finfo_close($finfo): void
/**
* Procedural style
*
* Object oriented style (constructor):
* Object-oriented style (constructor):
*
* This function opens a magic database and returns its resource.
* This function opens a magic database and returns its instance.
*
* @param int $options One or disjunction of more Fileinfo
* @param int $flags One or disjunction of more Fileinfo
* constants.
* @param string $magic_file Name of a magic database file, usually something like
* @param string $magic_database Name of a magic database file, usually something like
* /path/to/magic.mime. If not specified, the
* MAGIC environment variable is used. If the
* environment variable isn't set, then PHP's bundled magic database will
@@ -39,14 +39,18 @@ function finfo_close($finfo): void
* Passing NULL or an empty string will be equivalent to the default
* value.
* @return resource (Procedural style only)
* Returns a magic database resource on success.
* Returns an finfo instance on success.
* @throws FileinfoException
*
*/
function finfo_open(int $options = FILEINFO_NONE, string $magic_file = "")
function finfo_open(int $flags = FILEINFO_NONE, string $magic_database = null)
{
error_clear_last();
$result = \finfo_open($options, $magic_file);
if ($magic_database !== null) {
$result = \finfo_open($flags, $magic_database);
} else {
$result = \finfo_open($flags);
}
if ($result === false) {
throw FileinfoException::createFromPhpError();
}
@@ -58,13 +62,13 @@ function finfo_open(int $options = FILEINFO_NONE, string $magic_file = "")
* Returns the MIME content type for a file as determined by using
* information from the magic.mime file.
*
* @param string $filename Path to the tested file.
* @param string|resource $filename Path to the tested file.
* @return string Returns the content type in MIME format, like
* text/plain or application/octet-stream.
* @throws FileinfoException
*
*/
function mime_content_type(string $filename): string
function mime_content_type($filename): string
{
error_clear_last();
$result = \mime_content_type($filename);