From 0ffbe20376e893a9fee3d676e8d2a4ee4c8995e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 9 Jan 2025 16:28:55 -0300 Subject: [PATCH] Remove the compression global variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces it with Export::$compression static property. Signed-off-by: MaurĂ­cio Meneghini Fauth --- phpstan-baseline.neon | 26 ++++++------------- psalm-baseline.xml | 8 +++--- psalm.xml | 1 - src/Controllers/Export/ExportController.php | 28 ++++++++++----------- src/Export/Export.php | 5 +++- 5 files changed, 29 insertions(+), 39 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 02ec99d757..ebcd9e49e0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2689,7 +2689,7 @@ parameters: path: src/Controllers/Export/ExportController.php - - message: '#^Only booleans are allowed in an if condition, mixed given\.$#' + message: '#^Only booleans are allowed in an if condition, string given\.$#' identifier: if.condNotBoolean count: 1 path: src/Controllers/Export/ExportController.php @@ -2712,24 +2712,6 @@ parameters: count: 1 path: src/Controllers/Export/ExportController.php - - - message: '#^Parameter \#2 \$compression of method PhpMyAdmin\\Export\\Export\:\:compress\(\) expects string, mixed given\.$#' - identifier: argument.type - count: 2 - path: src/Controllers/Export/ExportController.php - - - - message: '#^Parameter \#2 \$compression of method PhpMyAdmin\\Export\\Export\:\:getFinalFilename\(\) expects string, mixed given\.$#' - identifier: argument.type - count: 2 - path: src/Controllers/Export/ExportController.php - - - - message: '#^Parameter \#2 \$compression of method PhpMyAdmin\\Export\\Export\:\:getMimeType\(\) expects string, mixed given\.$#' - identifier: argument.type - count: 1 - path: src/Controllers/Export/ExportController.php - - message: '#^Parameter \#3 \$saveFilename of method PhpMyAdmin\\Export\\Export\:\:closeFile\(\) expects string, mixed given\.$#' identifier: argument.type @@ -2754,6 +2736,12 @@ parameters: count: 2 path: src/Controllers/Export/ExportController.php + - + message: '#^Static property PhpMyAdmin\\Export\\Export\:\:\$compression \(''''\|''gzip''\|''none''\|''zip''\) does not accept string\.$#' + identifier: assign.propertyType + count: 1 + path: src/Controllers/Export/ExportController.php + - message: ''' #^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\: diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 34efc7295e..f8df632996 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1403,7 +1403,6 @@ - @@ -1429,15 +1428,18 @@ export->compress( $this->export->dumpBuffer, - $GLOBALS['compression'], + Export::$compression, $filename, )]]> export->compress( $this->export->dumpBufferObjects, - $GLOBALS['compression'], + Export::$compression, $filename, )]]> + + getParsedBodyParamAsString('compression')]]> + diff --git a/psalm.xml b/psalm.xml index ed13eb758f..ee8694eea6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -39,7 +39,6 @@