Skip to content

Commit

Permalink
Update deprecated isArray() method in Controller.php (yiisoft#20156)
Browse files Browse the repository at this point in the history
  • Loading branch information
creativebash authored May 16, 2024
1 parent 391997a commit f2ea9be
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions framework/web/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,9 @@ public function bindActionParams($action, $params)
foreach ($method->getParameters() as $param) {
$name = $param->getName();
if (array_key_exists($name, $params)) {
$isValid = true;
if (PHP_VERSION_ID >= 80000) {
$isArray = ($type = $param->getType()) instanceof \ReflectionNamedType && $type->getName() === 'array';
} else {
$isArray = $param->isArray();
}
$isValid = true;
$isArray = ($type = $param->getType()) instanceof \ReflectionNamedType && $type->getName() === 'array';

if ($isArray) {
$params[$name] = (array)$params[$name];
} elseif (is_array($params[$name])) {
Expand Down

0 comments on commit f2ea9be

Please sign in to comment.