mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Update PHP compat info
Summary: Also warn against functions not available on Windows at all. Test Plan: Compared old and new file. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5975
This commit is contained in:
parent
0b8e9823fa
commit
eb449a40b4
3 changed files with 291 additions and 8 deletions
File diff suppressed because one or more lines are too long
|
@ -29,8 +29,8 @@ foreach (array('functions', 'classes', 'interfaces') as $type) {
|
|||
if (version_compare($min, $required) > 0) {
|
||||
$output[$type][$name] = $min;
|
||||
}
|
||||
if ($type == 'functions' && isset($versions[2])) {
|
||||
$params = explode(', ', $versions[2]);
|
||||
if ($type == 'functions' && isset($versions[4])) {
|
||||
$params = explode(', ', $versions[4]);
|
||||
foreach ($params as $i => $version) {
|
||||
if (version_compare($version, $required) > 0) {
|
||||
$output['params'][$name][$i] = $version;
|
||||
|
@ -71,6 +71,6 @@ $output['functions_windows'] = array(
|
|||
|
||||
file_put_contents(
|
||||
phutil_get_library_root('arcanist').'/../'.$target,
|
||||
json_encode($output));
|
||||
id(new PhutilJSON())->encodeFormatted($output));
|
||||
|
||||
echo "Done.\n";
|
||||
|
|
|
@ -420,7 +420,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
$node = $call->getChildByIndex(0);
|
||||
$name = strtolower($node->getConcreteString());
|
||||
$version = idx($compat_info['functions'], $name);
|
||||
$windows_version = idx($compat_info['functions_windows'], $name);
|
||||
$windows = idx($compat_info['functions_windows'], $name);
|
||||
if ($version) {
|
||||
$this->raiseLintAtNode(
|
||||
$node,
|
||||
|
@ -439,13 +439,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
|||
"of `{$name}()` was not introduced until PHP {$version}.");
|
||||
}
|
||||
}
|
||||
} else if (version_compare($windows_version, '5.3.0') > 0) {
|
||||
} else if ($windows === '' || version_compare($windows, '5.3.0') > 0) {
|
||||
$this->raiseLintAtNode(
|
||||
$node,
|
||||
self::LINT_PHP_53_FEATURES,
|
||||
"This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ".
|
||||
"available there.".
|
||||
($windows_version ? " until PHP {$windows_version}" : "").".");
|
||||
"available there".
|
||||
($windows ? " until PHP {$windows}" : "").".");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue