Fix formatting

This commit is contained in:
Alexander Makarov
2020-08-07 00:55:24 +03:00
parent 7a87960b99
commit 464158a78a
5 changed files with 27 additions and 27 deletions

View File

@@ -94,15 +94,15 @@
"pear/archive_tar": "~1.4.6"
},
"extra": {
"composer-exit-on-patch-failure": true,
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "./tests/phpunit_php7.patch",
"composer-exit-on-patch-failure": true,
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7 compatibility": "./tests/phpunit_php7.patch",
"Fix PHP 8 compatibility": "./tests/phpunit_php8.patch"
}
}
}
}
}
}
}

View File

@@ -129,11 +129,11 @@ abstract class CConsoleCommand extends CComponent
$name=$param->getName();
if(isset($options[$name]))
{
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray = $param->getType() && $param->getType()->getName() === 'array';
} else {
$isArray = $param->isArray();
}
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray=$param->getType() && $param->getType()->getName()==='array';
} else {
$isArray = $param->isArray();
}
if($isArray)
$params[]=is_array($options[$name]) ? $options[$name] : array($options[$name]);

View File

@@ -53,7 +53,7 @@ class CPropertyValue
public static function ensureBoolean($value)
{
if (is_string($value))
return !strcasecmp($value,'true') || ($value != 0 && $value !== '' && is_numeric($value));
return !strcasecmp($value,'true') || ($value!=0 && $value!=='' && is_numeric($value));
else
return (boolean)$value;
}

View File

@@ -94,10 +94,10 @@ abstract class CAction extends CComponent implements IAction
$name=$param->getName();
if(isset($params[$name]))
{
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray = $param->getType() && $param->getType()->getName() === 'array';
} else {
$isArray = $param->isArray();
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray=$param->getType() && $param->getType()->getName()==='array';
} else {
$isArray=$param->isArray();
}
if($isArray)

View File

@@ -571,13 +571,13 @@ class CHtmlTest extends CTestCase
array(array('v1'),0.0,'defaultValue','v1'),
);
// create_function is not supported by CHtml::value(), we're just testing this feature/property
if(version_compare(PHP_VERSION,'8.0','<')) {
$result=array_merge($result, array(
array(array('k1' => 'v1', 'k2' => 'v2', 'v3', 'v4'), create_function('$model', 'return $model["k2"];'), null, null),
array((object)array('k1' => 'v1', 'k2' => 'v2', 'v3', 'v4'), create_function('$model', 'return $model->k2;'), null, null),
));
}
// create_function is not supported by CHtml::value(), we're just testing this feature/property
if(version_compare(PHP_VERSION,'8.0','<')) {
$result=array_merge($result, array(
array(array('k1' => 'v1', 'k2' => 'v2', 'v3', 'v4'), create_function('$model', 'return $model["k2"];'), null, null),
array((object)array('k1' => 'v1', 'k2' => 'v2', 'v3', 'v4'), create_function('$model', 'return $model->k2;'), null, null),
));
}
if(class_exists('Closure',false))
{