11<?php
22
3+ declare (strict_types=1 );
4+
35namespace SymfonyCustom \Sniffs \Commenting ;
46
57use PHP_CodeSniffer \Files \File ;
@@ -28,7 +30,7 @@ public function process(File $phpcsFile, $stackPtr): void
2830
2931 if (!isset ($ tokens [$ stackPtr ]['comment_closer ' ])
3032 || ('' === $ tokens [$ tokens [$ stackPtr ]['comment_closer ' ]]['content ' ]
31- && ( $ phpcsFile ->numTokens - 1 ) === $ tokens [$ stackPtr ]['comment_closer ' ])
33+ && $ phpcsFile ->numTokens - 1 === $ tokens [$ stackPtr ]['comment_closer ' ])
3234 ) {
3335 // Don't process an unfinished comment during live coding.
3436 return ;
@@ -41,7 +43,7 @@ public function process(File $phpcsFile, $stackPtr): void
4143 T_DOC_COMMENT_STAR ,
4244 ];
4345
44- $ short = $ phpcsFile ->findNext ($ empty , ( $ stackPtr + 1 ) , $ commentEnd , true );
46+ $ short = $ phpcsFile ->findNext ($ empty , $ stackPtr + 1 , $ commentEnd , true );
4547 if (false === $ short ) {
4648 // No content at all.
4749 $ next = $ phpcsFile ->findNext (T_WHITESPACE , $ commentEnd + 1 , null , true );
@@ -87,7 +89,7 @@ public function process(File $phpcsFile, $stackPtr): void
8789
8890 if ($ fix ) {
8991 $ phpcsFile ->fixer ->beginChangeset ();
90- for ($ i = ( $ stackPtr + 1 ) ; $ i < $ short ; $ i ++) {
92+ for ($ i = $ stackPtr + 1 ; $ i < $ short ; $ i ++) {
9193 $ phpcsFile ->fixer ->replaceToken ($ i , '' );
9294 }
9395 $ phpcsFile ->fixer ->addNewline ($ stackPtr );
@@ -104,7 +106,7 @@ public function process(File $phpcsFile, $stackPtr): void
104106 }
105107
106108 // Check for additional blank lines at the beginning of the comment.
107- if ($ tokens [$ stackPtr ]['line ' ] < ( $ tokens [$ short ]['line ' ] - 1 ) ) {
109+ if ($ tokens [$ stackPtr ]['line ' ] < $ tokens [$ short ]['line ' ] - 1 ) {
108110 $ fix = $ phpcsFile ->addFixableError (
109111 'Additional blank lines found at beginning of doc comment ' ,
110112 $ stackPtr ,
@@ -113,8 +115,8 @@ public function process(File $phpcsFile, $stackPtr): void
113115
114116 if ($ fix ) {
115117 $ phpcsFile ->fixer ->beginChangeset ();
116- for ($ i = ( $ stackPtr + 1 ) ; $ i < $ short ; $ i ++) {
117- if ($ tokens [( $ i + 1 ) ]['line ' ] === $ tokens [$ short ]['line ' ]) {
118+ for ($ i = $ stackPtr + 1 ; $ i < $ short ; $ i ++) {
119+ if ($ tokens [$ i + 1 ]['line ' ] === $ tokens [$ short ]['line ' ]) {
118120 break ;
119121 }
120122
@@ -126,7 +128,7 @@ public function process(File $phpcsFile, $stackPtr): void
126128 }
127129
128130 // The last line of the comment should just be the */ code.
129- $ prev = $ phpcsFile ->findPrevious ($ empty , ( $ commentEnd - 1 ) , $ stackPtr , true );
131+ $ prev = $ phpcsFile ->findPrevious ($ empty , $ commentEnd - 1 , $ stackPtr , true );
130132 if (!$ isSingleLine && $ tokens [$ prev ]['line ' ] === $ tokens [$ commentEnd ]['line ' ]) {
131133 $ fix = $ phpcsFile ->addFixableError (
132134 'The close comment tag must be the only content on the line ' ,
@@ -136,7 +138,7 @@ public function process(File $phpcsFile, $stackPtr): void
136138
137139 if ($ fix ) {
138140 $ phpcsFile ->fixer ->beginChangeset ();
139- for ($ i = ( $ prev + 1 ) ; $ i < $ commentEnd ; $ i ++) {
141+ for ($ i = $ prev + 1 ; $ i < $ commentEnd ; $ i ++) {
140142 $ phpcsFile ->fixer ->replaceToken ($ i , '' );
141143 }
142144 $ phpcsFile ->fixer ->replaceToken (
@@ -153,7 +155,7 @@ public function process(File $phpcsFile, $stackPtr): void
153155 }
154156
155157 // Check for additional blank lines at the end of the comment.
156- if ($ tokens [$ prev ]['line ' ] < ( $ tokens [$ commentEnd ]['line ' ] - 1 ) ) {
158+ if ($ tokens [$ prev ]['line ' ] < $ tokens [$ commentEnd ]['line ' ] - 1 ) {
157159 $ fix = $ phpcsFile ->addFixableError (
158160 'Additional blank lines found at end of doc comment ' ,
159161 $ commentEnd ,
@@ -162,8 +164,8 @@ public function process(File $phpcsFile, $stackPtr): void
162164
163165 if ($ fix ) {
164166 $ phpcsFile ->fixer ->beginChangeset ();
165- for ($ i = ( $ prev + 1 ) ; $ i < $ commentEnd ; $ i ++) {
166- if ($ tokens [( $ i + 1 ) ]['line ' ] === $ tokens [$ commentEnd ]['line ' ]) {
167+ for ($ i = $ prev + 1 ; $ i < $ commentEnd ; $ i ++) {
168+ if ($ tokens [$ i + 1 ]['line ' ] === $ tokens [$ commentEnd ]['line ' ]) {
167169 break ;
168170 }
169171
0 commit comments