HHVM 3.23 已发布,此版本包含新功能、错误修复、性能改进和支持未来改进的工作。 有以下值得关注的更新: optional shape fields 现在与 nullable shape fields 不同,有关帮助迁移的详细信息和工具,请参阅 3.22 发布公告。 支持 VSCode 语言服务器协议,这将很快被 Nuclide 的 Hack 整合使用 函数可能不再命名为 using(),因为这将与即将到来的 using 特性相冲突 支持使类型检查器完全忽略某些文件;这是通过 ignored_paths .hhconfig 实现的,其中包含一个正则表达式数组 - 例如,ignored_paths = [ "vendor/.*tests?/" 现在支持元组常量 方法调用现在支持括号表达式 修复了一些需要中断(Ctrl-C) hh_client的情况 支持针对 OpenSSL 1.1 进行构建,例如 Debian Stretch,Ubuntu Zesty 和 Ubuntu Artful Hack 的实验性 bytecode emitter 替代方案 即将到来的变更: Call-Time Pass-By-Reference HHVM 3.24 将要求引用参数在调用点处标记 - 例如: function foo(array<string> $bar): void { sort(&$bar); } 3.23 中的 Hack 允许使用这种语法,但不需要这种要求。可以通过在 .hhconfig 中将 safe_pass_by_ref 添加到 enable_experimental_tc_features 来选择加入这种要求。 Lambda 类型推断 在 HHVM 3.24 中,将使用预期的 lambda 类型来改进它们;例如,下面的代码没有错误: <?hh // strict class MyClass {} class MyClosureRunner<-T> { public function __construct(private (function(T): string) $closure) {} } function expectsMyClosureRunnerMyClass( MyClosureRunner<MyClass> $x, ): MyClosureRunner<MyClass> { return $x; } function getThing1(): MyClosureRunner<MyClass> { $var = expectsMyClosureRunnerMyClass( new MyClosureRunner( function(/* MyClass */ $arg) { $arg->missing_method(); return "ok"; }, ), ); return $var; } 在 3.24 中,或者在 .hhconfig 中使用 enable_experimental_tc_features=contextual_inference,typechecker 会引发以下错误: test.php:19:15,28: Could not find method missing_method in an object of type MyClass (Typing[4053]) test.php:10:19,25: This is why I think it is an object of type MyClass test.php:3:7,13: Declaration of MyClass is here 更新内容较多,详情请查看发布主页。 目前,3.23 的最新修正版 3.23.2 也已发布。 HHVM 3.23 发布,高速的 PHP 执行引擎下载地址