From 96f795666cd939a1532f3f5494aae644a4264df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pauli=20J=C3=A4rvinen?= Date: Sat, 13 Jan 2024 19:26:35 +0200 Subject: [PATCH] Cleanup code so that PHPStan exception is not needed Our previous way of using `method_exists` for `OCP\Util\addInitScript` was flagged by PHPStan. Writing the method call a bit differently solved this. Unfortunately, Scrutinizer is a bit more stupid here and still requires an inline suppression also with this modified version. --- lib/Utility/HtmlUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Utility/HtmlUtil.php b/lib/Utility/HtmlUtil.php index 779a6232c..853260f42 100644 --- a/lib/Utility/HtmlUtil.php +++ b/lib/Utility/HtmlUtil.php @@ -89,7 +89,7 @@ private static function partialContent(string $partialName) { public static function addWebpackScript(string $name) { $manifest = self::getManifest(); $hashedName = \substr($manifest["$name.js"], 0, -3); // the extension is cropped from the name in $manifest - if (\method_exists('\OCP\Util', 'addInitScript')) { + if (\method_exists(\OCP\Util::class, 'addInitScript')) { \OCP\Util::/** @scrutinizer ignore-call */addInitScript('music', '../dist/' . $hashedName); } else { \OCP\Util::addScript('music', '../dist/' . $hashedName);