Skip to content

Commit

Permalink
Connection: Add var type hint to help pghpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Mar 22, 2024
1 parent 6daef3a commit f0b8418
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ public function __call($name, array $arguments)
{
$this->connect();

if (! method_exists($this->pdo, $name)) {
/** @var PDO $pdo */
$pdo = $this->pdo;
if (! method_exists($pdo, $name)) {
$class = get_class($this);
$message = "Call to undefined method $class::$name";

throw new BadMethodCallException($message);
}

return call_user_func_array([$this->pdo, $name], $arguments);
/** @var callable $callback */
$callback = [$this->pdo, $name];

return call_user_func_array($callback, $arguments);
}

/**
Expand Down Expand Up @@ -211,7 +216,7 @@ public function ping($reconnect = true)
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchAll($stmt, array $values = null)
{
Expand All @@ -225,7 +230,7 @@ public function fetchAll($stmt, array $values = null)
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchCol($stmt, array $values = null)
{
Expand Down Expand Up @@ -264,7 +269,7 @@ public function fetchRow($stmt, array $values = null)
* @param Select|string $stmt The SQL statement to prepare and execute.
* @param array $values Values to bind to the statement
*
* @return array
* @return array|false
*/
public function fetchPairs($stmt, array $values = null)
{
Expand Down

0 comments on commit f0b8418

Please sign in to comment.