diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9943f81a..692cccd4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -221,27 +221,27 @@ parameters: path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$str of function preg_quote expects string, int\\|string given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function preg_quote expects string, int\\|string given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Calculation.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtoupper expects string, mixed given\\.$#" count: 2 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, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 3 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 @@ -516,12 +516,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_keys expects array, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtoupper expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php @@ -556,7 +556,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Date.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php @@ -566,7 +566,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtoupper expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php @@ -576,12 +576,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php - - message: "#^Parameter \\#1 \\$x of function fmod expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(x|num1) of function fmod expects float, mixed given\\.$#" count: 3 path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeParts.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php @@ -756,12 +756,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 @@ -986,12 +986,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php - - message: "#^Parameter \\#1 \\$number of function floor expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$num(ber)? of function floor expects float(\\|int)?, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php - - message: "#^Parameter \\#1 \\$x of function fmod expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(x|num1) of function fmod expects float, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/Financial/Dollar.php @@ -1276,12 +1276,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/LookupRef/Helpers.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/Helpers.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php @@ -1391,7 +1391,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/Offset.php @@ -1411,17 +1411,17 @@ 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 - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, mixed given\\.$#" count: 3 path: src/PhpSpreadsheet/Calculation/LookupRef/RowColumnInformation.php @@ -1486,12 +1486,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Parameter \\#1 \\$array_arg of function uasort expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$array(_arg)? of function uasort expects array, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_keys expects array, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php @@ -1561,12 +1561,12 @@ parameters: path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php - - message: "#^Parameter \\#1 \\$input of function array_filter expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_filter expects array, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php @@ -1766,7 +1766,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(var|value) of function count expects array\\|Countable, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php @@ -1931,7 +1931,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/TextData.php - - message: "#^Parameter \\#1 \\$glue of function implode expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(glue|separator) of function implode expects (array\\|)?string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/TextData/Concatenate.php @@ -1961,7 +1961,7 @@ parameters: path: src/PhpSpreadsheet/Calculation/TextData/Format.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/TextData/Format.php @@ -2136,17 +2136,17 @@ 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 \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtoupper expects string, mixed 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 @@ -2171,7 +2171,7 @@ parameters: path: src/PhpSpreadsheet/Cell/DataType.php - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtolower expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Cell/DataValidator.php @@ -2181,7 +2181,7 @@ parameters: path: src/PhpSpreadsheet/Cell/DefaultValueBinder.php - - message: "#^Parameter \\#1 \\$str of function ltrim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function ltrim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Cell/DefaultValueBinder.php @@ -2466,17 +2466,17 @@ parameters: path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_values expects array, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Parameter \\#1 \\$stack of function array_shift expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(stack|array) of function array_shift expects array, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Chart/DataSeriesValues.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(var|value) of function count expects array\\|Countable, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -3046,7 +3046,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 @@ -3211,7 +3211,7 @@ parameters: path: src/PhpSpreadsheet/Reader/Gnumeric.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Reader/Gnumeric.php @@ -3561,7 +3561,7 @@ parameters: path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 2 path: src/PhpSpreadsheet/Reader/Xls.php @@ -3571,7 +3571,7 @@ parameters: path: src/PhpSpreadsheet/Reader/Xls.php - - message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(var|value) of function count expects array\\|Countable, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Reader/Xls.php @@ -3701,7 +3701,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 @@ -3991,7 +3991,7 @@ parameters: path: src/PhpSpreadsheet/Reader/Xlsx.php - - message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function trim expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Reader/Xlsx.php @@ -4611,37 +4611,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 @@ -4651,7 +4651,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 @@ -4671,7 +4671,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 @@ -4881,7 +4881,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 @@ -4986,7 +4986,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 @@ -5026,7 +5026,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 @@ -5396,7 +5396,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 @@ -5811,7 +5811,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 @@ -6071,7 +6071,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 @@ -6176,7 +6176,7 @@ parameters: path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$input of function array_splice expects array, ArrayObject\\ given\\.$#" + message: "#^Parameter \\#1 \\$(input|string|array) of function array_splice expects array, ArrayObject\\ given\\.$#" count: 1 path: src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -6201,7 +6201,7 @@ parameters: path: src/PhpSpreadsheet/Worksheet/Worksheet.php - - message: "#^Parameter \\#1 \\$str of function strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strtoupper expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -6216,7 +6216,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 @@ -6546,12 +6546,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 @@ -6701,12 +6701,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 @@ -6841,7 +6841,7 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#1 \\$str of function strrev expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strrev expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -6861,7 +6861,7 @@ parameters: path: src/PhpSpreadsheet/Writer/Xls/Parser.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$str(ing)? of function explode expects string, mixed given\\.$#" count: 1 path: src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -6991,7 +6991,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 @@ -7006,12 +7006,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 @@ -7021,7 +7021,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 @@ -7126,7 +7126,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 @@ -8466,22 +8466,22 @@ parameters: path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.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: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagestring expects (GdImage|resource), (GdImage|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\\.$#" + message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, (GdImage|resource)\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" + message: "#^Parameter \\#6 \\$col(or)? of function imagestring expects int, int\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Functional/DrawingImageHyperlinkTest.php @@ -8511,7 +8511,7 @@ parameters: path: tests/PhpSpreadsheetTests/Functional/StreamTest.php - - message: "#^Parameter \\#1 \\$fp of function fstat expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$(fp|stream) of function fstat expects resource, resource\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Functional/StreamTest.php @@ -8586,7 +8586,7 @@ parameters: path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php - - message: "#^Parameter \\#1 \\$str of function strrev expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$str(ing)? of function strrev expects string, mixed given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php @@ -8821,22 +8821,22 @@ parameters: path: tests/PhpSpreadsheetTests/Worksheet/AutoFilter/DateGroupTest.php - - message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagecolorallocate expects (resource|GdImage), (resource|GdImage)\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$im(age)? of function imagestring expects (resource|GdImage), (resource|GdImage)\\|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\\.$#" + message: "#^Parameter \\#1 \\$value of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\MemoryDrawing\\:\\:setImageResource\\(\\) expects GdImage\\|resource, (GdImage|resource)\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php - - message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" + message: "#^Parameter \\#6 \\$col(or)? of function imagestring expects int, int\\|false given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Worksheet/DrawingTest.php @@ -8931,7 +8931,7 @@ parameters: path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php - - message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$(input|array) of function array_keys expects array, mixed given\\.$#" count: 1 path: tests/PhpSpreadsheetTests/Writer/Xls/WorkbookTest.php diff --git a/phpstan-conditional.php b/phpstan-conditional.php new file mode 100644 index 00000000..a673d523 --- /dev/null +++ b/phpstan-conditional.php @@ -0,0 +1,39 @@ + '~^Method .* has invalid return type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/Drawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Property .* has unknown class GdImage as its type\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Method .* has invalid return type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Class GdImage not found\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'count' => 1, + ]; + $config['parameters']['ignoreErrors'][] = [ + 'message' => '~^Parameter .* of method .* has invalid type GdImage\.$~', + 'path' => __DIR__ . '/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'count' => 1, + ]; +} + +return $config; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e2f78e39..e975f21c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,6 @@ includes: - phpstan-baseline.neon + - phpstan-conditional.php - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon @@ -12,12 +13,8 @@ parameters: processTimeout: 300.0 checkMissingIterableValueType: false ignoreErrors: - - '~^Class GdImage not found\.$~' - - '~^Method .* has invalid return type GdImage\.$~' - - '~^Property .* has unknown class GdImage as its type\.$~' - - '~^Parameter .* of method .* has invalid type GdImage\.$~' - - '~^Parameter \#1 \$im of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy) expects resource, GdImage\|resource given\.$~' - - '~^Parameter \#2 \$src_im of function imagecopy expects resource, GdImage\|resource given\.$~' + - '~^Parameter \#1 \$im(age)? of function (imagedestroy|imageistruecolor|imagealphablending|imagesavealpha|imagecolortransparent|imagecolorsforindex|imagesavealpha|imagesx|imagesy) expects (GdImage|resource), GdImage\|resource given\.$~' + - '~^Parameter \#2 \$src_im(age)? of function imagecopy expects (GdImage|resource), GdImage\|resource given\.$~' # Accept a bit anything for assert methods - '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~' - '~^Method PhpOffice\\PhpSpreadsheetTests\\.*\:\:test.*\(\) has parameter \$args with no type specified\.$~'