Summary: Binary integers (such as `0b1`) were added to PHP 5.4 and cannot be used in earlier versions.
Test Plan: Added a test case.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14643
'$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) {
}
}
+0b1;
+
~~~~~~~~~~
error:3:5
error:4:9
error:12:7
error:18:7
+error:23:1
~~~~~~~~~~
~~~~~~~~~~
{