Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 93 lines (82 sloc) 2.608 kb
67c772d Warn about PHP 5.3 only functions and parameters
vrana authored
1 #!/usr/bin/env php
2 <?php
3
4 /*
5 * Copyright 2012 Facebook, Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20 require_once dirname(__FILE__).'/__init_script__.php';
21
22 $target = 'resources/php_compat_info.json';
23 echo "Purpose: Updates {$target} used by ArcanistXHPASTLinter.\n";
24
25 $ok = include 'PHP/CompatInfo/Autoload.php';
26 if (!$ok) {
27 echo "You need PHP_CompatInfo available in 'include_path'.\n";
28 echo "http://php5.laurent-laville.org/compatinfo/\n";
29 exit(1);
30 }
31
32 $required = '5.2.3';
33 $reference = id(new PHP_CompatInfo_Reference_ALL())->getAll();
34
35 $output = array();
36 $output['@'.'generated'] = true;
37 $output['params'] = array();
38
39 foreach (array('functions', 'classes', 'interfaces') as $type) {
40 $output[$type] = array();
41 foreach ($reference[$type] as $name => $versions) {
42 $name = strtolower($name);
43 $versions = reset($versions);
44 list($min, $max) = $versions;
45 if (version_compare($min, $required) > 0) {
46 $output[$type][$name] = $min;
47 }
48 if ($type == 'functions' && isset($versions[2])) {
49 $params = explode(', ', $versions[2]);
50 foreach ($params as $i => $version) {
51 if (version_compare($version, $required) > 0) {
52 $output['params'][$name][$i] = $version;
53 }
54 }
55 }
56 }
57 }
58
c8687a0 Lint functions not available on Windows on PHP 5.2
vrana authored
59 // Grepped from PHP Manual.
60 $output['functions_windows'] = array(
61 'apache_child_terminate' => '',
62 'chroot' => '',
63 'getrusage' => '',
64 'imagecreatefromxpm' => '',
65 'lchgrp' => '',
66 'lchown' => '',
67 'nl_langinfo' => '',
68 'strptime' => '',
69 'sys_getloadavg' => '',
70 'checkdnsrr' => '5.3.0',
71 'dns_get_record' => '5.3.0',
72 'fnmatch' => '5.3.0',
73 'getmxrr' => '5.3.0',
74 'getopt' => '5.3.0',
75 'imagecolorclosesthwb' => '5.3.0',
76 'inet_ntop' => '5.3.0',
77 'inet_pton' => '5.3.0',
78 'link' => '5.3.0',
79 'linkinfo' => '5.3.0',
80 'readlink' => '5.3.0',
81 'socket_create_pair' => '5.3.0',
82 'stream_socket_pair' => '5.3.0',
83 'symlink' => '5.3.0',
84 'time_nanosleep' => '5.3.0',
85 'time_sleep_until' => '5.3.0',
86 );
87
67c772d Warn about PHP 5.3 only functions and parameters
vrana authored
88 file_put_contents(
c8687a0 Lint functions not available on Windows on PHP 5.2
vrana authored
89 phutil_get_library_root('arcanist').'/../'.$target,
67c772d Warn about PHP 5.3 only functions and parameters
vrana authored
90 json_encode($output));
91
92 echo "Done.\n";
Something went wrong with that request. Please try again.