in src/core/Node.hack [286:306]
final public function getAttribute(string $attr): mixed {
// Return the attribute if it's there
if (C\contains_key($this->attributes, $attr)) {
return $this->attributes[$attr];
}
if (!ReflectionXHPAttribute::isSpecial($attr)) {
// Get the declaration
$decl = static::__xhpReflectionAttribute($attr);
if ($decl === null) {
throw new \Facebook\XHP\AttributeNotSupportedException($this, $attr);
} else if ($decl->isRequired()) {
throw new \Facebook\XHP\AttributeRequiredException($this, $attr);
} else {
return $decl->getDefaultValue();
}
} else {
return null;
}
}