From 8258919d722b5971bda7c4169d1e1b4d3264d086 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Tue, 1 Mar 2022 01:53:12 -0800 Subject: [PATCH 1/5] Phpstan Differences from Php7 to Php8 (#2631) These changes were already implemented as PR #2428. They were, alas, regressed by PR #2585. If at first you don't succeed ... As configured, Phpstan running under Php7 reports no errors. However, running under Php8, it reports 100 (!) errors. The vast majority of these are due to two reasons: - renaming parameters in Php builtin functions in preparation for named parameters. - using the new class GdImage rather than type resource as the argument type for many image-based functions. Regardless of the cause, this will be a problem sooner or later. This PR is an attempt to get ahead of that problem. For source members, it tweaks only the Phpstan configuration files, without changing any PhpSpreadsheet code. For the small number of test members involved, the code is fixed. Php7 and Php8 both report no errors with this configuration. Because this involves no changes to code, and because Phpstan baseline is a common cause of merge difficulties, I will probably merge this in a day or two, more quickly than I customarily do. --- phpstan-baseline.neon | 132 +++++------------- .../Functional/DrawingImageHyperlinkTest.php | 56 +++++--- .../Functional/StreamTest.php | 20 ++- .../Worksheet/DrawingTest.php | 48 ++++--- 4 files changed, 110 insertions(+), 146 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a5a36992..484cbe57 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -146,12 +146,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, int\\|string given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, int\\|string given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, null given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, null given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/Calculation.php @@ -361,12 +361,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\<0, 281474976710655\\>\\|string given\\.$#" + message: "#^Parameter \\#1 \\$num(ber)? of function floor expects float(.int)?, float\\|int\\<0, 281474976710655\\>\\|string given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#" + message: "#^Parameter \\#1 \\$num(ber)? of function floor expects float(.int)?, float\\|int\\|string given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Engineering/BitWise.php @@ -821,12 +821,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php - - message: "#^Parameter \\#1 \\$low of function range expects float\\|int\\|string, string\\|null given\\.$#" + message: "#^Parameter \\#1 \\$(low|start) of function range expects float\\|int\\|string, string\\|null given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php - - message: "#^Parameter \\#2 \\$high of function range expects float\\|int\\|string, string\\|null given\\.$#" + message: "#^Parameter \\#2 \\$(high|end) of function range expects float\\|int\\|string, string\\|null given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php @@ -1256,12 +1256,12 @@ parameters: path: src/PhpSpreadsheet/Cell/Coordinate.php - - message: "#^Parameter \\#1 \\$input of function array_chunk expects array, array\\\\|false given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_chunk expects array, array\\\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Cell/Coordinate.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, array\\\\|string given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, array\\\\|string given\\.$#" count: 1 path: src/PhpSpreadsheet/Cell/Coordinate.php @@ -1946,7 +1946,7 @@ parameters: path: src/PhpSpreadsheet/Helper/Html.php - - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\), mixed\\} given\\.$#" + message: "#^Parameter \\#1 \\$(function|callback) of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\), mixed\\} given\\.$#" count: 1 path: src/PhpSpreadsheet/Helper/Html.php @@ -2521,7 +2521,7 @@ parameters: path: src/PhpSpreadsheet/Reader/Xls/MD5.php - - message: "#^Parameter \\#1 \\$input of function array_values expects array, array\\|false given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_values expects array, array\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -3336,37 +3336,37 @@ parameters: path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:imagecreatefrombmp\\(\\) should return GdImage\\|resource but returns resource\\|false\\.$#" + message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:imagecreatefrombmp\\(\\) should return GdImage\\|resource but returns (GdImage|resource)\\|false\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#1 \\$fp of function feof expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$(fp|stream) of function feof expects resource, resource\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#1 \\$fp of function fread expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$(fp|stream) of function fread expects resource, resource\\|false given\\.$#" count: 2 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagecolorallocate expects (GdImage|resource), (GdImage|resource)\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#1 \\$im of function imagesetpixel expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagesetpixel expects (GdImage|resource), (GdImage|resource)\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#1 \\$x_size of function imagecreatetruecolor expects int, float\\|int given\\.$#" + message: "#^Parameter \\#1 \\$(x_size|width) of function imagecreatetruecolor expects int, float\\|int given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" + message: "#^Parameter \\#2 \\$(data|string) of function unpack expects string, string\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php @@ -3376,7 +3376,7 @@ parameters: path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#2 \\$y_size of function imagecreatetruecolor expects int, float\\|int given\\.$#" + message: "#^Parameter \\#2 \\$(y_size|height) of function imagecreatetruecolor expects int, float\\|int given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php @@ -3396,7 +3396,7 @@ parameters: path: src/PhpSpreadsheet/Shared/Drawing.php - - message: "#^Parameter \\#4 \\$col of function imagesetpixel expects int, int\\|false given\\.$#" + message: "#^Parameter \\#4 \\$col(or)? of function imagesetpixel expects int, int\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Drawing.php @@ -3596,7 +3596,7 @@ parameters: path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, float\\|int given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, float\\|int given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -3676,7 +3676,7 @@ parameters: path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" + message: "#^Parameter \\#2 \\$(data|string) of function unpack expects string, string\\|false given\\.$#" count: 3 path: src/PhpSpreadsheet/Shared/OLE.php @@ -3716,7 +3716,7 @@ parameters: path: src/PhpSpreadsheet/Shared/OLE.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, string given\\.$#" + message: "#^Parameter \\#1 \\$(var|value) of function count expects array\\|Countable, string given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -4061,7 +4061,7 @@ parameters: path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php - - message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, float given\\.$#" + message: "#^Parameter \\#2 \\.\\.\\.\\$(args|arrays) of function array_merge expects array, float given\\.$#" count: 1 path: src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -4361,7 +4361,7 @@ parameters: path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, string\\|null given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, string\\|null given\\.$#" count: 1 path: src/PhpSpreadsheet/Style/NumberFormat/DateFormatter.php @@ -4486,7 +4486,7 @@ parameters: path: src/PhpSpreadsheet/Worksheet/PageSetup.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, string\\|null given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, string\\|null given\\.$#" count: 5 path: src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -4581,7 +4581,7 @@ parameters: path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$input of function array_splice expects array, ArrayObject\\ given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_splice expects array, ArrayObject\\ given\\.$#" count: 1 path: src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -4606,7 +4606,7 @@ parameters: path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#2 \\$start of function substr expects int, int\\<0, max\\>\\|false given\\.$#" + message: "#^Parameter \\#2 \\$(start|offset) of function substr expects int, int(\\<0, max\\>)?\\|false given\\.$#" count: 2 path: src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -4931,12 +4931,12 @@ parameters: path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, GdImage\\|resource given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagepng expects (GdImage|resource), GdImage\\|resource given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Html.php - - message: "#^Parameter \\#1 \\$str of function base64_encode expects string, string\\|false given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function base64_encode expects string, string\\|false given\\.$#" count: 2 path: src/PhpSpreadsheet/Writer/Html.php @@ -5066,12 +5066,12 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, GdImage\\|resource given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagepng expects (GdImage|resource), GdImage\\|resource given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls.php - - message: "#^Parameter \\#1 \\$im of function imagepng expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagepng expects (GdImage|resource), (GdImage|resource)\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls.php @@ -5256,7 +5256,7 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#1 \\$im of function imagecolorat expects resource, GdImage\\|resource given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagecolorat expects (GdImage|resource), GdImage\\|resource given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -5271,12 +5271,12 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#2 \\$col of function imagecolorsforindex expects int, int\\|false given\\.$#" + message: "#^Parameter \\#2 \\$col(or)? of function imagecolorsforindex expects int, int\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#" + message: "#^Parameter \\#2 \\$(data|string) of function unpack expects string, string\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -5286,7 +5286,7 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php - - message: "#^Parameter \\#2 \\$pieces of function implode expects array, array\\\\|false given\\.$#" + message: "#^Parameter \\#2 \\$(pieces|array) of function implode expects array(\\|null)?, array\\\\|false given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -5371,7 +5371,7 @@ parameters: path: src/PhpSpreadsheet/Writer/Xlsx.php - - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, string given\\.$#" + message: "#^Parameter \\#1 \\$(function|callback) of function call_user_func expects callable\\(\\)\\: mixed, string given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xlsx.php @@ -5850,51 +5850,11 @@ parameters: count: 2 path: tests/PhpSpreadsheetTests/Functional/ConditionalStopIfTrueTest.php - - - message: "#^Cannot call method getUrl\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Hyperlink\\|null\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - message: "#^Cannot call method getPageSetup\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#" count: 5 path: tests/PhpSpreadsheetTests/Functional/PrintAreaTest.php - - - message: "#^Cannot access offset 'size' on array\\{0\\: int, 1\\: int, 2\\: int, 3\\: int, 4\\: int, 5\\: int, 6\\: int, 7\\: int, \\.\\.\\.\\}\\|false\\.$#" - count: 2 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php - - - - message: "#^Parameter \\#1 \\$filename of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\IWriter\\:\\:save\\(\\) expects resource\\|string, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php - - - - message: "#^Parameter \\#1 \\$fp of function fstat expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Functional/StreamTest.php - - message: "#^Parameter \\#1 \\$expected of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) expects class\\-string\\, string given\\.$#" count: 3 @@ -6050,26 +6010,6 @@ parameters: count: 1 path: tests/PhpSpreadsheetTests/Worksheet/AutoFilter/ColumnTest.php - - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, resource\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" - count: 1 - path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - message: "#^Parameter \\#2 \\$rowIndex of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowCellIterator constructor expects int, string given\\.$#" count: 1 diff --git a/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php b/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php index 7a8e2cda..be350ced 100644 --- a/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php +++ b/tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php @@ -10,33 +10,43 @@ class DrawingImageHyperlinkTest extends AbstractFunctional { public function testDrawingImageHyperlinkTest(): void { - $baseUrl = 'https://github.com/PHPOffice/PhpSpreadsheet'; - $spreadsheet = new Spreadsheet(); - - $aSheet = $spreadsheet->getActiveSheet(); - $gdImage = @imagecreatetruecolor(120, 20); - $textColor = imagecolorallocate($gdImage, 255, 255, 255); - imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); + $textColor = ($gdImage === false) ? false : imagecolorallocate($gdImage, 255, 255, 255); + if ($gdImage === false || $textColor === false) { + self::fail('imagecreatetruecolor or imagecolorallocate failed'); + } else { + $baseUrl = 'https://github.com/PHPOffice/PhpSpreadsheet'; + $spreadsheet = new Spreadsheet(); - $drawing = new MemoryDrawing(); - $drawing->setName('In-Memory image 1'); - $drawing->setDescription('In-Memory image 1'); - $drawing->setCoordinates('A1'); - $drawing->setImageResource($gdImage); - $drawing->setRenderingFunction( - MemoryDrawing::RENDERING_JPEG - ); - $drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); - $drawing->setHeight(36); - $hyperLink = new Hyperlink($baseUrl, 'test image'); - $drawing->setHyperlink($hyperLink); - $drawing->setWorksheet($aSheet); + $aSheet = $spreadsheet->getActiveSheet(); + imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx'); + $drawing = new MemoryDrawing(); + $drawing->setName('In-Memory image 1'); + $drawing->setDescription('In-Memory image 1'); + $drawing->setCoordinates('A1'); + $drawing->setImageResource($gdImage); + $drawing->setRenderingFunction( + MemoryDrawing::RENDERING_JPEG + ); + $drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); + $drawing->setHeight(36); + $hyperLink = new Hyperlink($baseUrl, 'test image'); + $drawing->setHyperlink($hyperLink); + $drawing->setWorksheet($aSheet); - foreach ($reloadedSpreadsheet->getActiveSheet()->getDrawingCollection() as $pDrawing) { - self::assertEquals('https://github.com/PHPOffice/PhpSpreadsheet', $pDrawing->getHyperlink()->getUrl(), 'functional test drawing hyperlink'); + $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx'); + $spreadsheet->disconnectWorksheets(); + + foreach ($reloadedSpreadsheet->getActiveSheet()->getDrawingCollection() as $pDrawing) { + $getHyperlink = $pDrawing->getHyperlink(); + if ($getHyperlink === null) { + self::fail('getHyperlink returned null'); + } else { + self::assertEquals('https://github.com/PHPOffice/PhpSpreadsheet', $getHyperlink->getUrl(), 'functional test drawing hyperlink'); + } + } + $reloadedSpreadsheet->disconnectWorksheets(); } } } diff --git a/tests/PhpSpreadsheetTests/Functional/StreamTest.php b/tests/PhpSpreadsheetTests/Functional/StreamTest.php index 03f9a2d9..3911aaa6 100644 --- a/tests/PhpSpreadsheetTests/Functional/StreamTest.php +++ b/tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -39,12 +39,22 @@ class StreamTest extends TestCase $writer = IOFactory::createWriter($spreadsheet, $format); $stream = fopen('php://memory', 'wb+'); - self::assertSame(0, fstat($stream)['size']); + $stat = ($stream === false) ? false : fstat($stream); + if ($stream === false || $stat === false) { + self::fail('fopen or fstat failed'); + } else { + self::assertSame(0, $stat['size']); - $writer->save($stream); + $writer->save($stream); - self::assertIsResource($stream, 'should not close the stream for further usage out of PhpSpreadsheet'); - self::assertGreaterThan(0, fstat($stream)['size'], 'something should have been written to the stream'); - self::assertGreaterThan(0, ftell($stream), 'should not be rewinded, because not all streams support it'); + self::assertIsResource($stream, 'should not close the stream for further usage out of PhpSpreadsheet'); + $stat = fstat($stream); + if ($stat === false) { + self::fail('fstat failed'); + } else { + self::assertGreaterThan(0, $stat['size'], 'something should have been written to the stream'); + } + self::assertGreaterThan(0, ftell($stream), 'should not be rewinded, because not all streams support it'); + } } } diff --git a/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php b/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php index f126a529..d18ff002 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php @@ -10,31 +10,35 @@ class DrawingTest extends TestCase { public function testCloningWorksheetWithImages(): void { - $spreadsheet = new Spreadsheet(); - $aSheet = $spreadsheet->getActiveSheet(); - $gdImage = @imagecreatetruecolor(120, 20); - $textColor = imagecolorallocate($gdImage, 255, 255, 255); - imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); + $textColor = ($gdImage === false) ? false : imagecolorallocate($gdImage, 255, 255, 255); + if ($gdImage === false || $textColor === false) { + self::fail('imagecreatetruecolor or imagecolorallocate failed'); + } else { + $spreadsheet = new Spreadsheet(); + $aSheet = $spreadsheet->getActiveSheet(); + imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - $drawing = new MemoryDrawing(); - $drawing->setName('In-Memory image 1'); - $drawing->setDescription('In-Memory image 1'); - $drawing->setCoordinates('A1'); - $drawing->setImageResource($gdImage); - $drawing->setRenderingFunction( - MemoryDrawing::RENDERING_JPEG - ); - $drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); - $drawing->setHeight(36); - $drawing->setWorksheet($aSheet); + $drawing = new MemoryDrawing(); + $drawing->setName('In-Memory image 1'); + $drawing->setDescription('In-Memory image 1'); + $drawing->setCoordinates('A1'); + $drawing->setImageResource($gdImage); + $drawing->setRenderingFunction( + MemoryDrawing::RENDERING_JPEG + ); + $drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); + $drawing->setHeight(36); + $drawing->setWorksheet($aSheet); - $originDrawingCount = count($aSheet->getDrawingCollection()); - $clonedWorksheet = clone $aSheet; - $clonedDrawingCount = count($clonedWorksheet->getDrawingCollection()); + $originDrawingCount = count($aSheet->getDrawingCollection()); + $clonedWorksheet = clone $aSheet; + $clonedDrawingCount = count($clonedWorksheet->getDrawingCollection()); - self::assertEquals($originDrawingCount, $clonedDrawingCount); - self::assertNotSame($aSheet, $clonedWorksheet); - self::assertNotSame($aSheet->getDrawingCollection(), $clonedWorksheet->getDrawingCollection()); + self::assertEquals($originDrawingCount, $clonedDrawingCount); + self::assertNotSame($aSheet, $clonedWorksheet); + self::assertNotSame($aSheet->getDrawingCollection(), $clonedWorksheet->getDrawingCollection()); + $spreadsheet->disconnectWorksheets(); + } } } From f575d2b8b2f6cc94bb2ae93e7a1933c4fe9e5d55 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Tue, 1 Mar 2022 02:01:37 -0800 Subject: [PATCH 2/5] Add Ability to Suppress Mac Line Ending Check for CSV Reader (#2623) With the deprecation of `auto_detect_line_endings` in Php8.1, there have been some tickets (issue #2609 and PR #2438). Although the deprecation message is suppressed, users with a homegrown error handler may still see it. I am not very concerned about that symptom, but I imagine that there will be more similar tickets in future. This PR adds a new property/method to Reader/CSV to allow the user to avoid the deprecated code, at the negligible cost of being unable to read a CSV with Mac line endings even on a Php version that could support it. --- docs/topics/reading-and-writing-to-file.md | 19 ++++++++++++++ src/PhpSpreadsheet/Reader/Csv.php | 20 ++++++++++++--- .../Reader/Csv/CsvLineEndingTest.php | 25 +++++++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/docs/topics/reading-and-writing-to-file.md b/docs/topics/reading-and-writing-to-file.md index df595a81..df8ed7c2 100644 --- a/docs/topics/reading-and-writing-to-file.md +++ b/docs/topics/reading-and-writing-to-file.md @@ -544,6 +544,25 @@ $reader->setSheetIndex(5); $reader->loadIntoExisting("05featuredemo.csv", $spreadsheet); ``` +#### Line endings + +Line endings for Unix (`\n`) and Windows (`\r\n`) are supported. + +Mac line endings (`\r`) are supported as long as PHP itself +supports them, which it does through release 8.0. +Support for Mac line endings is deprecated for 8.1, +and is scheduled to remain deprecated for all later PHP8 releases; +PhpSpreadsheet will continue to support them for 8.*. +Support is scheduled to be dropped with release 9; +PhpSpreadsheet will then no longer handle CSV files +with Mac line endings correctly. + +You can suppress testing for Mac line endings as follows: +```php +$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); +$reader->setTestAutoDetect(false); +``` + ### \PhpOffice\PhpSpreadsheet\Writer\Csv #### Writing a CSV file diff --git a/src/PhpSpreadsheet/Reader/Csv.php b/src/PhpSpreadsheet/Reader/Csv.php index 0146fca0..e79f7942 100644 --- a/src/PhpSpreadsheet/Reader/Csv.php +++ b/src/PhpSpreadsheet/Reader/Csv.php @@ -84,6 +84,13 @@ class Csv extends BaseReader */ private static $constructorCallback; + /** + * Attempt autodetect line endings (deprecated after PHP8.1)? + * + * @var bool + */ + private $testAutodetect = true; + /** * Create a new CSV Reader instance. */ @@ -269,10 +276,15 @@ class Csv extends BaseReader } } - private static function setAutoDetect(?string $value): ?string + public function setTestAutoDetect(bool $value): void + { + $this->testAutodetect = $value; + } + + private function setAutoDetect(?string $value): ?string { $retVal = null; - if ($value !== null) { + if ($value !== null && $this->testAutodetect) { $retVal2 = @ini_set('auto_detect_line_endings', $value); if (is_string($retVal2)) { $retVal = $retVal2; @@ -288,7 +300,7 @@ class Csv extends BaseReader public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Spreadsheet { // Deprecated in Php8.1 - $iniset = self::setAutoDetect('1'); + $iniset = $this->setAutoDetect('1'); // Open file $this->openFileOrMemory($filename); @@ -339,7 +351,7 @@ class Csv extends BaseReader // Close file fclose($fileHandle); - self::setAutoDetect($iniset); + $this->setAutoDetect($iniset); // Return return $spreadsheet; diff --git a/tests/PhpSpreadsheetTests/Reader/Csv/CsvLineEndingTest.php b/tests/PhpSpreadsheetTests/Reader/Csv/CsvLineEndingTest.php index 38f2aaa1..8934e453 100644 --- a/tests/PhpSpreadsheetTests/Reader/Csv/CsvLineEndingTest.php +++ b/tests/PhpSpreadsheetTests/Reader/Csv/CsvLineEndingTest.php @@ -36,6 +36,31 @@ class CsvLineEndingTest extends TestCase $spreadsheet->disconnectWorksheets(); } + /** + * @dataProvider providerEndings + */ + public function testEndingsNoDetect(string $ending): void + { + $this->tempFile = $filename = File::temporaryFilename(); + $data = ['123', '456', '789']; + file_put_contents($filename, implode($ending, $data)); + $reader = new Csv(); + $reader->setTestAutoDetect(false); + $spreadsheet = $reader->load($filename); + $sheet = $spreadsheet->getActiveSheet(); + if ($ending === "\r") { + // Can't handle Mac line endings without autoDetect + self::assertEquals(implode("\n", $data), $sheet->getCell('A1')->getValue()); + self::assertNull($sheet->getCell('A2')->getValue()); + self::assertNull($sheet->getCell('A3')->getValue()); + } else { + self::assertEquals($data[0], $sheet->getCell('A1')->getValue()); + self::assertEquals($data[1], $sheet->getCell('A2')->getValue()); + self::assertEquals($data[2], $sheet->getCell('A3')->getValue()); + } + $spreadsheet->disconnectWorksheets(); + } + public function providerEndings(): array { return [ From a8ebf45fd7f0589c456fd4c8b62b20d337e59d2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 03:34:55 -0800 Subject: [PATCH 3/5] Bump phpstan/phpstan from 1.4.5 to 1.4.6 (#2634) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.4.5 to 1.4.6. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/master/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.4.5...1.4.6) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a19ff764..522fe164 100644 --- a/composer.lock +++ b/composer.lock @@ -2074,16 +2074,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.5", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "150d1fbd82fb71ff76b3bd7f6ea6006d89c5f0c3" + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/150d1fbd82fb71ff76b3bd7f6ea6006d89c5f0c3", - "reference": "150d1fbd82fb71ff76b3bd7f6ea6006d89c5f0c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8a7761f1c520e0dad6e04d862fdc697445457cfe", + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe", "shasum": "" }, "require": { @@ -2114,7 +2114,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.5" + "source": "https://github.com/phpstan/phpstan/tree/1.4.6" }, "funding": [ { @@ -2134,7 +2134,7 @@ "type": "tidelift" } ], - "time": "2022-02-02T19:35:10+00:00" + "time": "2022-02-06T12:56:13+00:00" }, { "name": "phpstan/phpstan-phpunit", From 30815cc0600a73024e9d1806acfe2d20628ab19e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 03:48:06 -0800 Subject: [PATCH 4/5] Bump phpunit/phpunit from 9.5.13 to 9.5.16 (#2635) Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.13 to 9.5.16. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.13...9.5.16) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/composer.lock b/composer.lock index 522fe164..0f1b41d8 100644 --- a/composer.lock +++ b/composer.lock @@ -1398,12 +1398,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1597,16 +1597,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -1642,9 +1642,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phenx/php-font-lib", @@ -2193,16 +2193,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4", + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4", "shasum": "" }, "require": { @@ -2258,7 +2258,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14" }, "funding": [ { @@ -2266,7 +2266,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-02-28T12:38:02+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2511,16 +2511,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.13", + "version": "9.5.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743" + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", - "reference": "597cb647654ede35e43b137926dfdfef0fb11743", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", "shasum": "" }, "require": { @@ -2536,7 +2536,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2571,11 +2571,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2598,7 +2598,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" }, "funding": [ { @@ -2610,7 +2610,7 @@ "type": "github" } ], - "time": "2022-01-24T07:33:35+00:00" + "time": "2022-02-23T17:10:58+00:00" }, { "name": "psr/cache", @@ -3364,16 +3364,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -3416,7 +3416,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -3424,7 +3424,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -4510,12 +4510,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ From a7a48bf0cae1f6d70082a5d71c9de33edb1a1e2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Mar 2022 03:58:33 -0800 Subject: [PATCH 5/5] Bump dompdf/dompdf from 1.1.1 to 1.2.0 (#2633) Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/dompdf/dompdf/releases) - [Commits](https://github.com/dompdf/dompdf/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: dompdf/dompdf dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 63 ++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/composer.lock b/composer.lock index 0f1b41d8..5434aa3a 100644 --- a/composer.lock +++ b/composer.lock @@ -1100,23 +1100,23 @@ }, { "name": "dompdf/dompdf", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "de4aad040737a89fae2129cdeb0f79c45513128d" + "reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/de4aad040737a89fae2129cdeb0f79c45513128d", - "reference": "de4aad040737a89fae2129cdeb0f79c45513128d", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/60b704331479a69e9bcdb3496da2315b5c4f94fd", + "reference": "60b704331479a69e9bcdb3496da2315b5c4f94fd", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "phenx/php-font-lib": "^0.5.2", - "phenx/php-svg-lib": "^0.3.3", + "phenx/php-font-lib": "^0.5.4", + "phenx/php-svg-lib": "^0.3.3 || ^0.4.0", "php": "^7.1 || ^8.0" }, "require-dev": { @@ -1161,9 +1161,9 @@ "homepage": "https://github.com/dompdf/dompdf", "support": { "issues": "https://github.com/dompdf/dompdf/issues", - "source": "https://github.com/dompdf/dompdf/tree/v1.1.1" + "source": "https://github.com/dompdf/dompdf/tree/v1.2.0" }, - "time": "2021-11-24T00:45:04+00:00" + "time": "2022-02-07T13:02:10+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1648,20 +1648,23 @@ }, { "name": "phenx/php-font-lib", - "version": "0.5.2", + "version": "0.5.4", "source": { "type": "git", - "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8" + "url": "https://github.com/dompdf/php-font-lib.git", + "reference": "dd448ad1ce34c63d09baccd05415e361300c35b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/ca6ad461f032145fff5971b5985e5af9e7fa88d8", - "reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/dd448ad1ce34c63d09baccd05415e361300c35b4", + "reference": "dd448ad1ce34c63d09baccd05415e361300c35b4", "shasum": "" }, + "require": { + "ext-mbstring": "*" + }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5 || ^6 || ^7" + "symfony/phpunit-bridge": "^3 || ^4 || ^5" }, "type": "library", "autoload": { @@ -1682,10 +1685,10 @@ "description": "A library to read, parse, export and make subsets of different types of font files.", "homepage": "https://github.com/PhenX/php-font-lib", "support": { - "issues": "https://github.com/PhenX/php-font-lib/issues", - "source": "https://github.com/PhenX/php-font-lib/tree/0.5.2" + "issues": "https://github.com/dompdf/php-font-lib/issues", + "source": "https://github.com/dompdf/php-font-lib/tree/0.5.4" }, - "time": "2020-03-08T15:31:32+00:00" + "time": "2021-12-17T19:44:54+00:00" }, { "name": "phenx/php-svg-lib", @@ -2811,29 +2814,33 @@ }, { "name": "sabberworm/php-css-parser", - "version": "8.3.1", + "version": "8.4.0", "source": { "type": "git", "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", - "reference": "d217848e1396ef962fb1997cf3e2421acba7f796" + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/d217848e1396ef962fb1997cf3e2421acba7f796", - "reference": "d217848e1396ef962fb1997cf3e2421acba7f796", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/e41d2140031d533348b2192a83f02d8dd8a71d30", + "reference": "e41d2140031d533348b2192a83f02d8dd8a71d30", "shasum": "" }, "require": { - "php": ">=5.3.2" + "ext-iconv": "*", + "php": ">=5.6.20" }, "require-dev": { "codacy/coverage": "^1.4", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.36" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" }, "type": "library", "autoload": { - "psr-0": { - "Sabberworm\\CSS": "lib/" + "psr-4": { + "Sabberworm\\CSS\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -2846,7 +2853,7 @@ } ], "description": "Parser for CSS Files written in PHP", - "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", "keywords": [ "css", "parser", @@ -2854,9 +2861,9 @@ ], "support": { "issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues", - "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.3.1" + "source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.4.0" }, - "time": "2020-06-01T09:10:00+00:00" + "time": "2021-12-11T13:40:54+00:00" }, { "name": "sebastian/cli-parser",