From 434471a5e9a64bf7134c11ff89b1cb13d67bc55d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 00:36:11 +0000 Subject: [PATCH 1/3] Bump phpoffice/phpspreadsheet from 1.29.0 to 2.1.0 Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.0 to 2.1.0. - [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases) - [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.0...2.1.0) --- updated-dependencies: - dependency-name: phpoffice/phpspreadsheet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 134 ++++++++++++++------------------------------------ 2 files changed, 37 insertions(+), 99 deletions(-) diff --git a/composer.json b/composer.json index 250763d0..3db4c061 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "php": "~8.1.0 || ~8.2.0", "ext-json": "*", "ext-mbstring": "*", - "phpoffice/phpspreadsheet": "^1.29", + "phpoffice/phpspreadsheet": "^1.29 || ^2.0", "typo3/cms-backend": "^11.5 || ^12.4", "typo3/cms-core": "^11.5 || ^12.4", "typo3/cms-extbase": "^11.5 || ^12.4", diff --git a/composer.lock b/composer.lock index 71cf61b6..ea1c8b6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c082d2e79dd1807d91d94527e7badb0", + "content-hash": "33bedb90406d36a6fd7a16662117a97c", "packages": [ { "name": "bacon/bacon-qr-code", @@ -848,67 +848,6 @@ }, "time": "2022-02-21T09:13:59+00:00" }, - { - "name": "ezyang/htmlpurifier", - "version": "v4.16.0", - "source": { - "type": "git", - "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8", - "reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8", - "shasum": "" - }, - "require": { - "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "require-dev": { - "cerdic/css-tidy": "^1.7 || ^2.0", - "simpletest/simpletest": "dev-master" - }, - "suggest": { - "cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.", - "ext-bcmath": "Used for unit conversion and imagecrash protection", - "ext-iconv": "Converts text to and from non-UTF-8 encodings", - "ext-tidy": "Used for pretty-printing HTML" - }, - "type": "library", - "autoload": { - "files": [ - "library/HTMLPurifier.composer.php" - ], - "psr-0": { - "HTMLPurifier": "library/" - }, - "exclude-from-classmap": [ - "/library/HTMLPurifier/Language/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Edward Z. Yang", - "email": "admin@htmlpurifier.org", - "homepage": "http://ezyang.com" - } - ], - "description": "Standards compliant HTML filter written in PHP", - "homepage": "http://htmlpurifier.org/", - "keywords": [ - "html" - ], - "support": { - "issues": "https://github.com/ezyang/htmlpurifier/issues", - "source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0" - }, - "time": "2022-09-18T07:06:19+00:00" - }, { "name": "firebase/php-jwt", "version": "v6.10.0", @@ -1360,16 +1299,16 @@ }, { "name": "maennchen/zipstream-php", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/maennchen/ZipStream-PHP.git", - "reference": "b46726e666b5d2ad32959ae9492ee1034e798162" + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b46726e666b5d2ad32959ae9492ee1034e798162", - "reference": "b46726e666b5d2ad32959ae9492ee1034e798162", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1", + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1", "shasum": "" }, "require": { @@ -1425,7 +1364,7 @@ ], "support": { "issues": "https://github.com/maennchen/ZipStream-PHP/issues", - "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.0.2" + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0" }, "funding": [ { @@ -1437,7 +1376,7 @@ "type": "open_collective" } ], - "time": "2023-04-19T19:51:03+00:00" + "time": "2023-06-21T14:59:35+00:00" }, { "name": "markbaker/complex", @@ -1790,16 +1729,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "1.29.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0" + "reference": "dbed77bd3a0f68f96c0dd68ad4499d5674fecc3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0", - "reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/dbed77bd3a0f68f96c0dd68ad4499d5674fecc3e", + "reference": "dbed77bd3a0f68f96c0dd68ad4499d5674fecc3e", "shasum": "" }, "require": { @@ -1816,25 +1755,24 @@ "ext-xmlwriter": "*", "ext-zip": "*", "ext-zlib": "*", - "ezyang/htmlpurifier": "^4.15", "maennchen/zipstream-php": "^2.1 || ^3.0", "markbaker/complex": "^3.0", "markbaker/matrix": "^3.0", - "php": "^7.4 || ^8.0", + "php": "^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "dev-main", - "dompdf/dompdf": "^1.0 || ^2.0", + "dompdf/dompdf": "^2.0", "friendsofphp/php-cs-fixer": "^3.2", "mitoteam/jpgraph": "^10.3", "mpdf/mpdf": "^8.1.1", "phpcompatibility/php-compatibility": "^9.3", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^8.5 || ^9.0 || ^10.0", + "phpunit/phpunit": "^9.6", "squizlabs/php_codesniffer": "^3.7", "tecnickcom/tcpdf": "^6.5" }, @@ -1889,22 +1827,22 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.1.0" }, - "time": "2023-06-14T22:48:31+00:00" + "time": "2024-05-11T04:17:56+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.28.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", "shasum": "" }, "require": { @@ -1936,9 +1874,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" }, - "time": "2024-04-03T18:51:33+00:00" + "time": "2024-05-06T12:04:23+00:00" }, { "name": "psr/cache", @@ -2194,20 +2132,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -2231,7 +2169,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -2243,9 +2181,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -6675,16 +6613,16 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { @@ -6721,7 +6659,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" }, "funding": [ { @@ -6737,7 +6675,7 @@ "type": "tidelift" } ], - "time": "2024-03-26T18:29:49+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", From 9c808e7679fb92231c750224d959c6a14b353092 Mon Sep 17 00:00:00 2001 From: hoogi91 Date: Mon, 20 May 2024 13:50:54 +0200 Subject: [PATCH 2/3] Fix tests and static analysis issues --- Classes/Service/CellService.php | 5 +++-- Classes/Service/SpanService.php | 2 +- .../Unit/DataProcessing/SpreadsheetProcessorTest.php | 6 +++--- Tests/Unit/DataProcessing/TabsProcessorTest.php | 12 +++--------- Tests/Unit/Service/CellServiceTest.php | 4 +--- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Classes/Service/CellService.php b/Classes/Service/CellService.php index e8f79ab7..167df9f1 100644 --- a/Classes/Service/CellService.php +++ b/Classes/Service/CellService.php @@ -126,9 +126,10 @@ private function formatString(mixed $value, Cell $cell): string setlocale(LC_NUMERIC, $currentLocale); } - return (string)$value; + return $value; } - return (string)NumberFormat::toFormattedString($value, NumberFormat::FORMAT_GENERAL); + /** @var null|bool|float|int|RichText|string $value */ + return NumberFormat::toFormattedString($value, NumberFormat::FORMAT_GENERAL); } } diff --git a/Classes/Service/SpanService.php b/Classes/Service/SpanService.php index 42f1b6a7..b80f5615 100644 --- a/Classes/Service/SpanService.php +++ b/Classes/Service/SpanService.php @@ -150,7 +150,7 @@ public function getMergedCells(Worksheet $worksheet): array } /** - * @param array|CellAddress|string> $references + * @param array $references * @return array */ private function getCellStyleIndexesFromReferences(Worksheet $worksheet, array $references): array diff --git a/Tests/Unit/DataProcessing/SpreadsheetProcessorTest.php b/Tests/Unit/DataProcessing/SpreadsheetProcessorTest.php index ec137f87..3634f13c 100644 --- a/Tests/Unit/DataProcessing/SpreadsheetProcessorTest.php +++ b/Tests/Unit/DataProcessing/SpreadsheetProcessorTest.php @@ -155,7 +155,7 @@ public static function processingDataProvider(): array 'firstColumnIsHeader' => false, ], ], - 'alternativeExpectation' => self::validInputExpectationsOnlyWithBody(...), + 'alternativeExpectations' => self::validInputExpectationsOnlyWithBody(...), ], 'left head data is set because we do not have extracted head data' => [ 'processConfig' => ['value' => 'file:123|2!A1:B2'], @@ -173,7 +173,7 @@ public static function processingDataProvider(): array 'firstColumnIsHeader' => true, ], ], - 'alternativeExpectation' => self::validInputExpectationsOnlyWithBody(...), + 'alternativeExpectations' => self::validInputExpectationsOnlyWithBody(...), ], 'head and foot data are not filled incorrectly when no data is given' => [ 'processConfig' => ['value' => 'file:123|2!A1:B2'], @@ -187,7 +187,7 @@ public static function processingDataProvider(): array 'firstColumnIsHeader' => false, ], ], - 'alternativeExpectation' => self::validInputExpectationsWithEmptyBody(...), + 'alternativeExpectations' => self::validInputExpectationsWithEmptyBody(...), ], ]; } diff --git a/Tests/Unit/DataProcessing/TabsProcessorTest.php b/Tests/Unit/DataProcessing/TabsProcessorTest.php index cd4eb103..04ac9a0e 100644 --- a/Tests/Unit/DataProcessing/TabsProcessorTest.php +++ b/Tests/Unit/DataProcessing/TabsProcessorTest.php @@ -29,13 +29,7 @@ protected function getDataProcessor(): AbstractProcessor protected function validInputExpectations(MockObject $spreadsheetMock): void { // mock worksheet will be returned - $worksheetMock = $this->createConfiguredMock( - Worksheet::class, - [ - 'getTitle' => 'Worksheet #1', - 'getHashCode' => '263df821f3760dc1ec4e', - ] - ); + $worksheetMock = new Worksheet(null, 'Worksheet #1'); $spreadsheetMock->expects(self::once())->method('getAllSheets')->willReturn([$worksheetMock]); // check if extract gets called @@ -80,7 +74,7 @@ public static function processingDataProvider(): array 'expectedResult' => [ 'someOtherVar' => [ // key is file uid and hash code - '123263df821f3760dc1ec4e' => [ + '123b8367b83d9b7fa3124b32922f50ad2fc' => [ 'sheetTitle' => 'Worksheet #1', 'bodyData' => ['body-data-mocked'], 'headData' => ['head-data-mocked'], @@ -97,7 +91,7 @@ public static function processingDataProvider(): array 'expectedResult' => [ 'spreadsheets' => [ // key is file uid and hash code - '123263df821f3760dc1ec4e' => [ + '123b8367b83d9b7fa3124b32922f50ad2fc' => [ 'sheetTitle' => 'Worksheet #1', 'bodyData' => ['body-data-mocked'], 'headData' => ['head-data-mocked'], diff --git a/Tests/Unit/Service/CellServiceTest.php b/Tests/Unit/Service/CellServiceTest.php index bc2d7dc7..d5693737 100644 --- a/Tests/Unit/Service/CellServiceTest.php +++ b/Tests/Unit/Service/CellServiceTest.php @@ -112,9 +112,7 @@ public function testCatchingOfCalculatedCellValues(): void $mockedCell->method('getValue')->willReturn('MockValue'); // build chain for style index search - $worksheetMock = $this->getMockBuilder(Worksheet::class)->disableOriginalConstructor()->getMock(); - $worksheetMock->method('getParent')->willReturn($this->spreadsheet); - + $worksheetMock = new Worksheet($this->spreadsheet, 'Worksheet'); $mockedCell->method('getWorksheet')->willReturn($worksheetMock); self::assertEquals('MockValue', $this->cellService->getFormattedValue($mockedCell)); From ba76a2a2ae653f0ba93c2c23268eb42fd2e7b2fc Mon Sep 17 00:00:00 2001 From: hoogi91 Date: Mon, 20 May 2024 14:00:18 +0200 Subject: [PATCH 3/3] Fix tests and static analysis issues --- Classes/Service/CellService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Service/CellService.php b/Classes/Service/CellService.php index 167df9f1..ffcd0984 100644 --- a/Classes/Service/CellService.php +++ b/Classes/Service/CellService.php @@ -129,7 +129,7 @@ private function formatString(mixed $value, Cell $cell): string return $value; } - /** @var null|bool|float|int|RichText|string $value */ + /** @var bool|float|int|RichText|string|null $value */ return NumberFormat::toFormattedString($value, NumberFormat::FORMAT_GENERAL); } }