Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282617
update_compat_info.php
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
update_compat_info.php
View Options
#!/usr/bin/env php
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require_once
dirname
(
__FILE__
)
.
'/__init_script__.php'
;
$target
=
'resources/php_compat_info.json'
;
echo
"Purpose: Updates {$target} used by ArcanistXHPASTLinter.\n"
;
$ok
=
include
'PHP/CompatInfo/Autoload.php'
;
if
(
!
$ok
)
{
echo
"You need PHP_CompatInfo available in 'include_path'.\n"
;
echo
"http://php5.laurent-laville.org/compatinfo/\n"
;
exit
(
1
)
;
}
$required
=
'5.2.3'
;
$reference
=
id
(
new
PHP_CompatInfo_Reference_ALL
(
)
)
->
getAll
(
)
;
$output
=
array
(
)
;
$output
[
'@'
.
'generated'
]
=
true
;
$output
[
'params'
]
=
array
(
)
;
foreach
(
array
(
'functions'
,
'classes'
,
'interfaces'
)
as
$type
)
{
$output
[
$type
]
=
array
(
)
;
foreach
(
$reference
[
$type
]
as
$name
=>
$versions
)
{
$name
=
strtolower
(
$name
)
;
$versions
=
reset
(
$versions
)
;
list
(
$min
,
$max
)
=
$versions
;
if
(
version_compare
(
$min
,
$required
)
>
0
)
{
$output
[
$type
]
[
$name
]
=
$min
;
}
if
(
$type
==
'functions'
&&
isset
(
$versions
[
2
]
)
)
{
$params
=
explode
(
', '
,
$versions
[
2
]
)
;
foreach
(
$params
as
$i
=>
$version
)
{
if
(
version_compare
(
$version
,
$required
)
>
0
)
{
$output
[
'params'
]
[
$name
]
[
$i
]
=
$version
;
}
}
}
}
}
file_put_contents
(
dirname
(
__FILE__
)
.
'/../'
.
$target
,
json_encode
(
$output
)
)
;
echo
"Done.\n"
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 09:43 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1202002
Default Alt Text
update_compat_info.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment