mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-08 16:02:39 +01:00
Lint functions not available on Windows on PHP 5.2
Summary: Also use absolute paths. Test Plan: Linted Arcanist, libphutil, Phabricator, found no false positives and one real error in [[ https://secure.phabricator.com/diffusion/PHU/browse/master/src/channel/PhutilSocketChannel.php;42d8e8447c8b5d6a$92 | PhutilSocketChannel ]]. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3504
This commit is contained in:
parent
94f684e29e
commit
c8687a0c79
3 changed files with 41 additions and 3 deletions
File diff suppressed because one or more lines are too long
|
@ -56,8 +56,37 @@ foreach (array('functions', 'classes', 'interfaces') as $type) {
|
|||
}
|
||||
}
|
||||
|
||||
// Grepped from PHP Manual.
|
||||
$output['functions_windows'] = array(
|
||||
'apache_child_terminate' => '',
|
||||
'chroot' => '',
|
||||
'getrusage' => '',
|
||||
'imagecreatefromxpm' => '',
|
||||
'lchgrp' => '',
|
||||
'lchown' => '',
|
||||
'nl_langinfo' => '',
|
||||
'strptime' => '',
|
||||
'sys_getloadavg' => '',
|
||||
'checkdnsrr' => '5.3.0',
|
||||
'dns_get_record' => '5.3.0',
|
||||
'fnmatch' => '5.3.0',
|
||||
'getmxrr' => '5.3.0',
|
||||
'getopt' => '5.3.0',
|
||||
'imagecolorclosesthwb' => '5.3.0',
|
||||
'inet_ntop' => '5.3.0',
|
||||
'inet_pton' => '5.3.0',
|
||||
'link' => '5.3.0',
|
||||
'linkinfo' => '5.3.0',
|
||||
'readlink' => '5.3.0',
|
||||
'socket_create_pair' => '5.3.0',
|
||||
'stream_socket_pair' => '5.3.0',
|
||||
'symlink' => '5.3.0',
|
||||
'time_nanosleep' => '5.3.0',
|
||||
'time_sleep_until' => '5.3.0',
|
||||
);
|
||||
|
||||
file_put_contents(
|
||||
dirname(__FILE__).'/../'.$target,
|
||||
phutil_get_library_root('arcanist').'/../'.$target,
|
||||
json_encode($output));
|
||||
|
||||
echo "Done.\n";
|
||||
|
|
|
@ -420,7 +420,8 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
|
|||
}
|
||||
|
||||
private function lintPHP53Functions($root) {
|
||||
$target = dirname(__FILE__).'/../../../resources/php_compat_info.json';
|
||||
$target = phutil_get_library_root('arcanist').
|
||||
'/../resources/php_compat_info.json';
|
||||
$compat_info = json_decode(file_get_contents($target), true);
|
||||
|
||||
$calls = $root->selectDescendantsOfType('n_FUNCTION_CALL');
|
||||
|
@ -428,6 +429,7 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
|
|||
$node = $call->getChildByIndex(0);
|
||||
$name = strtolower($node->getConcreteString());
|
||||
$version = idx($compat_info['functions'], $name);
|
||||
$windows_version = idx($compat_info['functions_windows'], $name);
|
||||
if ($version) {
|
||||
$this->raiseLintAtNode(
|
||||
$node,
|
||||
|
@ -446,6 +448,13 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
|
|||
"of `{$name}()` was not introduced until PHP {$version}.");
|
||||
}
|
||||
}
|
||||
} else if ($windows_version !== null) {
|
||||
$this->raiseLintAtNode(
|
||||
$param,
|
||||
self::LINT_PHP_53_FEATURES,
|
||||
"This codebase targets PHP 5.2.3, but `{$name}()` is not available ".
|
||||
"on Windows".
|
||||
($windows_version ? " until PHP {$windows_version}" : "").".");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue