Skip to content

Commit

Permalink
Cleanup code so that PHPStan exception is not needed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paulijar committed Jan 13, 2024
1 parent cc60fd3 commit 96f7956
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Utility/HtmlUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 96f7956

Please # to comment.