From ae203ed56d53569e01760ebd9b724b38b53fc6ba Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Thu, 26 Feb 2026 23:08:00 +0000 Subject: [PATCH] Change return type of detectCompression Signed-off-by: Kamil Tekiela --- phpstan-baseline.neon | 12 ------------ psalm-baseline.xml | 6 ------ src/File.php | 8 ++++---- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 52c0f259f7..db96291887 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6075,12 +6075,6 @@ parameters: count: 2 path: src/File.php - - - message: '#^Method PhpMyAdmin\\File\:\:getCompression\(\) should return string but returns string\|false\.$#' - identifier: return.type - count: 1 - path: src/File.php - - message: '#^Only booleans are allowed in a negated boolean, resource\|false given\.$#' identifier: booleanNot.exprNotBoolean @@ -6111,12 +6105,6 @@ parameters: count: 4 path: src/File.php - - - message: '#^Switch condition type \(string\) does not match case condition false \(false\)\.$#' - identifier: switch.type - count: 1 - path: src/File.php - - message: ''' #^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\: diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 588a1d5663..bea15ce1fb 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -4121,9 +4121,6 @@ - - compression ?? $this->detectCompression()]]> - @@ -4131,9 +4128,6 @@ - - - handle]]> diff --git a/src/File.php b/src/File.php index b764322102..7ff170d165 100644 --- a/src/File.php +++ b/src/File.php @@ -400,13 +400,13 @@ final class File /** * Detects what compression the file uses * - * @return string|false false on error, otherwise string MIME type of + * @return string empty string on error, otherwise string MIME type of * compression, none for none * * @todo move file read part into readChunk() or getChunk() * @todo add support for compression plugins */ - private function detectCompression(): string|false + private function detectCompression(): string { // suppress warnings from being displayed, but not from being logged // f.e. any file access outside of open_basedir will issue a warning @@ -417,7 +417,7 @@ final class File if (! $file) { $this->errorMessage = Message::error(__('File could not be read!')); - return false; + return ''; } $this->compression = Util::getCompressionMimeType($file); @@ -484,7 +484,7 @@ final class File } switch ($this->getCompression()) { - case false: + case '': return false; case 'application/bzip2':