From 1582d3f0ec63a733a59d85ae5b9a78cd421cd8d2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 27 Sep 2025 17:57:00 +0200 Subject: [PATCH] Update CS Fixer conf --- .php-cs-fixer.dist.php | 2 +- public_html/static.php | 6 +++--- tests/Framework/MimeTest.php | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1698284a3..826cf9e25 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -26,7 +26,7 @@ return (new Config()) ->setRules([ '@PhpCsFixer' => true, '@PhpCsFixer:risky' => true, - '@PHP81Migration' => true, + '@PHP8x1Migration' => true, // required by PSR-12 'concat_space' => [ diff --git a/public_html/static.php b/public_html/static.php index edbc2f29a..43d5f3497 100644 --- a/public_html/static.php +++ b/public_html/static.php @@ -19,8 +19,8 @@ */ /** - * @const array Supported file types/extensions. If file type is not on the list - * it will have to be served by custom code in your plugin. + * @var array Supported file types/extensions. If file type is not on the list + * it will have to be served by custom code in your plugin. */ const SUPPORTED_TYPES = [ 'avif' => 'image/avif', @@ -45,7 +45,7 @@ const SUPPORTED_TYPES = [ ]; /** - * @const array Path prefixes to look for the requested files + * @var array Path prefixes to look for the requested files */ const ALLOWED_PATHS = [ 'installer/', diff --git a/tests/Framework/MimeTest.php b/tests/Framework/MimeTest.php index d483de3c1..b112801f6 100644 --- a/tests/Framework/MimeTest.php +++ b/tests/Framework/MimeTest.php @@ -398,6 +398,12 @@ class MimeTest extends TestCase $content = file_get_contents($file); $this->assertSame('image/gif', \rcube_mime::file_content_type($content, 'blocked.gif', 'application/octet-stream', true, true)); $this->assertSame('image/gif', \rcube_mime::file_content_type($content, 'blocked.gif', 'application/octet-stream', true, false)); + + // Test pdf file + $file = INSTALL_PATH . 'program/resources/dummy.pdf'; + $content = file_get_contents($file); + $this->assertSame('application/pdf', \rcube_mime::file_content_type($content, '', 'application/octet-stream', true, true)); + $this->assertSame('application/pdf', \rcube_mime::file_content_type($file, '', 'application/octet-stream', false, true)); } /**