4.33.7: various XHP migrations
Added hhast-migrate --add-xhp-children-declaration-method
This uses the new child validation approach supported in xhp-lib v3.1. For example, it replaces:
class :test:nested-rule extends :x:element {
children (:div | (:code+));
}
... with this:
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>()),
);
}
The trait adds a runtime check that the old and new declaration are consistent
Add hhast-migrate --remove-xhp-child-declarations
This removes children
declarations, and if an XHPChildDeclarationConsistencyValidation
trait is present, replaces it with XHPChildValidation
hhast-migrate --add-xhp-children-declaration-method
should generally be used first to add the new declaration, and allow runtime testing to ensure the new version is equivalent.
Add hhast-migrate --demangle-xhp-class-names
This replaces -
in XHP class names in _
; this is not yet required - is is preparatory work for XHP namespace support.