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:
parent
ec01a71c0b
commit
cbc8ed0845
|
|
@ -1250,11 +1250,6 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: src/PhpSpreadsheet/DefinedName.php
|
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\\.$#"
|
message: "#^Cannot call method setBold\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,10 @@ class Dimension
|
||||||
|
|
||||||
public function __construct(string $dimension)
|
public function __construct(string $dimension)
|
||||||
{
|
{
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
[$size, $unit] = sscanf($dimension, '%[1234567890.]%s');
|
[$size, $unit] = sscanf($dimension, '%[1234567890.]%s');
|
||||||
$unit = strtolower(trim($unit ?? ''));
|
$unit = strtolower(trim($unit ?? ''));
|
||||||
|
$size = (float) $size;
|
||||||
|
|
||||||
// If a UoM is specified, then convert the size to pixels for internal storage
|
// If a UoM is specified, then convert the size to pixels for internal storage
|
||||||
if (isset(self::ABSOLUTE_UNITS[$unit])) {
|
if (isset(self::ABSOLUTE_UNITS[$unit])) {
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@ class MemoryDrawing extends BaseDrawing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = imagesx($this->imageResource);
|
$width = (int) imagesx($this->imageResource);
|
||||||
$height = imagesy($this->imageResource);
|
$height = (int) imagesy($this->imageResource);
|
||||||
|
|
||||||
if (imageistruecolor($this->imageResource)) {
|
if (imageistruecolor($this->imageResource)) {
|
||||||
$clone = imagecreatetruecolor($width, $height);
|
$clone = imagecreatetruecolor($width, $height);
|
||||||
|
|
@ -150,8 +150,8 @@ class MemoryDrawing extends BaseDrawing
|
||||||
|
|
||||||
if ($this->imageResource !== null) {
|
if ($this->imageResource !== null) {
|
||||||
// Get width/height
|
// Get width/height
|
||||||
$this->width = imagesx($this->imageResource);
|
$this->width = (int) imagesx($this->imageResource);
|
||||||
$this->height = imagesy($this->imageResource);
|
$this->height = (int) imagesy($this->imageResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue