From ec4a12f12246004d5e91bb59441c0689ab51ec32 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 9 Jul 2026 11:41:50 +0800 Subject: [PATCH] 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 --- src/polyfills.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/polyfills.php b/src/polyfills.php index 92dbca2c..b21416a4 100644 --- a/src/polyfills.php +++ b/src/polyfills.php @@ -16,7 +16,8 @@ class native_types public const type_decimal = 'decimal'; } -class complex_types { +class complex_types +{ public const type_any = 'any'; public const type_var = 'any'; public const type_variant = 'any'; @@ -45,36 +46,39 @@ class std 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 []; } - public static function vector(mixed $value_type): array + public static function ordered_map(mixed $key_type, mixed $value_type): array { 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++) { - $array[$i] = $value; - } + return []; } } @@ -93,4 +97,3 @@ function objval(mixed $var, string $className): mixed { return $var; } -