vendor: Upgrade JShrink to version 1.1.0

refs #10044
This commit is contained in:
Eric Lippmann 2015-09-01 13:00:00 +02:00
parent d4669c7832
commit 63734b923a
2 changed files with 21 additions and 21 deletions

View File

@ -222,7 +222,7 @@ class Minifier
default:
// check for some regex that breaks stuff
if ($this->a == '/' && ($this->b == '\'' || $this->b == '"')) {
if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) {
$this->saveRegex();
continue;
}
@ -311,10 +311,10 @@ class Minifier
$this->c = $this->getChar();
if ($this->c == '/') {
if ($this->c === '/') {
return $this->processOneLineComments($startIndex);
} elseif ($this->c == '*') {
} elseif ($this->c === '*') {
return $this->processMultiLineComments($startIndex);
}
@ -336,7 +336,7 @@ class Minifier
$this->getNext("\n");
if ($thirdCommentString == '@') {
$endPoint = ($this->index) - $startIndex;
$endPoint = $this->index - $startIndex;
unset($this->c);
$char = "\n" . substr($this->input, $startIndex, $endPoint);
} else {
@ -369,8 +369,8 @@ class Minifier
$char = $this->getChar(); // get next real character
// Now we reinsert conditional comments and YUI-style licensing comments
if (($this->options['flaggedComments'] && $thirdCommentString == '!')
|| ($thirdCommentString == '@') ) {
if (($this->options['flaggedComments'] && $thirdCommentString === '!')
|| ($thirdCommentString === '@') ) {
// If conditional comments or flagged comments are not the first thing in the script
// we need to echo a and fill it with a space before moving on.
@ -379,7 +379,7 @@ class Minifier
$this->a = " ";
// If the comment started on a new line we let it stay on the new line
if ($this->input[($startIndex - 1)] == "\n") {
if ($this->input[($startIndex - 1)] === "\n") {
echo "\n";
}
}
@ -444,7 +444,7 @@ class Minifier
$this->a = $this->b;
// If this isn't a string we don't need to do anything.
if ($this->a != "'" && $this->a != '"') {
if ($this->a !== "'" && $this->a !== '"') {
return;
}
@ -455,7 +455,7 @@ class Minifier
echo $this->a;
// Loop until the string is done
while (1) {
while (true) {
// Grab the very next character and load it into a
$this->a = $this->getChar();
@ -485,7 +485,7 @@ class Minifier
$this->b = $this->getChar();
// If b is a new line we discard a and b and restart the loop.
if ($this->b == "\n") {
if ($this->b === "\n") {
break;
}
@ -513,15 +513,15 @@ class Minifier
echo $this->a . $this->b;
while (($this->a = $this->getChar()) !== false) {
if($this->a == '/')
if($this->a === '/')
break;
if ($this->a == '\\') {
if ($this->a === '\\') {
echo $this->a;
$this->a = $this->getChar();
}
if($this->a == "\n")
if($this->a === "\n")
throw new \RuntimeException('Unclosed regex pattern at position: ' . $this->index);
echo $this->a;
@ -537,7 +537,7 @@ class Minifier
*/
protected static function isAlphaNumeric($char)
{
return preg_match('/^[\w\$]$/', $char) === 1 || $char == '/';
return preg_match('/^[\w\$\pL]$/', $char) === 1 || $char == '/';
}
/**
@ -552,14 +552,14 @@ class Minifier
$lock = '"LOCK---' . crc32(time()) . '"';
$matches = array();
preg_match('/([+-])(\s+)([+-])/', $js, $matches);
preg_match('/([+-])(\s+)([+-])/S', $js, $matches);
if (empty($matches)) {
return $js;
}
$this->locks[$lock] = $matches[2];
$js = preg_replace('/([+-])\s+([+-])/', "$1{$lock}$2", $js);
$js = preg_replace('/([+-])\s+([+-])/S', "$1{$lock}$2", $js);
/* -- */
return $js;
@ -573,7 +573,7 @@ class Minifier
*/
protected function unlock($js)
{
if (!count($this->locks)) {
if (empty($this->locks)) {
return $js;
}

View File

@ -1,4 +1,4 @@
curl https://codeload.github.com/tedious/JShrink/tar.gz/v1.0.1 -o JShrink-1.0.1.tar.gz
tar xzf JShrink-1.0.1.tar.gz --strip-components 1 JShrink-1.0.1/LICENSE
tar xzf JShrink-1.0.1.tar.gz --strip-components 3 JShrink-1.0.1/src/JShrink/Minifier.php
rm JShrink-1.0.1.tar.gz
curl https://codeload.github.com/tedious/JShrink/tar.gz/v1.1.0 -o JShrink-1.1.0.tar.gz
tar xzf JShrink-1.1.0.tar.gz --strip-components 1 JShrink-1.1.0/LICENSE
tar xzf JShrink-1.1.0.tar.gz --strip-components 3 JShrink-1.1.0/src/JShrink/Minifier.php
rm JShrink-1.1.0.tar.gz