mirror of
https://github.com/openvk/openvk
synced 2024-11-15 19:49:14 +03:00
Compare commits
No commits in common. "82fcb18c4ade03ab82ae2c32616cc69ec2bf085f" and "31f0d184e71d42ea7d02cf19d4c7efa81990872c" have entirely different histories.
82fcb18c4a
...
31f0d184e7
1 changed files with 21 additions and 3 deletions
|
@ -236,10 +236,28 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
try {
|
||||
// Проверка типа параметра
|
||||
$type = $parameter->getType();
|
||||
if (($type && !$type->isBuiltin()) || is_null($val)) {
|
||||
$params[] = $val;
|
||||
if ($type && !$type->isBuiltin()) {
|
||||
$params[] = $val; // Пользовательские типы оставляем как есть
|
||||
} else if (is_null($val)) {
|
||||
$params[] = $val; // Если значение NULL, то оставляем его NULL
|
||||
} else {
|
||||
settype($val, $parameter->getType()->getName());
|
||||
switch ($type->getName()) {
|
||||
case 'int':
|
||||
$val = (int)$val;
|
||||
break;
|
||||
case 'float':
|
||||
$val = (float)$val;
|
||||
break;
|
||||
case 'bool':
|
||||
$val = (bool)$val;
|
||||
break;
|
||||
case 'string':
|
||||
$val = (string)$val;
|
||||
break;
|
||||
// Добавить другие типы при необходимости
|
||||
default:
|
||||
settype($val, $type->getName());
|
||||
}
|
||||
$params[] = $val;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
|
|
Loading…
Reference in a new issue