Skip to content

Commit 366bc4d

Browse files
authored
Merge pull request #314 from thephpleague/psalm-level-4
Bump up psalm to level 4.
2 parents 63d0d0a + 0c86623 commit 366bc4d

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

psalm.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<psalm
3-
errorLevel="5"
3+
errorLevel="4"
44
resolveFromConfigFile="true"
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"

src/Manipulators/Border.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ public function getDpr()
138138
public function runOverlay(Image $image, $width, $color)
139139
{
140140
return $image->rectangle(
141-
$width / 2,
142-
$width / 2,
143-
$image->width() - ($width / 2),
144-
$image->height() - ($width / 2),
141+
(int) round($width / 2),
142+
(int) round($width / 2),
143+
(int) round($image->width() - ($width / 2)),
144+
(int) round($image->height() - ($width / 2)),
145145
function ($draw) use ($width, $color) {
146146
$draw->border($width, $color);
147147
}
@@ -161,12 +161,12 @@ public function runShrink(Image $image, $width, $color)
161161
{
162162
return $image
163163
->resize(
164-
$image->width() - ($width * 2),
165-
$image->height() - ($width * 2)
164+
(int) round($image->width() - ($width * 2)),
165+
(int) round($image->height() - ($width * 2))
166166
)
167167
->resizeCanvas(
168-
$width * 2,
169-
$width * 2,
168+
(int) round($width * 2),
169+
(int) round($width * 2),
170170
'center',
171171
true,
172172
$color
@@ -185,8 +185,8 @@ public function runShrink(Image $image, $width, $color)
185185
public function runExpand(Image $image, $width, $color)
186186
{
187187
return $image->resizeCanvas(
188-
$width * 2,
189-
$width * 2,
188+
(int) round($width * 2),
189+
(int) round($width * 2),
190190
'center',
191191
true,
192192
$color

src/Manipulators/Helpers/Dimension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ class Dimension
1616
/**
1717
* The device pixel ratio.
1818
*
19-
* @var int
19+
* @var float
2020
*/
2121
protected $dpr;
2222

2323
/**
2424
* Create dimension helper instance.
2525
*
2626
* @param Image $image The source image.
27-
* @param int $dpr The device pixel ratio.
27+
* @param float $dpr The device pixel ratio.
2828
*/
2929
public function __construct(Image $image, $dpr = 1)
3030
{

src/Manipulators/Orientation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function run(Image $image)
2424
return $image->orientate();
2525
}
2626

27-
return $image->rotate($orientation);
27+
return $image->rotate((float) $orientation);
2828
}
2929

3030
/**

src/Manipulators/Size.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ public function resolveMissingDimensions(Image $image, $width, $height)
183183
/**
184184
* Apply the device pixel ratio.
185185
*
186-
* @param int $width The target image width.
187-
* @param int $height The target image height.
188-
* @param int $dpr The device pixel ratio.
186+
* @param int $width The target image width.
187+
* @param int $height The target image height.
188+
* @param float $dpr The device pixel ratio.
189189
*
190190
* @return int[] The modified width and height.
191191
*/
@@ -195,8 +195,8 @@ public function applyDpr($width, $height, $dpr)
195195
$height = $height * $dpr;
196196

197197
return [
198-
(int) $width,
199-
(int) $height,
198+
(int) round($width),
199+
(int) round($height),
200200
];
201201
}
202202

0 commit comments

Comments
 (0)