HHVM 4.19.0
HHVM 4.19 is released! This release marks the end of support for 4.13; 4.14-4.18 remain supported, as do the LTS releases 3.30 and 4.8.
Highlights
- Added the
<<__Explicit>>attribute, requiring that generics are specified; for example,function foo<T>(T $a, T $b) {}foo(123, 'abc').is valid, asmixedis a valid type forT; however, forfunction foo<<<__Explicit>> T>(T $a, T $b) {},foo<int>(123, 456)is valid, butfoo<int>(123, 'abc')is not. - Added
ReflectionFunctionAbstract::getReifiedTypeParamInfo() - As a migration aid,
dicts are now callable in the runtime; this will raise a typechecker error, and is not suitable for use in new code. - As a migration aid, added
current_ref(),key_ref(), andxml_set_object_ref(), in preparation for modifyingcurrent(),key(), andxml_set_object()to not take their parameters by-reference. - Added
openssl_encrypt_with_tag(), as optional inout arguments are not supported, in preparation for removing the optional byref tag argument fromopenssl_encrypt() - Added TLS client certificate authentication support to the proxygen server;
this can be configured via the
hhvm.server.ssl_client_ca_fileandhhvm.server.ssl_client_auth_leveloptions; level 0 is disabled, 1 is optional, 2 is mandatory. If level is not 0, the CA file must be specified.
Breaking Changes
- Added typechecker error for unsafe calls to generic static methods via
classname<T>variables. - Removed support for
"${foo}"-style string interpolation; use"{$foo}"instead.hhast-migrate --dollar-brace-interpolationcan be used to update code as needed, and thedisable_outside_dollar_str_interp=true.hhconfigoption can be used on previous versions to find problem cases. usort(),uasort(), anduksort()now specify the type of the callback, instead of takingmixed.final interfaceandfinal traitare now parse errors.- A typechecker error is now raised if abstract properties are declared on non-abstract classes.
- It is now a parse error to attempt to use the return value of a function by-reference.
- Added typechecker errors where builtin attributes are used in unsupported
places; for example, it is now an error to attach the
<<__EntryPoint>>attribute to a class. - Fixed variance checks for generic variadics.
- It is now a parse error to declare a property using the PHP
varkeyword. - The
Stringishinterface is deprecated, and can not be converted to a string without a typechecker error. As a temporary aid, it may be useful to define a function like the following:
1
2
3
4
5
6
function stringish_cast(mixed $value): string {
return is_object($value) && $value is Stringish
/* HH_IGNORE_ERROR[4128] This is intentionally deprecated */
? $value->__toString()
: (string)$value;
}
Future changes
- Error messages will be improved for use of
Stringish - The 4110 (type/unification error) code will be split into multiple error
codes; this will need changes to
HH_FIXME[4110]and similar suppressions. These changes can be found now with theuse_new_type_errors=trueoption in.hhconfig.