From 0f19cc1b2cc63d1d4cc4c34bf5b121ef6c8d95b7 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Mon, 4 Sep 2023 13:29:59 +0200 Subject: [PATCH] Connection: Fix argument & variable type hint --- phpstan-baseline.neon | 20 -------------------- src/Connection.php | 5 +++-- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5107fd0..b18f68b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -125,11 +125,6 @@ parameters: count: 1 path: src/Connection.php - - - message: "#^Method ipl\\\\Sql\\\\Connection\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type iterable\\.$#" - count: 1 - path: src/Connection.php - - message: "#^Method ipl\\\\Sql\\\\Connection\\:\\:delete\\(\\) has parameter \\$table with no value type specified in iterable type array\\.$#" count: 1 @@ -215,11 +210,6 @@ parameters: count: 1 path: src/Connection.php - - - message: "#^Method ipl\\\\Sql\\\\Connection\\:\\:prepexec\\(\\) has parameter \\$values with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Connection.php - - message: "#^Method ipl\\\\Sql\\\\Connection\\:\\:update\\(\\) has parameter \\$data with no value type specified in iterable type iterable\\.$#" count: 1 @@ -270,16 +260,6 @@ parameters: count: 1 path: src/Connection.php - - - message: "#^Parameter \\#2 \\$values of method ipl\\\\Sql\\\\Connection\\:\\:prepexec\\(\\) expects array\\|string\\|null, mixed given\\.$#" - count: 1 - path: src/Connection.php - - - - message: "#^Parameter \\#2 \\$values of method ipl\\\\Sql\\\\Connection\\:\\:yieldPairs\\(\\) expects array\\|null, mixed given\\.$#" - count: 1 - path: src/Connection.php - - message: "#^Property ipl\\\\Sql\\\\Connection\\:\\:\\$adapter \\(ipl\\\\Sql\\\\Contract\\\\Adapter\\) does not accept object\\.$#" count: 1 diff --git a/src/Connection.php b/src/Connection.php index de84c72..6238693 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -35,7 +35,7 @@ class Connection implements Quoter * * {@link init()} is called after construction. * - * @param Config|iterable $config + * @param Config|iterable $config * * @throws InvalidArgumentException If there's no adapter for the given database available */ @@ -302,6 +302,7 @@ public function yieldAll($stmt, ...$args) if (! empty($args)) { if (is_array($args[0])) { + /** @var array $values */ $values = array_shift($args); } } @@ -382,7 +383,7 @@ public function yieldPairs($stmt, array $values = null) * Prepare and execute the given statement * * @param Delete|Insert|Select|Update|string $stmt The SQL statement to prepare and execute - * @param string|array $values Values to bind to the statement, if any + * @param null|string|array $values Values to bind to the statement, if any * * @return PDOStatement */