Releases: hhvm/hhast
4.14.3: configuration file compatibility
With the removal of the Linters\
sub-namespace in 4.14, configuration files referencing specific linters became invalid; with this release, Facebook\HHAST\Linters\FooLinter
and Facebook\HHAST\FooLinter
are considered equivalent in the configuration file.
This is a temporary feature to aid migrations and supporting multiple versions; we expect to remove this compatibility in a future release, and recommend removing Linters\
from your configuration files if you do not need to maintain compatibility with earlier versions of HHAST.
4.14.2: better XHP handling, nightly support
XHPCategoryNameToken
now implementsINameishNode
, fixing parse failures on some XHP child declarations- current nightly builds of HHVM (4.15-dev) are supported
4.13.2: improved support for XHP, bugfix in GroupUseStatementAlphabetizationLinter
XHPClassNameToken
andXHPCategoryNameToken
now implementINameishNode
MemberSelectionExpression::getName()
now returns anIExpression
instead ofNode
; nameish nodes are now returned wrapped in aNameExpression
- Backported changes to
GroupUseStatementAlphabetizationLinter
from 4.14 to fix incorrect alphabetization in some cases
v4.14.1: handle more XHP children expressions
4.13.0 and 4.14.0 raise errors for children (pcdata)*;
and similar expressions.
4.14.0: removal of `Missing`, much stricter typing
This release contains several major breaking changes:
- the
Facebook\HHAST\Linters\
andFacebook\HHAST\Migrations\
namespaces have been removed - the contents are now directly in theFacebook\HHAST\
namespace. This may require changes to blacklist/whitelist rules inhhast-lint.json
- the
Missing
node type has been removed; fileds that containSomeSpecifcNode
orMissing
are now typed as returning?SomeSpecificNode
instead of justNode
- fields are now consistently typed, including in constructors; for example, it is no longer possible to create an
ElseifClause
with a keyword that is anything other than anElseifToken
, andLeading
/Trailing
trivia on tokens is always aNodeList<Trivia>
- HHAST is now less willing to handle invalid Hack code
UnparsedReplacementCodeNode
has been removed.Node::insertAfter()
,::insertBefore()
, and::without()
have been removed, as they can not be implemented in such a root class with the changes to typing.
These breaking changes seem to have more impact on unit tests than on real code; for example, tests for methods have often included code like class Foo { function bar(): void {}
with a missing closing brace for the class, leading to expected nonnull
errors; missing semicolons are also common in test cases. These kind of errors do not often occur in real code, as they lead to immediate errors in both the typechecker and runtime.
Non-breaking improvements include:
NodeList::insertBefore()
,::insertAfter()
,::withoutChild()
and::withoutItemWithChild()
have been addedNodeList::isEmpty()
andNodeList::getCount()
have been added- empty namespace bodies are now correctly processed when resolving namespace uses
- error messages for invalid trees now include code snippets
4.13.1: handle more XHP child expressions
4.13.0 and 4.14.0 raise errors for children (pcdata)*;
and similar expressions.
4.13.0: add `instanceof` -> `is` migration, support current nightlies (4.14-dev)
This release:
- no longer uses
instanceof
expressions, supporting thedisable_instanceof_refinement=true
.hhconfig option and current nightly builds (4.14-dev) of HHVM - requires HHVM 4.13 or above
- stops
hhast-migrate
looking at non-hack files and git/hg data files if--include-vendor
is passed - fixes
hhast-migrate
ignoring.hack
files if migrating an entire directory - adds
bin/hhast-migrate --instanceof-is
--instanceof-is
replaces expressions of the form $foo instanceof Bar
with $foo is Bar
, $foo is Bar<_>
, $foo is Bar<_, _>
etc, depending on how many generics Bar
has.
This can lead to additional type errors for code that was already unsafe; for example:
class SomeClass<T> {}
function foo(SomeClass<string> $a): void {}
function bar(mixed $a): void {
if ($a instanceof SomeClass) {
foo($a); // this is unsafe, but does not raise a type error
}
if ($a is SomeClass<_>) {
foo($a); // also unsafe, but does raise a type error
}
}
If HHAST is unable to find the definition of the class, it will assume that it takes no generics.
It does not migrate expressions of the form $foo instanceof $bar
, as there is no consistent 'best' replacement; these need manually fixing.
v4.12: Support and require HHVM v4.12, add dollar-brace interpolation migration
This release:
- adapts to parser changes in HHVM 4.12
- adds
bin/hhast-migrate --dollar-brace-variable
which replaces"${var}"
with"{$var}"
v4.11.0: bugfixes and new linters
This release:
- supports HHVM 4.8-4.11
- adds a linter for grouping use statements
- adds a linter for replacing PHP array literals with vecs or dicts
- adds a linter for sorting group use statements in alphabetical order
- stability improvements for LSP (IDE) mode
- fixes wrapping of nodes in generics; for example, a
NameToken
in aList<ListItem<IExpression>>
is now wrapped in aNameExpression
, instead of the rawNameToken
being returned (which is not a validIExpression
) - supports wrapping
noreturn
as aSimpleTypeSpecifier
to implementITypeSpecifier
- removes the CallTimePassByReference migration for HHVM 3.24
v4.8.1: Support nightly builds and 4.9
This release supports additional versions of HHVM; it contains no other significant changes.