Skip to content

Commit

Permalink
Changes for Phpstan 1.8.0 (#2920)
Browse files Browse the repository at this point in the history
Dependabot pushed changes. As usual for Phpstan, some changes to code are required.
  • Loading branch information
oleibman authored Jul 2, 2022
1 parent ec01a71 commit cbc8ed0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1250,11 +1250,6 @@ parameters:
count: 2
path: src/PhpSpreadsheet/DefinedName.php

-
message: "#^Cannot use array destructuring on array\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Helper/Dimension.php

-
message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
Expand Down
2 changes: 2 additions & 0 deletions src/PhpSpreadsheet/Helper/Dimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class Dimension

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

// If a UoM is specified, then convert the size to pixels for internal storage
if (isset(self::ABSOLUTE_UNITS[$unit])) {
Expand Down
8 changes: 4 additions & 4 deletions src/PhpSpreadsheet/Worksheet/MemoryDrawing.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ private function cloneResource(): void
return;
}

$width = imagesx($this->imageResource);
$height = imagesy($this->imageResource);
$width = (int) imagesx($this->imageResource);
$height = (int) imagesy($this->imageResource);

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

if ($this->imageResource !== null) {
// Get width/height
$this->width = imagesx($this->imageResource);
$this->height = imagesy($this->imageResource);
$this->width = (int) imagesx($this->imageResource);
$this->height = (int) imagesy($this->imageResource);
}

return $this;
Expand Down

0 comments on commit cbc8ed0

Please sign in to comment.