refactor(php): 从函数调用优化器中移除 reset 和 end 函数

- 从 FuncCallOptimizer.php 中移除了 'reset' 和 'end' 函数
- 删除了相关的类型错误测试文件 reset_end_type_error.phpt
- 更新了优化器中的函数列表配置
pull/1/head
韩天峰 2 months ago
parent cd3f0743d7
commit 0c7464b4b3
  1. 1
      src/Php/Optimizer/FuncCallOptimizer.php
  2. 17
      tests/aot/stdlib/reset_end_type_error.phpt

@ -73,7 +73,6 @@ trait FuncCallOptimizer
'json_encode', 'json_decode', 'serialize', 'unserialize',
'random_int', 'random_bytes', 'mt_rand', 'rand',
'strstr', 'strrpos', 'is_a', 'is_subclass_of',
'reset', 'end',
'uniqid',
'dirname', 'basename',
// Math: trig, hyperbolic, exp/log, misc

@ -1,17 +0,0 @@
--TEST--
reset/end: TypeError for non-array
--FILE--
<?php
$str = "hello";
try { reset($str); } catch (TypeError $e) { echo $e->getMessage() . "\n"; }
$int = 42;
try { end($int); } catch (TypeError $e) { echo $e->getMessage() . "\n"; }
$arr = ["a" => 1, "b" => 2];
var_dump(reset($arr));
var_dump(end($arr));
?>
--EXPECT--
reset(): Argument #1 ($array) must be of type array
end(): Argument #1 ($array) must be of type array
int(1)
int(2)
Loading…
Cancel
Save