fix: phpstan level=6

This commit is contained in:
origami11@yandex.ru 2025-10-06 12:49:36 +03:00
parent acbf2c847d
commit 48269bd424
41 changed files with 324 additions and 347 deletions

View file

@ -10,7 +10,7 @@ namespace ctiso;
class Primitive {
// varchar
public static function to_varchar($value)
public static function to_varchar($value): string
{
return ((string) $value);
}
@ -26,28 +26,28 @@ class Primitive {
return filter_var($value, FILTER_VALIDATE_BOOLEAN);//(int)((bool) $value);
}
public static function from_bool($value)
public static function from_bool($value): bool
{
return ((bool) $value);
}
// int
public static function to_int($value)
public static function to_int($value): int
{
return ((int) $value);
}
public static function from_int($value)
public static function from_int($value): string
{
return ((string) $value);
}
// date
public static function to_date($value)
{
$result = 0;
$tmp = explode("/", $value ?? '', 3);
if (count($tmp) != 3) {
return $result;
}
@ -63,7 +63,7 @@ class Primitive {
return 0;
}
}
return $result;
}
@ -110,7 +110,7 @@ class Primitive {
}
// array
public static function to_array($value)
public static function to_array($value)
{
return (is_array($value)) ? $value : [];
}