refactor(polyfills): update complex_types class structure and methods

- Move class declaration to new line with proper brace placement
- Add bigInt, decimal, and bigFloat methods for type handling
- Modify vector method to accept optional size parameter
- Remove unsafe_ptr and fill methods from class
- Clean up trailing braces in type conversion functions
pull/15/head
韩天峰 2 months ago
parent af3472bd9a
commit ec4a12f122
  1. 31
      src/polyfills.php

@ -16,7 +16,8 @@ class native_types
public const type_decimal = 'decimal'; public const type_decimal = 'decimal';
} }
class complex_types { class complex_types
{
public const type_any = 'any'; public const type_any = 'any';
public const type_var = 'any'; public const type_var = 'any';
public const type_variant = 'any'; public const type_variant = 'any';
@ -45,36 +46,39 @@ class std
return boolval($value); return boolval($value);
} }
public static function array(mixed $type, int $size): array public static function bigInt(mixed $value): mixed
{ {
return []; return $value;
} }
public static function ordered_map(mixed $key_type, mixed $value_type): array public static function decimal(mixed $value): mixed
{ {
return []; return $value;
} }
public static function map(mixed $key_type, mixed $value_type): array public static function bigFloat(mixed $value): mixed
{
return $value;
}
public static function array(mixed $type, int $size): array
{ {
return []; return [];
} }
public static function vector(mixed $value_type): array public static function ordered_map(mixed $key_type, mixed $value_type): array
{ {
return []; return [];
} }
public static function unsafe_ptr(mixed &$value): mixed public static function map(mixed $key_type, mixed $value_type): array
{ {
return null; return [];
} }
public static function fill(array $array, mixed $value): void public static function vector(mixed $value_type, ?int $size = null): array
{ {
for ($i = 0; $i < count($array); $i++) { return [];
$array[$i] = $value;
}
} }
} }
@ -93,4 +97,3 @@ function objval(mixed $var, string $className): mixed
{ {
return $var; return $var;
} }

Loading…
Cancel
Save