You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
message:"#^Parameter \\#1 \\$input of function array_chunk expects array, array\\<int, string\\>\\|false given\\.$#"
1259
+
message:"#^Parameter \\#1 \\$(input|array) of function array_chunk expects array, array\\<int, string\\>\\|false given\\.$#"
1260
1260
count:1
1261
1261
path:src/PhpSpreadsheet/Cell/Coordinate.php
1262
1262
1263
1263
-
1264
-
message:"#^Parameter \\#2 \\$str of function explode expects string, array\\<int, string\\>\\|string given\\.$#"
1264
+
message:"#^Parameter \\#2 \\$str(ing)? of function explode expects string, array\\<int, string\\>\\|string given\\.$#"
1265
1265
count:1
1266
1266
path:src/PhpSpreadsheet/Cell/Coordinate.php
1267
1267
@@ -1946,7 +1946,7 @@ parameters:
1946
1946
path:src/PhpSpreadsheet/Helper/Html.php
1947
1947
1948
1948
-
1949
-
message:"#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\), mixed\\} given\\.$#"
1949
+
message:"#^Parameter \\#1 \\$(function|callback) of function call_user_func expects callable\\(\\)\\: mixed, array\\{\\$this\\(PhpOffice\\\\PhpSpreadsheet\\\\Helper\\\\Html\\), mixed\\} given\\.$#"
1950
1950
count:1
1951
1951
path:src/PhpSpreadsheet/Helper/Html.php
1952
1952
@@ -2521,7 +2521,7 @@ parameters:
2521
2521
path:src/PhpSpreadsheet/Reader/Xls/MD5.php
2522
2522
2523
2523
-
2524
-
message:"#^Parameter \\#1 \\$input of function array_values expects array, array\\|false given\\.$#"
2524
+
message:"#^Parameter \\#1 \\$(input|array) of function array_values expects array, array\\|false given\\.$#"
2525
2525
count:1
2526
2526
path:src/PhpSpreadsheet/Reader/Xls/MD5.php
2527
2527
@@ -3336,37 +3336,37 @@ parameters:
3336
3336
path:src/PhpSpreadsheet/Shared/Drawing.php
3337
3337
3338
3338
-
3339
-
message:"#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:imagecreatefrombmp\\(\\) should return GdImage\\|resource but returns resource\\|false\\.$#"
3339
+
message:"#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Drawing\\:\\:imagecreatefrombmp\\(\\) should return GdImage\\|resource but returns (GdImage|resource)\\|false\\.$#"
3340
3340
count:1
3341
3341
path:src/PhpSpreadsheet/Shared/Drawing.php
3342
3342
3343
3343
-
3344
-
message:"#^Parameter \\#1 \\$fp of function feof expects resource, resource\\|false given\\.$#"
3344
+
message:"#^Parameter \\#1 \\$(fp|stream) of function feof expects resource, resource\\|false given\\.$#"
3345
3345
count:1
3346
3346
path:src/PhpSpreadsheet/Shared/Drawing.php
3347
3347
3348
3348
-
3349
-
message:"#^Parameter \\#1 \\$fp of function fread expects resource, resource\\|false given\\.$#"
3349
+
message:"#^Parameter \\#1 \\$(fp|stream) of function fread expects resource, resource\\|false given\\.$#"
3350
3350
count:2
3351
3351
path:src/PhpSpreadsheet/Shared/Drawing.php
3352
3352
3353
3353
-
3354
-
message:"#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#"
3354
+
message:"#^Parameter \\#1 \\$im(age)? of function imagecolorallocate expects (GdImage|resource), (GdImage|resource)\\|false given\\.$#"
3355
3355
count:1
3356
3356
path:src/PhpSpreadsheet/Shared/Drawing.php
3357
3357
3358
3358
-
3359
-
message:"#^Parameter \\#1 \\$im of function imagesetpixel expects resource, resource\\|false given\\.$#"
3359
+
message:"#^Parameter \\#1 \\$im(age)? of function imagesetpixel expects (GdImage|resource), (GdImage|resource)\\|false given\\.$#"
3360
3360
count:1
3361
3361
path:src/PhpSpreadsheet/Shared/Drawing.php
3362
3362
3363
3363
-
3364
-
message:"#^Parameter \\#1 \\$x_size of function imagecreatetruecolor expects int, float\\|int given\\.$#"
3364
+
message:"#^Parameter \\#1 \\$(x_size|width) of function imagecreatetruecolor expects int, float\\|int given\\.$#"
3365
3365
count:1
3366
3366
path:src/PhpSpreadsheet/Shared/Drawing.php
3367
3367
3368
3368
-
3369
-
message:"#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#"
3369
+
message:"#^Parameter \\#2 \\$(data|string) of function unpack expects string, string\\|false given\\.$#"
3370
3370
count:1
3371
3371
path:src/PhpSpreadsheet/Shared/Drawing.php
3372
3372
@@ -3376,7 +3376,7 @@ parameters:
3376
3376
path:src/PhpSpreadsheet/Shared/Drawing.php
3377
3377
3378
3378
-
3379
-
message:"#^Parameter \\#2 \\$y_size of function imagecreatetruecolor expects int, float\\|int given\\.$#"
3379
+
message:"#^Parameter \\#2 \\$(y_size|height) of function imagecreatetruecolor expects int, float\\|int given\\.$#"
3380
3380
count:1
3381
3381
path:src/PhpSpreadsheet/Shared/Drawing.php
3382
3382
@@ -3396,7 +3396,7 @@ parameters:
3396
3396
path:src/PhpSpreadsheet/Shared/Drawing.php
3397
3397
3398
3398
-
3399
-
message:"#^Parameter \\#4 \\$col of function imagesetpixel expects int, int\\|false given\\.$#"
3399
+
message:"#^Parameter \\#4 \\$col(or)? of function imagesetpixel expects int, int\\|false given\\.$#"
3400
3400
count:1
3401
3401
path:src/PhpSpreadsheet/Shared/Drawing.php
3402
3402
@@ -3596,7 +3596,7 @@ parameters:
3596
3596
path:src/PhpSpreadsheet/Shared/JAMA/Matrix.php
3597
3597
3598
3598
-
3599
-
message:"#^Parameter \\#1 \\$str of function trim expects string, float\\|int given\\.$#"
3599
+
message:"#^Parameter \\#1 \\$str(ing)? of function trim expects string, float\\|int given\\.$#"
3600
3600
count:1
3601
3601
path:src/PhpSpreadsheet/Shared/JAMA/Matrix.php
3602
3602
@@ -3676,7 +3676,7 @@ parameters:
3676
3676
path:src/PhpSpreadsheet/Shared/OLE.php
3677
3677
3678
3678
-
3679
-
message:"#^Parameter \\#2 \\$data of function unpack expects string, string\\|false given\\.$#"
3679
+
message:"#^Parameter \\#2 \\$(data|string) of function unpack expects string, string\\|false given\\.$#"
3680
3680
count:3
3681
3681
path:src/PhpSpreadsheet/Shared/OLE.php
3682
3682
@@ -3716,7 +3716,7 @@ parameters:
3716
3716
path:src/PhpSpreadsheet/Shared/OLE.php
3717
3717
3718
3718
-
3719
-
message:"#^Parameter \\#1 \\$var of function count expects array\\|Countable, string given\\.$#"
3719
+
message:"#^Parameter \\#1 \\$(var|value) of function count expects array\\|Countable, string given\\.$#"
0 commit comments