diff vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/vendor/squizlabs/php_codesniffer/src/Tokenizers/JS.php	Thu May 09 15:34:47 2019 +0100
@@ -257,7 +257,7 @@
      * @param string                  $eolChar The EOL char used in the content.
      *
      * @return void
-     * @throws TokenizerException If the file appears to be minified.
+     * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the file appears to be minified.
      */
     public function __construct($content, Config $config, $eolChar='\n')
     {
@@ -265,7 +265,7 @@
             throw new TokenizerException('File appears to be minified and cannot be processed');
         }
 
-        return parent::__construct($content, $config, $eolChar);
+        parent::__construct($content, $config, $eolChar);
 
     }//end __construct()
 
@@ -446,14 +446,7 @@
             // Special case for T_DIVIDE which can actually be
             // the start of a regular expression.
             if ($buffer === $char && $char === '/' && $chars[($i + 1)] !== '*') {
-                $regex = $this->getRegexToken(
-                    $i,
-                    $string,
-                    $chars,
-                    $tokens,
-                    $this->eolChar
-                );
-
+                $regex = $this->getRegexToken($i, $string, $chars, $tokens);
                 if ($regex !== null) {
                     $tokens[] = [
                         'code'    => T_REGULAR_EXPRESSION,
@@ -832,7 +825,7 @@
                 $numLines   = count($tokenLines);
 
                 for ($i = 0; $i < $numLines; $i++) {
-                    $newToken['content'] = $tokenLines[$i];
+                    $newToken = ['content' => $tokenLines[$i]];
                     if ($i === ($numLines - 1)) {
                         if ($tokenLines[$i] === '') {
                             break;
@@ -918,7 +911,7 @@
      * @param string $chars  An array of characters being tokenized.
      * @param string $tokens The current array of tokens found in the string.
      *
-     * @return void
+     * @return array<string, string>|null
      */
     public function getRegexToken($char, $string, $chars, $tokens)
     {
@@ -1111,8 +1104,8 @@
                 && isset($this->tokens[$i]['scope_condition']) === false
                 && isset($this->tokens[$i]['bracket_closer']) === true
             ) {
-                $condition = end($this->tokens[$i]['conditions']);
-                reset($this->tokens[$i]['conditions']);
+                $condition = $this->tokens[$i]['conditions'];
+                $condition = end($condition);
                 if ($condition === T_CLASS) {
                     // Possibly an ES6 method. To be classified as one, the previous
                     // non-empty tokens need to be a set of parenthesis, and then a string