Skip to content

Commit 9352217

Browse files
committed
Remove null check on $type when testing for a CSS URL pattern and reduce the conditional code
1 parent 344f13e commit 9352217

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,9 @@ private function makeImportsBare(string $content, array &$dependencies, array &$
339339
private function resolveUrlPattern(string $packageName, string $path, ImportMapType $type = null): string
340340
{
341341
// The URL for the es-module-shims polyfill package uses the CSS pattern to
342-
// prevent a syntax error in the browser console.
343-
if (self::ES_MODULE_SHIMS === $packageName) {
344-
return self::URL_PATTERN_DIST_CSS;
345-
}
346-
347-
if (str_ends_with($path, '.css') || ($type && ImportMapType::CSS === $type)) {
342+
// prevent a syntax error in the browser console, so check the package name
343+
// as part of the condition.
344+
if (self::ES_MODULE_SHIMS === $packageName || str_ends_with($path, '.css') || ImportMapType::CSS === $type) {
348345
return self::URL_PATTERN_DIST_CSS;
349346
}
350347

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy