From 44d3812c421a1b3aa83eb190245ea62e64b159b0 Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Mon, 24 Nov 2025 11:32:50 +0100 Subject: [PATCH 1/3] Update dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cb82354..efb77b6 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "3.*", - "phpstan/phpstan": "1.*", - "phpunit/phpunit": "9.*" + "phpstan/phpstan": "2.*", + "phpunit/phpunit": "11.*" }, "scripts": { "lint": "vendor/bin/php-cs-fixer fix ./ --rules=@PSR12", From c67ca84e3b24c695e6604f01f1d8a6a2a80bfd70 Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Mon, 24 Nov 2025 11:34:15 +0100 Subject: [PATCH 2/3] CS --- test/CsvTest.php | 1 - test/FileTest.php | 1 - test/ZipTest.php | 1 - 3 files changed, 3 deletions(-) diff --git a/test/CsvTest.php b/test/CsvTest.php index dc89181..52b73c4 100644 --- a/test/CsvTest.php +++ b/test/CsvTest.php @@ -5,7 +5,6 @@ namespace Test\Service; use PHPUnit\Framework\TestCase; - use Phant\File\Csv; final class CsvTest extends TestCase diff --git a/test/FileTest.php b/test/FileTest.php index 10ed854..b9bf2d3 100644 --- a/test/FileTest.php +++ b/test/FileTest.php @@ -5,7 +5,6 @@ namespace Test\Service; use PHPUnit\Framework\TestCase; - use Phant\File\File; final class FileTest extends TestCase diff --git a/test/ZipTest.php b/test/ZipTest.php index 1f10f6d..73d7e00 100644 --- a/test/ZipTest.php +++ b/test/ZipTest.php @@ -5,7 +5,6 @@ namespace Test\Service; use PHPUnit\Framework\TestCase; - use Phant\File\Zip; final class ZipTest extends TestCase From 5d16a8fca0e44083ccf2ff154cceb2abade59e80 Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Mon, 24 Nov 2025 11:36:16 +0100 Subject: [PATCH 3/3] remove space remplacement --- component/File.php | 3 ++- test/FileTest.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/component/File.php b/component/File.php index f83b8ce..1681fd4 100644 --- a/component/File.php +++ b/component/File.php @@ -52,7 +52,8 @@ public static function cleanFilename(string $fileName): string $fileName = str_replace('\'', ' ', $fileName); $fileName = preg_replace('/\s+/', ' ', $fileName); $fileName = trim($fileName); - $fileName = preg_replace(['/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'], ['_', '.', ''], $fileName); + $fileName = preg_replace('/\.+/', '.', $fileName); + $fileName = preg_replace('/[^\w\s_\.\-]/', '', $fileName); $extension = strtolower($extension); $extension = trim($extension); diff --git a/test/FileTest.php b/test/FileTest.php index b9bf2d3..23bfce0 100644 --- a/test/FileTest.php +++ b/test/FileTest.php @@ -67,12 +67,12 @@ public function testCleanFilename(): void $result = File::cleanFilename(' µ \' û '); $this->assertIsString($result); - $this->assertEquals('u_u', $result); + $this->assertEquals('u u', $result); - $result = File::cleanFilename(' µ û . Jpg'); + $result = File::cleanFilename(' µ û .. Jpg'); $this->assertIsString($result); - $this->assertEquals('u_u.jpg', $result); + $this->assertEquals('u u.jpg', $result); } public function testDownload(): void