Changes for Phpstan 1.8.0 (#2920)

Dependabot pushed changes. As usual for Phpstan, some changes to code are required.
This commit is contained in:
oleibman 2022-07-02 01:16:11 -07:00 committed by GitHub
parent ec01a71c0b
commit cbc8ed0845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -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

View File

@ -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])) {

View File

@ -86,8 +86,8 @@ class MemoryDrawing extends BaseDrawing
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);
@ -150,8 +150,8 @@ class MemoryDrawing extends BaseDrawing
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;