diff --git a/source/Spiral/Core/Container.php b/source/Spiral/Core/Container.php index 433aab6..136efd8 100644 --- a/source/Spiral/Core/Container.php +++ b/source/Spiral/Core/Container.php @@ -573,17 +573,18 @@ private function assertType( } $type = $parameter->getType(); + $typeName = method_exists($type, 'getName') ? $type->getName() : (string)$type; - if ($type == 'array' && !is_array($value)) { + if ($typeName == 'array' && !is_array($value)) { throw new ArgumentException($parameter, $context); } - if (($type == 'int' || $type == 'float') && !is_numeric($value)) { + if (($typeName == 'int' || $typeName == 'float') && !is_numeric($value)) { throw new ArgumentException($parameter, $context); } - if ($type == 'bool' && !is_bool($value) && !is_numeric($value)) { + if ($typeName == 'bool' && !is_bool($value) && !is_numeric($value)) { throw new ArgumentException($parameter, $context); } } -} \ No newline at end of file +}