diff vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.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/Files/LineLengthSniff.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/LineLengthSniff.php	Thu Feb 28 13:21:36 2019 +0000
@@ -1,12 +1,18 @@
 <?php
 /**
- * Drupal_Sniffs_Files_LineLengthSniff.
+ * \Drupal\Sniffs\Files\LineLengthSniff.
  *
  * @category PHP
  * @package  PHP_CodeSniffer
  * @link     http://pear.php.net/package/PHP_CodeSniffer
  */
 
+namespace Drupal\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff as GenericLineLengthSniff;
+use PHP_CodeSniffer\Util\Tokens;
+
 /**
  * Checks comment lines in the file, and throws warnings if they are over 80
  * characters in length.
@@ -15,7 +21,7 @@
  * @package  PHP_CodeSniffer
  * @link     http://pear.php.net/package/PHP_CodeSniffer
  */
-class Drupal_Sniffs_Files_LineLengthSniff extends Generic_Sniffs_Files_LineLengthSniff
+class LineLengthSniff extends GenericLineLengthSniff
 {
 
     /**
@@ -39,15 +45,15 @@
     /**
      * Checks if a line is too long.
      *
-     * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
-     * @param array                $tokens    The token stack.
-     * @param int                  $stackPtr  The first token on the next line.
+     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+     * @param array                       $tokens    The token stack.
+     * @param int                         $stackPtr  The first token on the next line.
      *
      * @return void
      */
-    protected function checkLineLength(PHP_CodeSniffer_File $phpcsFile, $tokens, $stackPtr)
+    protected function checkLineLength($phpcsFile, $tokens, $stackPtr)
     {
-        if (isset(PHP_CodeSniffer_Tokens::$commentTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
+        if (isset(Tokens::$commentTokens[$tokens[($stackPtr - 1)]['code']]) === true) {
             $doc_comment_tag = $phpcsFile->findFirstOnLine(T_DOC_COMMENT_TAG, ($stackPtr - 1));
             if ($doc_comment_tag !== false) {
                 // Allow doc comment tags such as long @param tags to exceed the 80
@@ -105,12 +111,12 @@
     /**
      * Returns the length of a defined line.
      *
-     * @param PHP_CodeSniffer_File $phpcsFile   The file being scanned.
-     * @param int                  $currentLine The current line.
+     * @param \PHP_CodeSniffer\Files\File $phpcsFile   The file being scanned.
+     * @param int                         $currentLine The current line.
      *
      * @return int
      */
-    public function getLineLength(PHP_CodeSniffer_File $phpcsFile, $currentLine)
+    public function getLineLength(File $phpcsFile, $currentLine)
     {
         $tokens = $phpcsFile->getTokens();