Skip to content

Commit 11eafa6

Browse files
Static Content Deploy - Replace in_array(array_keys($array)) by isset($array)
1 parent db0dce6 commit 11eafa6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,14 @@ public function getAlternativesExtensionsNames()
168168
{
169169
return array_keys($this->alternatives);
170170
}
171+
172+
/**
173+
* Check if file extension supported
174+
* @param $ext string
175+
* @return bool
176+
*/
177+
public function isExtensionSupported($ext)
178+
{
179+
return isset($this->alternatives[$ext]);
180+
}
171181
}

lib/internal/Magento/Framework/View/Asset/PreProcessor/FileNameResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function resolve($fileName)
3838
$compiledFile = $fileName;
3939
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
4040
foreach ($this->alternativeSources as $name => $alternative) {
41-
if (in_array($extension, $alternative->getAlternativesExtensionsNames(), true)
41+
if ($alternative->isExtensionSupported($extension)
4242
&& strpos(basename($fileName), '_') !== 0
4343
) {
4444
$compiledFile = substr($fileName, 0, strlen($fileName) - strlen($extension) - 1);

0 commit comments

Comments
 (0)