Files
kulakpos_web/vendor/thecodingmachine/safe/generated/8.1/fileinfo.php

59 lines
1.2 KiB
PHP
Raw Normal View History

2026-03-30 14:54:57 +07:00
<?php
namespace Safe;
use Safe\Exceptions\FileinfoException;
/**
2026-04-18 20:32:18 +07:00
* @param \finfo $finfo
2026-03-30 14:54:57 +07:00
* @throws FileinfoException
*
*/
function finfo_close(\finfo $finfo): void
{
error_clear_last();
$safeResult = \finfo_close($finfo);
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
}
/**
2026-04-18 20:32:18 +07:00
* @param int $flags
* @param null|string $magic_database
* @return \finfo
2026-03-30 14:54:57 +07:00
* @throws FileinfoException
*
*/
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): \finfo
{
error_clear_last();
if ($magic_database !== null) {
$safeResult = \finfo_open($flags, $magic_database);
} else {
$safeResult = \finfo_open($flags);
}
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
return $safeResult;
}
/**
2026-04-18 20:32:18 +07:00
* @param resource|string $filename
* @return string
2026-03-30 14:54:57 +07:00
* @throws FileinfoException
*
*/
function mime_content_type($filename): string
{
error_clear_last();
$safeResult = \mime_content_type($filename);
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
return $safeResult;
}