HHVM 4.49
HHVM 4.49 is released! This release marks the end of support for 4.43; HHVM 4.44–4.48 remain supported, as do the 4.8 and 4.32 LTS releases.
Highlights
- New
.hhconfig
optiondisable_modes
(previouslydisable_partial
) will cause the typechecker to treat all files as strict (comments after<?hh
no longer have special meaning).- The default value will be
false
for the foreseeable future.
- The default value will be
- New
hackfmt
flag--format-generated-code
can be used to format generated and partially generated files. - Fixed a bug that could cause part of
hackfmt
output to be missing when formatting partially generated files, and other minor fixes and improvements forhackfmt
. - Fixed a bug that could prevent the “go to type” IDE feature from working inside async functions.
- Improved various typechecker error messages, e.g. when accessing an optional
shape field it now recommends using
Shapes::idx
instead of??
.
Breaking Changes
- Comparing (
<
,>
,<=
,>=
,<=>
) a legacy PHP array with a non-array now throwsInvalidOperationException
(previously only raised a Notice). It had already been a typechecker error. - It is now a runtime error if
class_meth
is used with arguments that are not a::class
and a string literal (a string literal as the 1st argument will also not cause a runtime error, but::class
literal is recommended). It had already been a typechecker error.- If a dynamic pointer is required, annotate the method with
<<__DynamicallyCallable>>
and useHH\dynamic_class_meth()
.
- If a dynamic pointer is required, annotate the method with
Future Changes
- We are working towards deprecating (and eventually removing from the language)
“magic methods”
such as
__call
or__get
. Currently, you can use the INI optionhhvm.no_use_magic_methods=true
to trigger warnings whenever a magic method is invoked, e.g. when an undefined method is called on a class that has the__call
magic method. - Comparing Hack arrays to
true
,false
, andnull
with the “fuzzy” equality operators (==
,!=
) will be changed so that non-empty Hack arrays are== true
and empty Hack arrays are== false
and== null
.- The INI option
hhvm.hack_arr_empty_based_bool_eq_cmp=true
can be used to enable this behavior now. - The new behavior is consistent with legacy arrays, making it easier to migrate to Hack arrays.
- The INI option