Skip to content

Commit 2e760d3

Browse files
committed
Fix loose switch comparison
1 parent d5104d5 commit 2e760d3

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/internal/Magento/Framework/View/Page/Config/Renderer.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,18 @@ protected function getGroupAttributes($group)
349349
*/
350350
protected function addDefaultAttributes($contentType, $attributes)
351351
{
352-
switch ($contentType) {
353-
case 'js':
354-
$attributes = ' type="text/javascript" ' . $attributes;
355-
break;
352+
if ($contentType === 'js') {
353+
return ' type="text/javascript" ' . $attributes;
354+
}
356355

357-
case 'css':
358-
$attributes = ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"');
359-
break;
356+
if ($contentType === 'css') {
357+
return ' rel="stylesheet" type="text/css" ' . ($attributes ?: ' media="all"');
358+
}
360359

361-
case $this->canTypeBeFont($contentType):
362-
$attributes = 'rel="preload" as="font" crossorigin="anonymous"';
363-
break;
360+
if ($this->canTypeBeFont($contentType)) {
361+
return 'rel="preload" as="font" crossorigin="anonymous"';
364362
}
363+
365364
return $attributes;
366365
}
367366

0 commit comments

Comments
 (0)