From f3760f138dcbaf7a2190336a0378cf1b2190c9f5 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 17 Apr 2023 08:30:21 +0200 Subject: Complete PHPStan Level 6 (#5305) * Complete PHPStan Level 6 Fix https://github.com/FreshRSS/FreshRSS/issues/4112 And initiate PHPStan Level 7 * PHPStan Level 6 for tests * Use phpstan/phpstan-phpunit * Update to PHPStan version 1.10 * Fix mixed bug * Fix mixed return bug * Fix paginator bug * Fix FreshRSS_UserConfiguration * A couple more Minz_Configuration bug fixes * A few trivial PHPStan Level 7 fixes * A few more simple PHPStan Level 7 * More files passing PHPStan Level 7 Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251 * A few more PHPStan Level 7 preparations * A few last details --- lib/lib_install.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/lib_install.php') diff --git a/lib/lib_install.php b/lib/lib_install.php index 18f4a732a..23c902440 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -1,7 +1,7 @@ */ function checkRequirements(string $dbType = ''): array { @@ -76,7 +76,7 @@ function checkRequirements(string $dbType = ''): array { } function generateSalt(): string { - return sha1(uniqid('' . mt_rand(), true).implode('', stat(__FILE__))); + return sha1(uniqid('' . mt_rand(), true).implode('', stat(__FILE__) ?: [])); } function initDb(): string { @@ -88,10 +88,14 @@ function initDb(): string { $db['pdo_options'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $conf->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property" + if (empty($db['type'])) { + $db['type'] = 'sqlite'; + } + //Attempt to auto-create database if it does not already exist if ($db['type'] !== 'sqlite') { Minz_ModelPdo::$usesSharedPdo = false; - $dbBase = isset($db['base']) ? $db['base'] : ''; + $dbBase = $db['base'] ?? ''; //For first connection, use default database for PostgreSQL, empty database for MySQL / MariaDB: $db['base'] = $db['type'] === 'pgsql' ? 'postgres' : ''; $conf->db = $db; -- cgit v1.2.3