From 7ae7faa3a1cfcfe385ecd2f46490d3cc4cc9f83e Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Tue, 21 Mar 2023 21:37:40 +0100 Subject: [PATCH] code review --- src/Backend.php | 8 ++++---- src/Frontend.php | 6 +++--- src/UrlHandler.php | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 377a7fc..e58275e 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -16,8 +16,7 @@ namespace Dotclear\Plugin\simplyFavicon; use dcCore; use dcNsProcess; -use path; - +use dcSettings; use Dotclear\Helper\Html\Form\{ Checkbox, Div, @@ -25,6 +24,7 @@ use Dotclear\Helper\Html\Form\{ Note, Para }; +use path; class Backend extends dcNsProcess { @@ -42,7 +42,7 @@ class Backend extends dcNsProcess } dcCore::app()->addBehaviors([ - 'adminBlogPreferencesFormV2' => function ($blog_settings) { + 'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void { $exists = []; $path = path::fullFromRoot((string) $blog_settings->get('system')->get('public_path'), DC_ROOT); foreach (['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'] as $ext) { @@ -70,7 +70,7 @@ class Backend extends dcNsProcess ) . '
'; }, - 'adminBeforeBlogSettingsUpdate' => function ($blog_settings) { + 'adminBeforeBlogSettingsUpdate' => function (dcSettings $blog_settings): void { $blog_settings->get('system')->put('simply_favicon', !empty($_POST['simply_favicon'])); }, ]); diff --git a/src/Frontend.php b/src/Frontend.php index 9525894..ee7082d 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -33,9 +33,9 @@ class Frontend extends dcNsProcess return false; } - dcCore::app()->addBehavior('publicHeadContent', function () { + dcCore::app()->addBehavior('publicHeadContent', function (): void { if (!dcCore::app()->blog->settings->get('system')->get('simply_favicon')) { - return null; + return; } $public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT) . '/favicon.'; @@ -53,7 +53,7 @@ class Frontend extends dcNsProcess '' . "\n"; // all others } else { - foreach (Urlhandler::$mimetypes as $ext => $mime) { + foreach (UrlHandler::$mimetypes as $ext => $mime) { if (in_array($ext, ['ico', 'png'])) { continue; } diff --git a/src/UrlHandler.php b/src/UrlHandler.php index 51b517a..eb38398 100644 --- a/src/UrlHandler.php +++ b/src/UrlHandler.php @@ -20,7 +20,7 @@ use path; class UrlHandler extends dcUrlHandlers { - public static $mimetypes = [ + public static array $mimetypes = [ 'ico' => 'image/x-icon', 'png' => 'image/png', 'bmp' => 'image/bmp', @@ -29,7 +29,7 @@ class UrlHandler extends dcUrlHandlers 'mng' => 'video/x-mng', ]; - public static function simplyFaviconUrl($arg) + public static function simplyFaviconUrl(string $arg): void { $public_path = path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT);