@@ -27,8 +27,8 @@ class Tokens
2727 /**
2828 * Checks if a pattern is a match for the specified token.
2929 *
30- * @param Token $token The token to be matched.
31- * @param array $pattern The pattern to be matches.
30+ * @param Token $token The token to be matched.
31+ * @param array $pattern The pattern to be matches.
3232 *
3333 * @return bool
3434 */
@@ -71,7 +71,8 @@ public static function match(Token $token, array $pattern)
7171 return true ;
7272 }
7373
74- public static function replaceTokens ($ list , array $ find , array $ replace ) {
74+ public static function replaceTokens ($ list , array $ find , array $ replace )
75+ {
7576
7677 /**
7778 * Whether the first parameter is a list.
@@ -107,7 +108,6 @@ public static function replaceTokens($list, array $find, array $replace) {
107108 $ i = 0 ;
108109
109110 while ($ i < $ list ->count ) {
110-
111111 // A sequence may not start with a comment.
112112 if ($ list ->tokens [$ i ]->type === Token::TYPE_COMMENT ) {
113113 $ newList [] = $ list ->tokens [$ i ];
@@ -137,7 +137,6 @@ public static function replaceTokens($list, array $find, array $replace) {
137137
138138 // Checking if the next tokens match the pattern described.
139139 while (($ j < $ list ->count ) && ($ k < $ findCount )) {
140-
141140 // Comments are being skipped.
142141 if ($ list ->tokens [$ j ]->type === Token::TYPE_COMMENT ) {
143142 ++$ j ;
@@ -156,7 +155,6 @@ public static function replaceTokens($list, array $find, array $replace) {
156155
157156 // Checking if the sequence was found.
158157 if ($ k === $ findCount ) {
159-
160158 // Inserting new tokens.
161159 foreach ($ replace as $ token ) {
162160 $ newList [] = $ token ;
@@ -174,5 +172,4 @@ public static function replaceTokens($list, array $find, array $replace) {
174172 return $ isList ?
175173 new TokensList ($ newList ) : TokensList::build ($ newList );
176174 }
177-
178- }
175+ }
0 commit comments