This commit is contained in:
2025-11-04 23:10:50 +05:00
parent 65a47e8028
commit cc3a9cd854
11 changed files with 348 additions and 12 deletions

View File

@@ -59,11 +59,20 @@ function module_exists(string $moduleName): bool
*/
function string(mixed $value): string
{
if (! is_string($value)) {
throw new Exception('!!!Make it string!!!');
if (is_string($value)) {
return $value;
}
return $value;
if ($value instanceof Stringable) {
return (string) $value;
}
// Optionally handle scalar values (int, float, bool) as strings too
if (is_scalar($value)) {
return (string) $value;
}
throw new Exception('Value is not stringable.');
}
/**