diff --git a/phpstan-baseline.php b/phpstan-baseline.php index c31e87d7cee4..94afb2a65be7 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1146,56 +1146,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Helpers/filesystem_helper.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoNameField\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoTemplate\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:isBot\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:attachHoneypot\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Honeypot.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:hasContent\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Honeypot/Honeypot.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:setTestNow\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/I18n/Time.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/I18n/Time.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:setTestNow\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/I18n/TimeLegacy.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/I18n/TimeLegacy.php', -]; $ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#', 'count' => 1, diff --git a/system/Honeypot/Exceptions/HoneypotException.php b/system/Honeypot/Exceptions/HoneypotException.php index 8d8510eca8fa..31d13151e980 100644 --- a/system/Honeypot/Exceptions/HoneypotException.php +++ b/system/Honeypot/Exceptions/HoneypotException.php @@ -16,21 +16,41 @@ class HoneypotException extends ConfigException implements ExceptionInterface { + /** + * Thrown when the template value of config is empty. + * + * @return static + */ public static function forNoTemplate() { return new static(lang('Honeypot.noTemplate')); } + /** + * Thrown when the name value of config is empty. + * + * @return static + */ public static function forNoNameField() { return new static(lang('Honeypot.noNameField')); } + /** + * Thrown when the hidden value of config is false. + * + * @return static + */ public static function forNoHiddenValue() { return new static(lang('Honeypot.noHiddenValue')); } + /** + * Thrown when there are no data in the request of honeypot field. + * + * @return static + */ public static function isBot() { return new static(lang('Honeypot.theClientIsABot')); diff --git a/system/Honeypot/Honeypot.php b/system/Honeypot/Honeypot.php index 7ab0cd36737e..6e08c9df8bfe 100644 --- a/system/Honeypot/Honeypot.php +++ b/system/Honeypot/Honeypot.php @@ -59,6 +59,8 @@ public function __construct(HoneypotConfig $config) /** * Checks the request if honeypot field has data. + * + * @return bool */ public function hasContent(RequestInterface $request) { @@ -69,6 +71,8 @@ public function hasContent(RequestInterface $request) /** * Attaches Honeypot template to response. + * + * @return void */ public function attachHoneypot(ResponseInterface $response) { diff --git a/system/I18n/TimeTrait.php b/system/I18n/TimeTrait.php index 5c41618f6861..7f2068b7a30c 100644 --- a/system/I18n/TimeTrait.php +++ b/system/I18n/TimeTrait.php @@ -320,6 +320,8 @@ public function toDateTime() * @param DateTimeInterface|self|string|null $datetime * @param DateTimeZone|string|null $timezone * + * @return void + * * @throws Exception */ public static function setTestNow($datetime = null, $timezone = null, ?string $locale = null) @@ -845,6 +847,8 @@ public function subYears(int $years) /** * Returns the localized value of the date in the format 'Y-m-d H:i:s' * + * @return false|string + * * @throws Exception */ public function toDateTimeString()