From c9a369dccd6ef91ac9b034f89ef7f8bda9706dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Wed, 26 Feb 2020 09:49:28 +0100 Subject: [PATCH] refactor(PHP): use PSR-12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow modern coding standard (#222) * Follow modern coding standard PSR2 is ancient. * style(php): fix linting errors Co-authored-by: Dominik Tränklein --- .../FeatureAdminComponentScreenshots/functions.php | 1 + inc/acf.php | 1 + inc/componentLogServer.php | 4 +++- inc/customPostTypes/example.php | 4 ++-- inc/customTaxonomies/example.php | 4 ++-- inc/fieldVariables.php | 2 ++ inc/hideProtectedPosts.php | 1 + inc/jquery.php | 2 ++ inc/mimeTypes.php | 2 ++ inc/removeEditor.php | 2 ++ inc/theContentFix.php | 14 ++++++++------ inc/timberDynamicResize.php | 2 ++ inc/timberLoader.php | 2 ++ inc/tinyMce.php | 1 + inc/yoastToBottom.php | 2 ++ inc/youtubeNoCookieEmbed.php | 2 ++ index.php | 1 + lib/ComponentManager.php | 2 +- lib/Utils/AdminNoticeManager.php | 2 +- lib/Utils/Asset.php | 9 ++++++--- lib/Utils/Log.php | 2 +- lib/Utils/TimberDynamicResize.php | 6 ++++-- phpcs.ruleset.xml | 2 +- 23 files changed, 50 insertions(+), 20 deletions(-) diff --git a/Components/FeatureAdminComponentScreenshots/functions.php b/Components/FeatureAdminComponentScreenshots/functions.php index 97f3e5e53..95cadb317 100644 --- a/Components/FeatureAdminComponentScreenshots/functions.php +++ b/Components/FeatureAdminComponentScreenshots/functions.php @@ -1,4 +1,5 @@ console.{$logType}('{$title}', '({$type})', {$output});\n"; diff --git a/lib/Utils/TimberDynamicResize.php b/lib/Utils/TimberDynamicResize.php index 53595d19d..b9cab975e 100644 --- a/lib/Utils/TimberDynamicResize.php +++ b/lib/Utils/TimberDynamicResize.php @@ -224,11 +224,13 @@ protected function generateImage($url, $w, $h, $crop, $force = false) if ($this->webpEnabled) { $fileinfo = pathinfo($resizedUrl); - if (in_array($fileinfo['extension'], [ + if ( + in_array($fileinfo['extension'], [ 'jpeg', 'jpg', 'png', - ])) { + ]) + ) { ImageHelper::img_to_webp($resizedUrl); } } diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml index 7bfd3ea66..c7064bc41 100644 --- a/phpcs.ruleset.xml +++ b/phpcs.ruleset.xml @@ -16,5 +16,5 @@ - +