From 2b0a3da81033822643b5723000faf6f96a360b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 3 Sep 2022 19:23:13 -0300 Subject: Fix some errors found by PHPStan in ZipExtensionTest class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- test/classes/ZipExtensionTest.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/classes/ZipExtensionTest.php b/test/classes/ZipExtensionTest.php index 1468c1db62..cbb1244006 100644 --- a/test/classes/ZipExtensionTest.php +++ b/test/classes/ZipExtensionTest.php @@ -29,13 +29,14 @@ class ZipExtensionTest extends AbstractTestCase /** * Test for getContents * - * @param string $file path to zip file - * @param string|null $specific_entry regular expression to match a file - * @param mixed $output expected output + * @param string $file path to zip file + * @param string|null $specific_entry regular expression to match a file + * @param array $output expected output + * @psalm-param array{error: string, data: string} $output * * @dataProvider provideTestGetContents */ - public function testGetContents(string $file, ?string $specific_entry, $output): void + public function testGetContents(string $file, ?string $specific_entry, array $output): void { $this->assertEquals( $this->zipExtension->getContents($file, $specific_entry), @@ -44,9 +45,8 @@ class ZipExtensionTest extends AbstractTestCase } /** - * Provider for testGetZipContents - * - * @return array + * @return array|string|null>> + * @psalm-return array */ public function provideTestGetContents(): array { @@ -81,9 +81,10 @@ class ZipExtensionTest extends AbstractTestCase /** * Test for findFile * - * @param string $file path to zip file - * @param string $file_regexp regular expression for the file name to match - * @param mixed $output expected output + * @param string $file path to zip file + * @param string $file_regexp regular expression for the file name to match + * @param string|bool $output expected output + * @psalm-param string|false $output * * @dataProvider provideTestFindFile */ @@ -98,7 +99,8 @@ class ZipExtensionTest extends AbstractTestCase /** * Provider for testFindFileFromZipArchive * - * @return array Test data + * @return array> + * @psalm-return array */ public function provideTestFindFile(): array { @@ -108,6 +110,11 @@ class ZipExtensionTest extends AbstractTestCase '/test/', 'test.file', ], + [ + './test/test_data/test.zip', + '/invalid/', + false, + ], ]; } -- cgit v1.2.3