diff vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Strings/UnnecessaryStringConcatSniff.php	Thu Feb 28 13:21:36 2019 +0000
@@ -1,44 +1,46 @@
 <?php
 /**
- * Generic_Sniffs_Strings_UnnecessaryStringConcatSniff.
+ * \Drupal\Sniffs\Strings\UnnecessaryStringConcatSniff.
  *
  * @category  PHP
  * @package   PHP_CodeSniffer
  * @author    Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version   CVS: $Id: UnnecessaryStringConcatSniff.php 304603 2010-10-22 03:07:04Z squiz $
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
  * @link      http://pear.php.net/package/PHP_CodeSniffer
  */
 
+namespace Drupal\Sniffs\Strings;
+
+use Drupal\Sniffs\Files\LineLengthSniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Standards\Generic\Sniffs\Strings\UnnecessaryStringConcatSniff as GenericUnnecessaryStringConcatSniff;
+use PHP_CodeSniffer\Util\Tokens;
+
 /**
- * Generic_Sniffs_Strings_UnnecessaryStringConcatSniff.
- *
- * Checks that two strings are not concatenated together; suggests
- * using one string instead.
+ * Checks that two strings are not concatenated together; suggests using one string instead.
  *
  * @category  PHP
  * @package   PHP_CodeSniffer
  * @author    Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version   Release: 1.3.1
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
  * @link      http://pear.php.net/package/PHP_CodeSniffer
  */
-class Drupal_Sniffs_Strings_UnnecessaryStringConcatSniff extends Generic_Sniffs_Strings_UnnecessaryStringConcatSniff
+class UnnecessaryStringConcatSniff extends GenericUnnecessaryStringConcatSniff
 {
 
 
     /**
      * Processes this sniff, when one of its tokens is encountered.
      *
-     * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
-     * @param int                  $stackPtr  The position of the current token
-     *                                        in the stack passed in $tokens.
+     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+     * @param int                         $stackPtr  The position of the current token
+     *                                               in the stack passed in $tokens.
      *
      * @return void
      */
-    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
+    public function process(File $phpcsFile, $stackPtr)
     {
         // Work out which type of file this is for.
         $tokens = $phpcsFile->getTokens();
@@ -58,7 +60,7 @@
             return;
         }
 
-        $stringTokens = PHP_CodeSniffer_Tokens::$stringTokens;
+        $stringTokens = Tokens::$stringTokens;
         if (in_array($tokens[$prev]['code'], $stringTokens) === true
             && in_array($tokens[$next]['code'], $stringTokens) === true
         ) {
@@ -77,7 +79,7 @@
 
                 // Before we throw an error check if the string is longer than
                 // the line length limit.
-                $lineLengthLimitSniff = new Drupal_Sniffs_Files_LineLengthSniff;
+                $lineLengthLimitSniff = new LineLengthSniff;
 
                 $lineLenght   = $lineLengthLimitSniff->getLineLength($phpcsFile, $tokens[$prev]['line']);
                 $stringLength = ($lineLenght + strlen($tokens[$next]['content']) - 4);