Page MenuHomePhabricator

D12294.id29520.diff
No OneTemporary

D12294.id29520.diff

diff --git a/src/parser/xhpast/api/XHPASTNode.php b/src/parser/xhpast/api/XHPASTNode.php
--- a/src/parser/xhpast/api/XHPASTNode.php
+++ b/src/parser/xhpast/api/XHPASTNode.php
@@ -3,8 +3,10 @@
final class XHPASTNode extends AASTNode {
public function isStaticScalar() {
- return ($this->getTypeName() == 'n_STRING_SCALAR' ||
- $this->getTypeName() == 'n_NUMERIC_SCALAR');
+ return in_array($this->getTypeName(), array(
+ 'n_STRING_SCALAR',
+ 'n_NUMERIC_SCALAR',
+ ));
}
public function getDocblockToken() {
@@ -55,7 +57,7 @@
case 'null':
return null;
default:
- throw new Exception('Unrecognized symbol name.');
+ throw new Exception(pht('Unrecognized symbol name.'));
}
break;
case 'n_UNARY_PREFIX_EXPRESSION':
@@ -69,7 +71,8 @@
return $operand->evalStatic();
break;
default:
- throw new Exception('Unexpected operator in static expression.');
+ throw new Exception(
+ pht('Unexpected operator in static expression.'));
}
break;
case 'n_ARRAY_LITERAL':
@@ -141,7 +144,7 @@
break;
default:
- throw new Exception('Unexpected type '.$this->getTypeName().'.');
+ throw new Exception(pht('Unexpected type %s.', $this->getTypeName()));
}
// We extract just the variable names and ignore properties and array keys.
diff --git a/src/parser/xhpast/api/XHPASTTree.php b/src/parser/xhpast/api/XHPASTTree.php
--- a/src/parser/xhpast/api/XHPASTTree.php
+++ b/src/parser/xhpast/api/XHPASTTree.php
@@ -14,12 +14,7 @@
return new XHPASTNode($id, $data, $tree);
}
- public function newToken(
- $id,
- $type,
- $value,
- $offset,
- AASTTree $tree) {
+ public function newToken($id, $type, $value, $offset, AASTTree $tree) {
return new XHPASTToken($id, $type, $value, $offset, $tree);
}

File Metadata

Mime Type
text/plain
Expires
Mar 8 2025, 7:43 AM (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7379273
Default Alt Text
D12294.id29520.diff (1 KB)

Event Timeline