1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-06 14:16:28 +02:00

php-cs-fixer fix

This commit is contained in:
Elan Ruusamäe
2017-04-18 18:24:17 +03:00
parent b6e4b7f152
commit 80c01c6f02
7 changed files with 11 additions and 4 deletions

View File

@@ -517,7 +517,6 @@ class Minify
if ($file if ($file
&& !isset($minifyOptions['currentDir']) && !isset($minifyOptions['currentDir'])
&& !isset($minifyOptions['prependRelativePath'])) { && !isset($minifyOptions['prependRelativePath'])) {
$minifyOptions['currentDir'] = dirname($file); $minifyOptions['currentDir'] = dirname($file);
$source->setMinifierOptions($minifyOptions); $source->setMinifierOptions($minifyOptions);
} }

View File

@@ -89,6 +89,7 @@ class Minify_CSS
$currentDir = $options['currentDir']; $currentDir = $options['currentDir'];
$docRoot = $options['docRoot']; $docRoot = $options['docRoot'];
$symlinks = $options['symlinks']; $symlinks = $options['symlinks'];
return Minify_CSS_UriRewriter::rewrite($css, $currentDir, $docRoot, $symlinks); return Minify_CSS_UriRewriter::rewrite($css, $currentDir, $docRoot, $symlinks);
} else { } else {
return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']); return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']);

View File

@@ -217,6 +217,7 @@ class Minify_CSS_Compressor
if (preg_match($pattern, $m, $n)) { if (preg_match($pattern, $m, $n)) {
// end hack mode after this comment, but preserve the hack and comment content // end hack mode after this comment, but preserve the hack and comment content
$this->_inHack = false; $this->_inHack = false;
return "/*/{$n[1]}/**/"; return "/*/{$n[1]}/**/";
} }
} }
@@ -224,18 +225,21 @@ class Minify_CSS_Compressor
if (substr($m, -1) === '\\') { // comment ends like \*/ if (substr($m, -1) === '\\') { // comment ends like \*/
// begin hack mode and preserve hack // begin hack mode and preserve hack
$this->_inHack = true; $this->_inHack = true;
return '/*\\*/'; return '/*\\*/';
} }
if ($m !== '' && $m[0] === '/') { // comment looks like /*/ foo */ if ($m !== '' && $m[0] === '/') { // comment looks like /*/ foo */
// begin hack mode and preserve hack // begin hack mode and preserve hack
$this->_inHack = true; $this->_inHack = true;
return '/*/*/'; return '/*/*/';
} }
if ($this->_inHack) { if ($this->_inHack) {
// a regular comment ends hack mode but should be preserved // a regular comment ends hack mode but should be preserved
$this->_inHack = false; $this->_inHack = false;
return '/**/'; return '/**/';
} }

View File

@@ -52,7 +52,6 @@ class Minify_CSS_UriRewriter
// normalize symlinks in order to map to link // normalize symlinks in order to map to link
foreach ($symlinks as $link => $target) { foreach ($symlinks as $link => $target) {
$link = ($link === '//') ? self::$_docRoot : str_replace('//', self::$_docRoot . '/', $link); $link = ($link === '//') ? self::$_docRoot : str_replace('//', self::$_docRoot . '/', $link);
$link = strtr($link, '/', DIRECTORY_SEPARATOR); $link = strtr($link, '/', DIRECTORY_SEPARATOR);
@@ -272,6 +271,7 @@ class Minify_CSS_UriRewriter
\\s* \\s*
\\) # ) \\) # )
/x'; /x';
return preg_replace($pattern, 'url($1)', $css); return preg_replace($pattern, 'url($1)', $css);
} }
@@ -337,6 +337,7 @@ class Minify_CSS_UriRewriter
private static function _owlifySvgPaths($css) private static function _owlifySvgPaths($css)
{ {
$pattern = '~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~'; $pattern = '~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~';
return preg_replace($pattern, '$1owl$2', $css); return preg_replace($pattern, '$1owl$2', $css);
} }
@@ -351,6 +352,7 @@ class Minify_CSS_UriRewriter
private static function _unOwlify($css) private static function _unOwlify($css)
{ {
$pattern = '~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~'; $pattern = '~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~';
return preg_replace($pattern, '$1url', $css); return preg_replace($pattern, '$1url', $css);
} }
} }

View File

@@ -62,7 +62,7 @@ class Minify_Cache_APC implements Minify_CacheInterface
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) { if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
return mb_strlen($this->_data, '8bit'); return mb_strlen($this->_data, '8bit');
} else { } else {
return strlen($this->_data);; return strlen($this->_data);
} }
} }
@@ -124,6 +124,7 @@ class Minify_Cache_APC implements Minify_CacheInterface
$ret = apc_fetch($id); $ret = apc_fetch($id);
if (false === $ret) { if (false === $ret) {
$this->_id = null; $this->_id = null;
return false; return false;
} }

View File

@@ -109,6 +109,7 @@ class Minify_Cache_File implements Minify_CacheInterface
{ {
if (!$this->locking) { if (!$this->locking) {
readfile($this->path . '/' . $id); readfile($this->path . '/' . $id);
return; return;
} }

View File

@@ -208,7 +208,6 @@ class Minify_Source implements Minify_SourceInterface
if ($this->filepath if ($this->filepath
&& !isset($this->minifyOptions['currentDir']) && !isset($this->minifyOptions['currentDir'])
&& !isset($this->minifyOptions['prependRelativePath'])) { && !isset($this->minifyOptions['prependRelativePath'])) {
$this->minifyOptions['currentDir'] = dirname($this->filepath); $this->minifyOptions['currentDir'] = dirname($this->filepath);
} }
} }