mirror of
https://github.com/openvk/openvk
synced 2024-11-15 11:39:13 +03:00
thx celestora <3
This commit is contained in:
parent
31f0d184e7
commit
5fae56f6bf
1 changed files with 4 additions and 24 deletions
|
@ -236,30 +236,10 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
try {
|
||||
// Проверка типа параметра
|
||||
$type = $parameter->getType();
|
||||
if ($type && !$type->isBuiltin()) {
|
||||
$params[] = $val; // Пользовательские типы оставляем как есть
|
||||
} else if (is_null($val)) {
|
||||
$params[] = $val; // Если значение NULL, то оставляем его NULL
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
if (($type && !$type->isBuiltin()) || is_null($val))
|
||||
$params[] = $val;
|
||||
else
|
||||
$params[] = settype($val, $type->getName());
|
||||
} catch (\Throwable $e) {
|
||||
// Just ignore the exception, since
|
||||
// some args are intended for internal use
|
||||
|
|
Loading…
Reference in a new issue