From ac9659c38f9aa034742909dd89d13ee61257e84d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 20 Aug 2023 09:54:07 +0200 Subject: [PATCH] [ticket/17176] Resolve psalm issues after PHP version update PHPBB3-17176 --- phpBB/phpbb/db/driver/driver.php | 2 +- phpBB/phpbb/db/driver/driver_interface.php | 4 ++-- phpBB/phpbb/db/driver/factory.php | 2 +- phpBB/phpbb/db/driver/postgres.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php index 6c86433dd9..61a2044040 100644 --- a/phpBB/phpbb/db/driver/driver.php +++ b/phpBB/phpbb/db/driver/driver.php @@ -1330,7 +1330,7 @@ abstract class driver implements driver_interface /** * {@inheritDoc} */ - public function clean_query_id($query_id) + public function clean_query_id(mixed $query_id): int|string { // Some DBMS functions accept/return objects and/or resources instead if identifiers // Attempting to use objects/resources as array keys will throw error, hence correctly handle all cases diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php index e85e0d19a8..0f90f5fdeb 100644 --- a/phpBB/phpbb/db/driver/driver_interface.php +++ b/phpBB/phpbb/db/driver/driver_interface.php @@ -499,9 +499,9 @@ interface driver_interface /** * Ensure query ID can be used by cache * - * @param resource|int|string $query_id Mixed type query id + * @param mixed $query_id Mixed type query id * * @return int|string Query id in string or integer format */ - public function clean_query_id($query_id); + public function clean_query_id(mixed $query_id): int|string; } diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php index a5adae6a90..4aaf52902d 100644 --- a/phpBB/phpbb/db/driver/factory.php +++ b/phpBB/phpbb/db/driver/factory.php @@ -478,7 +478,7 @@ class factory implements driver_interface /** * {@inheritDoc} */ - public function clean_query_id($query_id) + public function clean_query_id(mixed $query_id): int|string { return $this->get_driver()->clean_query_id($query_id); } diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 3d981bc9c7..31137634fe 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -432,7 +432,7 @@ class postgres extends \phpbb\db\driver\driver protected function _sql_close(): bool { // Released resources are already closed, return true in this case - if (!is_resource($this->db_connect_id)) + if (!$this->db_connect_id instanceof \PgSql\Connection) { return true; }