Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Remove usages of lval as an expression. (#196)
Browse files Browse the repository at this point in the history
Summary: required for .hhconfig disable_lval_as_an_expression.

Signed-off-by: Arthur Loiret <arthur.loiret@emerton-data.com>
  • Loading branch information
aloiret authored and fredemmott committed May 1, 2019
1 parent 5c007c9 commit b00e0ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/core/ComposableElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ final public function __getChildrenDescription(): string {
foreach ($this->children as $child) {
if ($child instanceof :xhp) {
$tmp = ':'.:xhp::class2element(get_class($child));
if ($categories = $child->__xhpCategoryDeclaration()) {
$categories = $child->__xhpCategoryDeclaration();
if (C\count($categories) > 0) {
$tmp .= '[%'.implode(',%', array_keys($categories)).']';
}
$desc[] = $tmp;
Expand Down
3 changes: 2 additions & 1 deletion src/html/XHPBaseHTMLHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function requireUniqueID(): string {
$id = /* UNSAFE_EXPR */ $this->:id;
if ($id === null || $id === '') {
try {
$this->setAttribute('id', $id = bin2hex(random_bytes(5)));
$id = bin2hex(random_bytes(5));
$this->setAttribute('id', $id);
} catch (XHPInvalidAttributeException $error) {
throw new XHPException(
'You are trying to add an HTML id to a(n) '.
Expand Down
16 changes: 8 additions & 8 deletions src/html/XHPHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ final public function transferAttributesToRenderedRoot(
foreach ($this->getAttributeNamesThatAppendValuesOnTransfer() as $attr) {
if (array_key_exists($attr, $attributes)) {
$rootAttributes = $root->getAttributes();
if (
array_key_exists($attr, $rootAttributes) &&
($rootValue = (string)$rootAttributes[$attr]) !== ''
) {
$thisValue = (string)$attributes[$attr];
if ($thisValue !== '') {
$root->setAttribute($attr, $rootValue.' '.$thisValue);
if (array_key_exists($attr, $rootAttributes)) {
$rootValue = (string)$rootAttributes[$attr];
if ($rootValue !== '') {
$thisValue = (string)$attributes[$attr];
if ($thisValue !== '') {
$root->setAttribute($attr, $rootValue.' '.$thisValue);
}
$this->removeAttribute($attr);
}
$this->removeAttribute($attr);
}
}
}
Expand Down

0 comments on commit b00e0ad

Please sign in to comment.