From ddb0443b03e94fe9b948c637e677575579471570 Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Mon, 10 Jun 2024 09:17:56 -0400 Subject: [PATCH] requested minor adjustments from round 2 reviews --- src/Exceptions/InvalidLayerMethod.php | 2 +- src/Exceptions/InvalidQuality.php | 6 ++++-- src/Exceptions/InvalidSize.php | 10 ++++++---- src/Exceptions/PageDoesNotExist.php | 2 +- src/Exceptions/PdfDoesNotExist.php | 2 +- src/Pdf.php | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Exceptions/InvalidLayerMethod.php b/src/Exceptions/InvalidLayerMethod.php index 8ffd409..401337d 100644 --- a/src/Exceptions/InvalidLayerMethod.php +++ b/src/Exceptions/InvalidLayerMethod.php @@ -6,7 +6,7 @@ class InvalidLayerMethod extends Exception { - public static function for(int $value) + public static function for(int $value): static { return new static("Invalid layer method value ({$value})."); } diff --git a/src/Exceptions/InvalidQuality.php b/src/Exceptions/InvalidQuality.php index 34cb072..1fb8c61 100644 --- a/src/Exceptions/InvalidQuality.php +++ b/src/Exceptions/InvalidQuality.php @@ -2,9 +2,11 @@ namespace Spatie\PdfToImage\Exceptions; -class InvalidQuality extends \Exception +use Exception; + +class InvalidQuality extends Exception { - public static function for(int $value): self + public static function for(int $value): static { return new static("Quality must be between 1 and 100, {$value} given."); } diff --git a/src/Exceptions/InvalidSize.php b/src/Exceptions/InvalidSize.php index f97564e..8561791 100644 --- a/src/Exceptions/InvalidSize.php +++ b/src/Exceptions/InvalidSize.php @@ -2,19 +2,21 @@ namespace Spatie\PdfToImage\Exceptions; -class InvalidSize extends \Exception +use Exception; + +class InvalidSize extends Exception { - public static function for(int $value, string $type, string $property): self + public static function for(int $value, string $type, string $property): static { return new static(ucfirst($type)." {$property} must be greater than or equal to 0, {$value} given."); } - public static function forThumbnail(int $value, string $property): self + public static function forThumbnail(int $value, string $property): static { return self::for($value, 'thumbnail', $property); } - public static function forImage(int $value, string $property): self + public static function forImage(int $value, string $property): static { return self::for($value, 'image', $property); } diff --git a/src/Exceptions/PageDoesNotExist.php b/src/Exceptions/PageDoesNotExist.php index da41621..00c83e5 100644 --- a/src/Exceptions/PageDoesNotExist.php +++ b/src/Exceptions/PageDoesNotExist.php @@ -6,7 +6,7 @@ class PageDoesNotExist extends Exception { - public static function for(int $pageNumber): self + public static function for(int $pageNumber): static { return new static("Page {$pageNumber} does not exist."); } diff --git a/src/Exceptions/PdfDoesNotExist.php b/src/Exceptions/PdfDoesNotExist.php index dde4fbc..d908a2e 100644 --- a/src/Exceptions/PdfDoesNotExist.php +++ b/src/Exceptions/PdfDoesNotExist.php @@ -6,7 +6,7 @@ class PdfDoesNotExist extends Exception { - public static function for(string $pdfFile): self + public static function for(string $pdfFile): static { return new static("File '{$pdfFile}' does not exist."); } diff --git a/src/Pdf.php b/src/Pdf.php index 2154b48..714f08f 100644 --- a/src/Pdf.php +++ b/src/Pdf.php @@ -303,7 +303,7 @@ protected function determineOutputFormat(string $pathToImage): OutputFormat return $outputFormat; } - protected function validatePageNumbers(int ...$pageNumbers) + protected function validatePageNumbers(int ...$pageNumbers): void { $count = $this->pageCount();