1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 08:12:40 +01:00

Capture maximum version information in php_compat_info.

Summary: Ref T5141. In order to be able to warn when deprecated functions are used, we need to be aware of from which version the functions were deprecated.

Test Plan: Ran `arc lint` and made sure no unexpected warnings were raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5141

Differential Revision: https://secure.phabricator.com/D9248
This commit is contained in:
Joshua Spence 2014-05-22 09:22:36 -07:00 committed by epriestley
parent f13aa21b8e
commit e0ee3e8a07
3 changed files with 12763 additions and 3192 deletions

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,11 @@ foreach (array('functions', 'classes', 'interfaces') as $type) {
$name = strtolower($name); $name = strtolower($name);
$versions = reset($versions); $versions = reset($versions);
list($min, $max) = $versions; list($min, $max) = $versions;
$output[$type][$name] = $min; $output[$type][$name] = array(
'min' => nonempty($min, null),
'max' => nonempty($max, null),
);
if ($type == 'functions' && isset($versions[4])) { if ($type == 'functions' && isset($versions[4])) {
$params = explode(', ', $versions[4]); $params = explode(', ', $versions[4]);
foreach ($params as $i => $version) { foreach ($params as $i => $version) {

View file

@ -456,7 +456,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$name = strtolower($node->getConcreteString()); $name = strtolower($node->getConcreteString());
$version = idx($compat_info['functions'], $name); $version = idx($compat_info['functions'], $name);
$windows = idx($compat_info['functions_windows'], $name); $windows = idx($compat_info['functions_windows'], $name);
if ($version && version_compare($version, $required, '>')) { if ($version && version_compare($version['min'], $required, '>')) {
$this->raiseLintAtNode( $this->raiseLintAtNode(
$node, $node,
self::LINT_PHP_53_FEATURES, self::LINT_PHP_53_FEATURES,
@ -489,7 +489,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$name = strtolower($node->getConcreteString()); $name = strtolower($node->getConcreteString());
$version = idx($compat_info['interfaces'], $name); $version = idx($compat_info['interfaces'], $name);
$version = idx($compat_info['classes'], $name, $version); $version = idx($compat_info['classes'], $name, $version);
if ($version && version_compare($version, $required, '>')) { if ($version && version_compare($version['min'], $required, '>')) {
$this->raiseLintAtNode( $this->raiseLintAtNode(
$node, $node,
self::LINT_PHP_53_FEATURES, self::LINT_PHP_53_FEATURES,