mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-18 22:17:00 +01:00
Handle ReflectionParameter::isArray() deprecation in PHP 8
This commit is contained in:
@@ -129,7 +129,13 @@ abstract class CConsoleCommand extends CComponent
|
||||
$name=$param->getName();
|
||||
if(isset($options[$name]))
|
||||
{
|
||||
if($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]);
|
||||
elseif(!is_array($options[$name]))
|
||||
$params[]=$options[$name];
|
||||
|
||||
Reference in New Issue
Block a user