Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15335450
D14643.id35425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14643.id35425.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D14643: Add binary integers to `ArcanistPHPCompatibilityXHPASTLinterRule`
Attached
Detach File
Event Timeline
Log In to Comment