From 3eb083c79cf4f5f2011b316efcef380cde6ac0cd Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Fri, 4 Aug 2023 21:35:22 +0800 Subject: [PATCH] Dev: Define the exception. --- system/Pager/Exceptions/PagerException.php | 14 ++++++++++++-- system/Publisher/Exceptions/PublisherException.php | 12 +++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/system/Pager/Exceptions/PagerException.php b/system/Pager/Exceptions/PagerException.php index db6868ee945f..6f1032f7281d 100644 --- a/system/Pager/Exceptions/PagerException.php +++ b/system/Pager/Exceptions/PagerException.php @@ -15,12 +15,22 @@ class PagerException extends FrameworkException { - public static function forInvalidTemplate(?string $template = null): self + /** + * Throws when the template is invalid. + * + * @return static + */ + public static function forInvalidTemplate(?string $template = null) { return new static(lang('Pager.invalidTemplate', [$template])); } - public static function forInvalidPaginationGroup(?string $group = null): self + /** + * Throws when the group is invalid. + * + * @return static + */ + public static function forInvalidPaginationGroup(?string $group = null) { return new static(lang('Pager.invalidPaginationGroup', [$group])); } diff --git a/system/Publisher/Exceptions/PublisherException.php b/system/Publisher/Exceptions/PublisherException.php index ce457b70f99c..5204897c975e 100644 --- a/system/Publisher/Exceptions/PublisherException.php +++ b/system/Publisher/Exceptions/PublisherException.php @@ -25,24 +25,30 @@ class PublisherException extends FrameworkException * * @param string $from The source file * @param string $to The destination file + * + * @return static */ - public static function forCollision(string $from, string $to): self + public static function forCollision(string $from, string $to) { return new static(lang('Publisher.collision', [filetype($to), $from, $to])); } /** * Throws when given a destination that is not in the list of allowed directories. + * + * @return static */ - public static function forDestinationNotAllowed(string $destination): self + public static function forDestinationNotAllowed(string $destination) { return new static(lang('Publisher.destinationNotAllowed', [$destination])); } /** * Throws when a file fails to match the allowed pattern for its destination. + * + * @return static */ - public static function forFileNotAllowed(string $file, string $directory, string $pattern): self + public static function forFileNotAllowed(string $file, string $directory, string $pattern) { return new static(lang('Publisher.fileNotAllowed', [$file, $directory, $pattern])); }