这里有新鲜出炉的精品教程,程序狗速度看过来!
HipHop VM(HHVM)是Facebook推出的用来执行PHP代码的虚拟机,它是一个PHP的JIT(Just-In- Time)编译器,同时具有产生快速代码和即时编译的优点。
HHVM 3.23 已发布,此版本包含新功能、错误修复、性能改进和支持未来改进的工作。
有以下值得关注的更新:
,因为这将与即将到来的
- using()
特性相冲突
- using
.
- ignored_paths
实现的,其中包含一个正则表达式数组 - 例如,
- hhconfig
- ignored_paths = [ "vendor/.*tests?/"
即将到来的变更:
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
,typechecker 会引发以下错误:
- enable_experimental_tc_features=contextual_inference
- 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 也已发布。
历史版本 :
来源: http://www.phperz.com/article/17/1121/361048.html