Page MenuHomePhabricator

D14643.id35425.diff
No OneTemporary

D14643.id35425.diff

diff --git a/src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistPHPCompatibilityXHPASTLinterRule.php
@@ -414,6 +414,16 @@
'$this'));
}
}
+
+ $numeric_scalars = $root->selectDescendantsOfType('n_NUMERIC_SCALAR');
+ foreach ($numeric_scalars as $numeric_scalar) {
+ if (preg_match('/^0b[01]+$/i', $numeric_scalar->getConcreteString())) {
+ $this->raiseLintAtNode(
+ $numeric_scalar,
+ pht(
+ 'Binary integer literals are not available before PHP 5.4.'));
+ }
+ }
}
private function lintPHP54Incompatibilities(XHPASTNode $root) {
diff --git a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test
--- a/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test
+++ b/src/lint/linter/xhpast/rules/__tests__/php-compatibility/php54-features.lint-test
@@ -20,11 +20,14 @@
}
}
+0b1;
+
~~~~~~~~~~
error:3:5
error:4:9
error:12:7
error:18:7
+error:23:1
~~~~~~~~~~
~~~~~~~~~~
{

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 9, 3:29 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389521
Default Alt Text
D14643.id35425.diff (1 KB)

Event Timeline