1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42: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:
Jakub Vrana 2013-05-22 11:36:41 -07:00
parent 0b8e9823fa
commit eb449a40b4
3 changed files with 291 additions and 8 deletions

File diff suppressed because one or more lines are too long

View file

@ -29,8 +29,8 @@ foreach (array('functions', 'classes', 'interfaces') as $type) {
if (version_compare($min, $required) > 0) { if (version_compare($min, $required) > 0) {
$output[$type][$name] = $min; $output[$type][$name] = $min;
} }
if ($type == 'functions' && isset($versions[2])) { if ($type == 'functions' && isset($versions[4])) {
$params = explode(', ', $versions[2]); $params = explode(', ', $versions[4]);
foreach ($params as $i => $version) { foreach ($params as $i => $version) {
if (version_compare($version, $required) > 0) { if (version_compare($version, $required) > 0) {
$output['params'][$name][$i] = $version; $output['params'][$name][$i] = $version;
@ -71,6 +71,6 @@ $output['functions_windows'] = array(
file_put_contents( file_put_contents(
phutil_get_library_root('arcanist').'/../'.$target, phutil_get_library_root('arcanist').'/../'.$target,
json_encode($output)); id(new PhutilJSON())->encodeFormatted($output));
echo "Done.\n"; echo "Done.\n";

View file

@ -420,7 +420,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$node = $call->getChildByIndex(0); $node = $call->getChildByIndex(0);
$name = strtolower($node->getConcreteString()); $name = strtolower($node->getConcreteString());
$version = idx($compat_info['functions'], $name); $version = idx($compat_info['functions'], $name);
$windows_version = idx($compat_info['functions_windows'], $name); $windows = idx($compat_info['functions_windows'], $name);
if ($version) { if ($version) {
$this->raiseLintAtNode( $this->raiseLintAtNode(
$node, $node,
@ -439,13 +439,13 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
"of `{$name}()` was not introduced until PHP {$version}."); "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( $this->raiseLintAtNode(
$node, $node,
self::LINT_PHP_53_FEATURES, self::LINT_PHP_53_FEATURES,
"This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ". "This codebase targets PHP 5.3.0 on Windows, but `{$name}()` is not ".
"available there.". "available there".
($windows_version ? " until PHP {$windows_version}" : "")."."); ($windows ? " until PHP {$windows}" : "").".");
} }
} }