From 487d88e6ae60b505a8f6d8f6e150d131ddf472ed Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sun, 15 Dec 2024 23:42:53 -0500 Subject: [PATCH] Restore fix and suppress phpstan --- phpstan-baseline.neon | 6 ++++++ src/Db/Adapter/SqliteAdapter.php | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 362adcc8..ed5f2611 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -96,6 +96,12 @@ parameters: count: 1 path: src/Db/Adapter/SqliteAdapter.php + - + message: '#^Strict comparison using \!\=\= between Cake\\Database\\StatementInterface and null will always evaluate to true\.$#' + identifier: notIdentical.alwaysTrue + count: 1 + path: src/Db/Adapter/SqliteAdapter.php + - message: '#^PHPDoc tag @return with type Phinx\\Db\\Adapter\\AdapterInterface is not subtype of native type Migrations\\Db\\Adapter\\AdapterInterface\.$#' identifier: return.phpDocType diff --git a/src/Db/Adapter/SqliteAdapter.php b/src/Db/Adapter/SqliteAdapter.php index cb43cc38..09fa5c24 100644 --- a/src/Db/Adapter/SqliteAdapter.php +++ b/src/Db/Adapter/SqliteAdapter.php @@ -332,7 +332,10 @@ protected function resolveTable(string $tableName): array "SELECT name FROM {$master} WHERE type = 'table' AND lower(name) = ?", [$table] ); - $rows = $result->fetchAll('assoc'); + // null on error + if ($result !== null) { + $rows = $result->fetchAll('assoc'); + } } catch (PDOException $e) { // an exception can occur if the schema part of the table refers to a database which is not attached break;