This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
Support for TypeAssert v3, disable attribute validation by default
- this release uses TypeAssert v3 instead of v2, allowing it to be used in new projects
- this release splits the API for enabling/disabling validation into separate options for child validation and attribute validation.
:xhp::$ENABLE_VALIDATION
no longer exists. - attribute validation is off by default; we aim to remove it completely from a future release
Validation changes
Enabling attribute validation
:xhp::enableAttributeValidation();
Disabling child validation
:xhp::disableChildValidation();
Motivation
- This will allow removing the dependency on
TypeAssert
in the future - The runtime validation isn't as useful now given that the typechecker validates attributes specified when instantiating XHP objects
- The runtime validation is bad for performance
- Keeping the runtime validation in sync with the typechecker has been a frequent source of issues
Caveat
As setAttribute()
is not special-cased in the typechecker, so is now completely unchecked unless validation is enabled.