Skip to content

Commit

Permalink
vendor: Upgrade JShrink to version 1.1.0
Browse files Browse the repository at this point in the history
refs #10044
  • Loading branch information
lippserd committed Sep 1, 2015
1 parent d4669c7 commit 63734b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
34 changes: 17 additions & 17 deletions library/vendor/JShrink/Minifier.php
Expand Up @@ -222,7 +222,7 @@ protected function loop()

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;
}
Expand Down Expand Up @@ -311,10 +311,10 @@ protected function getReal()

$this->c = $this->getChar();

if ($this->c == '/') {
if ($this->c === '/') {
return $this->processOneLineComments($startIndex);

} elseif ($this->c == '*') {
} elseif ($this->c === '*') {
return $this->processMultiLineComments($startIndex);
}

Expand All @@ -336,7 +336,7 @@ protected function processOneLineComments($startIndex)
$this->getNext("\n");

if ($thirdCommentString == '@') {
$endPoint = ($this->index) - $startIndex;
$endPoint = $this->index - $startIndex;
unset($this->c);
$char = "\n" . substr($this->input, $startIndex, $endPoint);
} else {
Expand Down Expand Up @@ -369,8 +369,8 @@ protected function processMultiLineComments($startIndex)
$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.
Expand All @@ -379,7 +379,7 @@ protected function processMultiLineComments($startIndex)
$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";
}
}
Expand Down Expand Up @@ -444,7 +444,7 @@ protected function saveString()
$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;
}

Expand All @@ -455,7 +455,7 @@ protected function saveString()
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();
Expand Down Expand Up @@ -485,7 +485,7 @@ protected function saveString()
$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;
}

Expand Down Expand Up @@ -513,15 +513,15 @@ protected function saveRegex()
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;
Expand All @@ -537,7 +537,7 @@ protected function saveRegex()
*/
protected static function isAlphaNumeric($char)
{
return preg_match('/^[\w\$]$/', $char) === 1 || $char == '/';
return preg_match('/^[\w\$\pL]$/', $char) === 1 || $char == '/';
}

/**
Expand All @@ -552,14 +552,14 @@ protected function lock($js)
$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;
Expand All @@ -573,7 +573,7 @@ protected function lock($js)
*/
protected function unlock($js)
{
if (!count($this->locks)) {
if (empty($this->locks)) {
return $js;
}

Expand Down
8 changes: 4 additions & 4 deletions library/vendor/JShrink/SOURCE
@@ -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

0 comments on commit 63734b9

Please sign in to comment.