@@ -67,13 +67,10 @@ class LineLengthSniff implements Sniff
6767 *
6868 * @var integer
6969 */
70- public $ lineLimit = 120 ;
71-
70+ public $ lineLimit = 100 ;
7271
7372 /**
74- * Returns an array of tokens this test wants to listen for.
75- *
76- * @return array
73+ * @inheritdoc
7774 */
7875 public function register ()
7976 {
@@ -83,19 +80,19 @@ public function register()
8380 /**
8481 * @inheritdoc
8582 */
86- public function process (File $ phpcsFile , $ stackPtr )
83+ public function process (File $ file , $ position )
8784 {
88- $ tokens = $ phpcsFile ->getTokens ();
89- for ($ i = 1 ; $ i < $ phpcsFile ->numTokens ; $ i ++) {
85+ $ tokens = $ file ->getTokens ();
86+ $ start = max (1 , $ position );
87+ for ($ i = $ start ; $ i < $ file ->numTokens ; $ i ++) {
9088 if ($ tokens [$ i ]['column ' ] === 1 ) {
91- $ this ->checkLineLength ($ phpcsFile , $ tokens , $ i );
89+ $ this ->checkLineLength ($ file , $ tokens , $ i );
9290 }
9391 }
9492
95- $ this ->checkLineLength ($ phpcsFile , $ tokens , $ i );
96-
97- return ($ phpcsFile ->numTokens + 1 );
93+ $ this ->checkLineLength ($ file , $ tokens , $ i );
9894
95+ return ($ file ->numTokens + 1 );
9996 }
10097
10198 /**
@@ -135,7 +132,6 @@ protected function checkLineLength(File $file, array $tokens, int $position)
135132 'TooLong ' ,
136133 [$ this ->lineLimit , $ length ]
137134 );
138-
139135 }
140136
141137 /**
@@ -249,5 +245,4 @@ private function isI18nFunction(
249245
250246 return $ tokens [$ next ]['code ' ] === T_OPEN_PARENTHESIS ;
251247 }
252-
253248}
0 commit comments