OpenProviderライブラリ
This commit is contained in:
7
util.php
7
util.php
@@ -268,6 +268,13 @@ function randstr(): string {
|
||||
return bin2hex(random_bytes($len));
|
||||
}
|
||||
|
||||
function assert_exists(mixed $assertion, Throwable|string|null $description = null): bool {
|
||||
if (ini_get('zend.assertions') < 1) trigger_error('assert機能性が無効です。有効するには、php.iniで「zend.assertions = 1」に設定して下さい。', E_USER_WARNING);
|
||||
if (isset($assertion)) return true;
|
||||
assert(false, $description ?? 'Assertion failed: value is not null');
|
||||
return false;
|
||||
}
|
||||
|
||||
function assert_null(mixed $assertion, Throwable|string|null $description = null): bool {
|
||||
if (ini_get('zend.assertions') < 1) trigger_error('assert機能性が無効です。有効するには、php.iniで「zend.assertions = 1」に設定して下さい。', E_USER_WARNING);
|
||||
if (is_null($assertion)) return true;
|
||||
|
||||
Reference in New Issue
Block a user