Skip to content

Commit

Permalink
AssetRendererTrait: Bugfix wrong return type with non-existent theme …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
jnvsor committed Dec 26, 2024
1 parent 5766ba6 commit fe7be9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Binary file modified build/kint.phar
Binary file not shown.
10 changes: 8 additions & 2 deletions src/Renderer/AssetRendererTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait AssetRendererTrait
{
public static ?string $theme = null;

/** @psalm-var array{js?:string, css?:array<path, string>} */
/** @psalm-var array{js?:string, css?:array<path, string|false>} */
private static array $assetCache = [];

/** @psalm-api */
Expand All @@ -54,11 +54,17 @@ public static function renderCss(): ?string
if (!isset(self::$assetCache['css'][self::$theme])) {
if (\file_exists(KINT_DIR.'/resources/compiled/'.self::$theme)) {
self::$assetCache['css'][self::$theme] = \file_get_contents(KINT_DIR.'/resources/compiled/'.self::$theme);
} else {
} elseif (\file_exists(self::$theme)) {
self::$assetCache['css'][self::$theme] = \file_get_contents(self::$theme);
} else {
self::$assetCache['css'][self::$theme] = false;
}
}

if (false === self::$assetCache['css'][self::$theme]) {
return null;
}

return self::$assetCache['css'][self::$theme];
}
}

0 comments on commit fe7be9d

Please sign in to comment.