Releases: hhvm/xhp-lib
4.0.0: namespace support, syntax changes
This release contains many substantial changes, and should be used in coordination with HHVM 4.73 or later; for details, see the announcement blog post
v4.0.0rc2: compatibility updates, bugfixes, and deprecations
- This release is compatible with HHVM 4.72
- It is intended to ban mutations after render; v4.0.0rc1 unintentionally also banned mutations during render
- made use-after-render exceptions clearer
- removed
HasXHPAttributeClobbering_DEPRECATED
; use attribute splat instead - corrected HTML attribute categories; this is a breaking change as some have been removed
- renamed
UnsafeAttributeValue
toUnsafeAttributeValue_DEPRECATED
andforceAttribute
toforceAttribute_DEPRECATED
, as the are - by design - holes in the type system. They will be removed in a future release
v4.0.0rc1: new syntax, namespace support, modernization
This is a major new release; the most significant changes include:
- new
xhp class foo
syntax, replacingclass :foo
- XHP classes can be declared in namespaces
- XHP classes can be used from namespaced code - the
:
character is treated as a namespace separator when instantiating classes - XHP class names are no longer mangled;
xhp class foo
actually declares a runtime class calledfoo
, notxhp_foo
- the
children
declaration is no longer supported; the approach introduced with 3.1 is now required - the
category
declaration is no longer supported; interfaces are used instead - all classes are now namespaced, including the HTML tags
This release currently requires:
disable_xhp_element_mangling=true
andenable_xhp_class_modifier=true
in.hhconfig
hhvm.hack.lang.enable_xhp_class_modifier=true
andhhvm.hack.lang.disable_xhp_element_mangling=true
in your HHVM configuration, including when generating the autoload map, running HHAST, etc.
Before the final release, expect:
- through migration instructions
- the defaults to change in HHVM so the above configuration is no longer required; this will effectively make XHP-Lib v4 the standard XHP-Lib for new HHVM releases
3.2.1: support HHVM 4.44+
Does not break backwards compatibility, HHVM 4.32+ is still supported.
v3.2.0: support type-assert v4, require HHVM 4.32
This release:
- permits either type-assert v3 or v4
- requires HHVM 4.32 or above; older versions of HHVM are themselves unsupported.
3.1.1: support new children declaration traits in any subclass of :x:composable-element
This allows subclasses of :x:primitive
to also migrate their child declarations
v3.1: experimental alternative interface for child validation
We are hoping to remove child validation as a language-level feature, replacing it with a new implementation
built on top of more general-purpose language features. This release adds such an alternative, though we do not yet consider it a stable part of the XHP-Lib API.
The current syntax is rarely used, and inconsistent with the rest of the language - both in terms of syntax and in terms of typechecker behavior. We believe removing it will make the language easier to use.
We hope this release will enable experimentation and for work on automated migration; if successful, we aim to stabilize the API and remove the language feature.
This release adds two traits:
XHPChildDeclarationConsistencyValidation
: requires that the element have consistent old- and new- style child declarationsXHPChildValidation
: uses new-style validation, and requires that the element does not have an old-style declaration
Both of these traits define abstract protected static function getChildrenDeclaration(): Facebook\XHP\ChildValidation\Constraint {}
- this static method must be implemented by any concrete classes using the traits.
Constraints are designed to be a full-featured replacement for the existing language feature, and created through factory functions
The unit tests contain many examples; this class is representative:
class :test:nested-rule extends :x:element {
use XHPChildDeclarationConsistencyValidation;
children (:div | (:code+));
// this is equivalent to the previous declaration
protected static function getChildrenDeclaration(): XHPChild\Constraint {
return XHPChild\anyOf(
XHPChild\ofType<:div>(),
XHPChild\atLeastOneOf(XHPChild\ofType<:code>()),
);
}
v3.0.2: allow hhvm-autoload 3.0
allow hhvm-autoload 3.0
3.0.1: compatibility update
This release adds an additional FIXME required for compatibility with current nightly builds.
Replace `Stringish` with `string` in HTML tag definitions
Stringish
is no longer a special type in Hack, so shouldn't be used for attribute definitions that allow strings.