Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Protected Member Functions | Protected Attributes
LineLengthSniff Class Reference
Inheritance diagram for LineLengthSniff:

Protected Member Functions

 checkLineLength ($phpcsFile, $stackPtr, $lineContent)
 
 checkLineLength ($phpcsFile, $stackPtr, $lineContent)
 

Protected Attributes

 $previousLineContent = ''
 

Detailed Description

Line length sniff which ignores long lines in case they contain strings intended for translation.

Definition at line 13 of file LineLengthSniff.php.

Member Function Documentation

◆ checkLineLength() [1/2]

checkLineLength (   $phpcsFile,
  $stackPtr,
  $lineContent 
)
protected

{}

Definition at line 25 of file LineLengthSniff.php.

26  {
27  $previousLineRegexp = '~__\($|\bPhrase\($~';
28  $currentLineRegexp = '~__\(.+\)|\bPhrase\(.+\)~';
29  $currentLineMatch = preg_match($currentLineRegexp, $lineContent) !== 0;
30  $previousLineMatch = preg_match($previousLineRegexp, $this->previousLineContent) !== 0;
31  $this->previousLineContent = $lineContent;
32  if (! $currentLineMatch && !$previousLineMatch) {
33  parent::checkLineLength($phpcsFile, $stackPtr, $lineContent);
34  }
35  }

◆ checkLineLength() [2/2]

checkLineLength (   $phpcsFile,
  $stackPtr,
  $lineContent 
)
protected

{}

Definition at line 25 of file LineLengthSniff.php.

26  {
27  $previousLineRegexp = '~__\($|\bPhrase\($~';
28  $currentLineRegexp = '~__\(.+\)|\bPhrase\(.+\)~';
29  $currentLineMatch = preg_match($currentLineRegexp, $lineContent) !== 0;
30  $previousLineMatch = preg_match($previousLineRegexp, $this->previousLineContent) !== 0;
31  $this->previousLineContent = $lineContent;
32  if (! $currentLineMatch && !$previousLineMatch) {
33  parent::checkLineLength($phpcsFile, $stackPtr, $lineContent);
34  }
35  }

Field Documentation

◆ $previousLineContent

$previousLineContent = ''
protected

Definition at line 20 of file LineLengthSniff.php.


The documentation for this class was generated from the following file: