Skip to content

Commit cbc8ed0

Browse files
authored
Changes for Phpstan 1.8.0 (#2920)
Dependabot pushed changes. As usual for Phpstan, some changes to code are required.
1 parent ec01a71 commit cbc8ed0

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,11 +1250,6 @@ parameters:
12501250
count: 2
12511251
path: src/PhpSpreadsheet/DefinedName.php
12521252

1253-
-
1254-
message: "#^Cannot use array destructuring on array\\|null\\.$#"
1255-
count: 1
1256-
path: src/PhpSpreadsheet/Helper/Dimension.php
1257-
12581253
-
12591254
message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
12601255
count: 1

src/PhpSpreadsheet/Helper/Dimension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class Dimension
5757

5858
public function __construct(string $dimension)
5959
{
60+
// @phpstan-ignore-next-line
6061
[$size, $unit] = sscanf($dimension, '%[1234567890.]%s');
6162
$unit = strtolower(trim($unit ?? ''));
63+
$size = (float) $size;
6264

6365
// If a UoM is specified, then convert the size to pixels for internal storage
6466
if (isset(self::ABSOLUTE_UNITS[$unit])) {

src/PhpSpreadsheet/Worksheet/MemoryDrawing.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ private function cloneResource(): void
8686
return;
8787
}
8888

89-
$width = imagesx($this->imageResource);
90-
$height = imagesy($this->imageResource);
89+
$width = (int) imagesx($this->imageResource);
90+
$height = (int) imagesy($this->imageResource);
9191

9292
if (imageistruecolor($this->imageResource)) {
9393
$clone = imagecreatetruecolor($width, $height);
@@ -150,8 +150,8 @@ public function setImageResource($value)
150150

151151
if ($this->imageResource !== null) {
152152
// Get width/height
153-
$this->width = imagesx($this->imageResource);
154-
$this->height = imagesy($this->imageResource);
153+
$this->width = (int) imagesx($this->imageResource);
154+
$this->height = (int) imagesy($this->imageResource);
155155
}
156156

157157
return $this;

0 commit comments

Comments
 (0)