Skip to content

Commit

Permalink
fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Feb 7, 2025
1 parent 9924364 commit c11f321
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/Asset/TemplateAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ class TemplateAsset
* @var string|null
*/
private $entriesField;
/**
* @var bool
*/
private $initialized = false;

private bool $initialized = false;
/**
* @var array
*/
private $templateData;

public function __construct(private array $bundleConfig, private readonly string $webDir, private readonly Environment $twig, private PageEntrypoints $pageEntrypoints)
public function __construct(
private array $bundleConfig,
private readonly string $webDir,
private readonly Environment $twig,
private PageEntrypoints $pageEntrypoints
)
{
}

Expand Down Expand Up @@ -114,7 +117,7 @@ public function inlineCssLinkTag()

preg_match_all('@<link rel="stylesheet" href="([^"]+)">@i', $styleTags, $matches);

if (isset($matches[1]) && !empty($matches[1])) {
if (!empty($matches[1])) {
$inlineCss = implode("\n", array_map(fn($path) => file_get_contents($this->webDir.preg_replace('@<link rel="stylesheet" href="([^"]+)">@i', '$1', $path)), $matches[1]));

return $inlineCss;
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/TemplateAssetGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function inlineCssLinkTag(EntrypointCollection $collection, string $templ

preg_match_all('@<link rel="stylesheet" href="([^"]+)">@i', $styleTags, $matches);

if (isset($matches[1]) && !empty($matches[1])) {
if (!empty($matches[1])) {
$inlineCss = implode("\n", array_map(fn($path) => file_get_contents($this->webDir.preg_replace('@<link rel="stylesheet" href="([^"]+)">@i', '$1', $path)), $matches[1]));

return $inlineCss;
Expand Down

0 comments on commit c11f321

Please sign in to comment.