Skip to content

4.64.4: migration for array typehints

Choose a tag to compare
@jjergus jjergus released this 03 Aug 17:49

The array type was removed in HHVM 4.68. This provides the related automated migrations.

You will need HHVM 4.62 to 4.67 to run these migrations, except --harden-varray-or-darray-typehints which also works on HHVM 4.68+.

    Migrate array typehints to <<__Soft>> varray_or_darray (safe)
    Migrate array typehints to varray_or_darray (safe only in HHVM 4.68+)
    Remove <<__Soft>> from varray_or_darray typehints (recommended after migrating to HHVM 4.68+)
    Migrate array typehints to <<__Soft>> varray or <<__Soft>> darray (likely to cause runtime warnings)

Recommended migration paths:

  • if upgrading straight to HHVM 4.68+:
    • --php-array-typehints-hard
    • this is not safe before HHVM 4.68 because while the array type exists, it is possible to have values that pass array typehints but don't pass varray_or_darray
  • otherwise:
    • --php-array-typehints-soft
    • then after upgrading to HHVM 4.68+: --harden-varray-or-darray-typehints
    • beware: this may also harden typehints that were originally <<__Soft>>, as that information is lost during the first part
  • for smaller projects where some amount of runtime warnings is acceptable:
    • --php-array-typehints-best-guess