Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

4.64.4: migration for array typehints

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

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+.

--php-array-typehints-soft
    Migrate array typehints to <<__Soft>> varray_or_darray (safe)
--php-array-typehints-hard
    Migrate array typehints to varray_or_darray (safe only in HHVM 4.68+)
--harden-varray-or-darray-typehints
    Remove <<__Soft>> from varray_or_darray typehints (recommended after migrating to HHVM 4.68+)
--php-array-typehints-best-guess
    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