1
0
Fork 0

PHP version checks tweaking

pull/4003/head
Possum 2015-05-05 20:18:24 +02:00
parent 13a3349603
commit 29ca21f30e
10 changed files with 13 additions and 13 deletions

View File

@ -112,7 +112,7 @@ class ClassMapGenerator
*/
private static function findClasses($path)
{
$extraTypes = version_compare(PHP_VERSION, '5.4', '<') ? '' : '|trait';
$extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
$extraTypes .= '|enum';
}

View File

@ -377,11 +377,11 @@ EOT
$errors['ioncube'] = ioncube_loader_version();
}
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
if (PHP_VERSION_ID < 50302) {
$errors['php'] = PHP_VERSION;
}
if (!isset($errors['php']) && version_compare(PHP_VERSION, '5.3.4', '<')) {
if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
$warnings['php'] = PHP_VERSION;
}

View File

@ -548,7 +548,7 @@ EOT
}
// php <5.3.3 has a very broken email validator, so bypass checks
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
if (PHP_VERSION_ID < 50303) {
return true;
}

View File

@ -90,7 +90,7 @@ class Application extends BaseApplication
{
$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
if (PHP_VERSION_ID < 50302) {
$this->getIO()->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
}

View File

@ -182,7 +182,7 @@ class JsonFile
*/
public static function encode($data, $options = 448)
{
if (version_compare(PHP_VERSION, '5.4', '>=')) {
if (PHP_VERSION_ID >= 50400) {
$json = json_encode($data, $options);
if (false === $json) {
self::throwEncodeError(json_last_error());

View File

@ -214,7 +214,7 @@ class RemoteFilesystem
}
if ($decode) {
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
if (PHP_VERSION_ID >= 50400) {
$result = zlib_decode($result);
} else {
// work around issue with gzuncompress & co that do not work with all gzip checksums

View File

@ -96,7 +96,7 @@ final class StreamContextFactory
// add SNI opts for https URLs
if ('https' === parse_url($url, PHP_URL_SCHEME)) {
$options['ssl']['SNI_enabled'] = true;
if (version_compare(PHP_VERSION, '5.6.0', '<')) {
if (PHP_VERSION_ID < 50600) {
$options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
}
}

View File

@ -64,7 +64,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
array(__DIR__.'/Fixtures/template', array()),
);
if (version_compare(PHP_VERSION, '5.4', '>=')) {
if (PHP_VERSION_ID >= 50400) {
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',

View File

@ -150,7 +150,7 @@ class JsonFileTest extends \PHPUnit_Framework_TestCase
public function testUnicode()
{
if (!function_exists('mb_convert_encoding') && version_compare(PHP_VERSION, '5.4', '<')) {
if (!function_exists('mb_convert_encoding') && PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test requires the mbstring extension');
}
@ -164,7 +164,7 @@ class JsonFileTest extends \PHPUnit_Framework_TestCase
public function testOnlyUnicode()
{
if (!function_exists('mb_convert_encoding') && version_compare(PHP_VERSION, '5.4', '<')) {
if (!function_exists('mb_convert_encoding') && PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test requires the mbstring extension');
}

View File

@ -146,7 +146,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
'SNI_server_name' => 'example.org'
)
);
if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
if (PHP_VERSION_ID >= 50600) {
unset($expected['ssl']['SNI_server_name']);
}
$this->assertEquals($expected, $options);
@ -176,7 +176,7 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
'SNI_server_name' => 'example.org'
)
);
if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
if (PHP_VERSION_ID >= 50600) {
unset($expected['ssl']['SNI_server_name']);
}
$this->assertEquals($expected, $options);