Skip to content

Commit

Permalink
Merge pull request #314 from thephpleague/psalm-level-4
Browse files Browse the repository at this point in the history
Bump up psalm to level 4.
  • Loading branch information
tgalopin committed Mar 4, 2021
2 parents 63d0d0a + 0c86623 commit 366bc4d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="5"
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down
20 changes: 10 additions & 10 deletions src/Manipulators/Border.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public function getDpr()
public function runOverlay(Image $image, $width, $color)
{
return $image->rectangle(
$width / 2,
$width / 2,
$image->width() - ($width / 2),
$image->height() - ($width / 2),
(int) round($width / 2),
(int) round($width / 2),
(int) round($image->width() - ($width / 2)),
(int) round($image->height() - ($width / 2)),
function ($draw) use ($width, $color) {
$draw->border($width, $color);
}
Expand All @@ -161,12 +161,12 @@ public function runShrink(Image $image, $width, $color)
{
return $image
->resize(
$image->width() - ($width * 2),
$image->height() - ($width * 2)
(int) round($image->width() - ($width * 2)),
(int) round($image->height() - ($width * 2))
)
->resizeCanvas(
$width * 2,
$width * 2,
(int) round($width * 2),
(int) round($width * 2),
'center',
true,
$color
Expand All @@ -185,8 +185,8 @@ public function runShrink(Image $image, $width, $color)
public function runExpand(Image $image, $width, $color)
{
return $image->resizeCanvas(
$width * 2,
$width * 2,
(int) round($width * 2),
(int) round($width * 2),
'center',
true,
$color
Expand Down
4 changes: 2 additions & 2 deletions src/Manipulators/Helpers/Dimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class Dimension
/**
* The device pixel ratio.
*
* @var int
* @var float
*/
protected $dpr;

/**
* Create dimension helper instance.
*
* @param Image $image The source image.
* @param int $dpr The device pixel ratio.
* @param float $dpr The device pixel ratio.
*/
public function __construct(Image $image, $dpr = 1)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Orientation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function run(Image $image)
return $image->orientate();
}

return $image->rotate($orientation);
return $image->rotate((float) $orientation);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Manipulators/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ public function resolveMissingDimensions(Image $image, $width, $height)
/**
* Apply the device pixel ratio.
*
* @param int $width The target image width.
* @param int $height The target image height.
* @param int $dpr The device pixel ratio.
* @param int $width The target image width.
* @param int $height The target image height.
* @param float $dpr The device pixel ratio.
*
* @return int[] The modified width and height.
*/
Expand All @@ -195,8 +195,8 @@ public function applyDpr($width, $height, $dpr)
$height = $height * $dpr;

return [
(int) $width,
(int) $height,
(int) round($width),
(int) round($height),
];
}

Expand Down

0 comments on commit 366bc4d

Please sign in to comment.