Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced call_user_func_array() of a fixed method with the usage of variadic arguments #3252

Merged
merged 1 commit into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use const DB2_LONG;
use const DB2_PARAM_IN;
use function array_change_key_case;
use function call_user_func_array;
use function db2_bind_param;
use function db2_execute;
use function db2_fetch_array;
Expand Down
8 changes: 3 additions & 5 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Doctrine\DBAL\ParameterType;
use function array_combine;
use function array_fill;
use function call_user_func_array;
use function count;
use function str_repeat;

Expand Down Expand Up @@ -172,7 +171,7 @@ public function execute($params = null)
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
}
} else {
if (!call_user_func_array([$this->_stmt, 'bind_param'], [$this->types] + $this->_bindedValues)) {
if (! $this->_stmt->bind_param($this->types, ...$this->_bindedValues)) {
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
}
}
Expand Down Expand Up @@ -221,7 +220,7 @@ public function execute($params = null)
$refs[$key] =& $value;
}

if (!call_user_func_array([$this->_stmt, 'bind_result'], $refs)) {
if (! $this->_stmt->bind_result(...$refs)) {
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
}
}
Expand All @@ -242,13 +241,12 @@ private function _bindValues($values)
{
$params = [];
$types = str_repeat('s', count($values));
$params[0] = $types;

foreach ($values as &$v) {
$params[] =& $v;
}

return call_user_func_array([$this->_stmt, 'bind_param'], $params);
return $this->_stmt->bind_param($types, ...$params);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use IteratorAggregate;
use const SASQL_BOTH;
use function array_key_exists;
use function call_user_func_array;
use function func_get_args;
use function func_num_args;
use function gettype;
Expand Down Expand Up @@ -280,7 +279,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n

switch ($fetchMode) {
case FetchMode::CUSTOM_OBJECT:
while ($row = call_user_func_array([$this, 'fetch'], func_get_args())) {
while ($row = $this->fetch(...func_get_args())) {
$rows[] = $row;
}
break;
Expand Down