Skip to content

Commit

Permalink
Make sure error messages end with a .
Browse files Browse the repository at this point in the history
This is necessary because the twigcs vscode extension has a regex that checks for error messages ending with a dot
  • Loading branch information
mgrsskls committed Jun 17, 2022
1 parent 80c64c6 commit bf46cc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/WithOnlyRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function validateWithUsedWithOnly(Token $token, TokenStream &$tokens): ar
if (Token::WHITESPACE_TYPE === $tokens->look(Lexer::NEXT_TOKEN)->getType()) {
if (Token::NAME_TYPE === $tokens->look(2)->getType()) {
if (Token::WHITESPACE_TYPE === $tokens->look(3)->getType() && $tokens->look(4)->getValue() !== 'only') {
$violations[] = $this->createViolation($tokens->getSourceContext()->getPath(), $token->getLine(), '0', '"with" should be used along with "only"');
$violations[] = $this->createViolation($tokens->getSourceContext()->getPath(), $token->getLine(), '0', '"with" should be used along with "only".');
}
}
// If it starts "with" and is "{" count till matching "}"
Expand All @@ -83,7 +83,7 @@ public function validateWithUsedWithOnly(Token $token, TokenStream &$tokens): ar
}
}
if (!($tokens->look($look_ahead_position)->getValue() == 'only' || $tokens->look($look_ahead_position + 1)->getValue() == 'only')) {
$violations[] = $this->createViolation($tokens->getSourceContext()->getPath(), $token->getLine(), '0', '"with" should be used along with "only"');
$violations[] = $this->createViolation($tokens->getSourceContext()->getPath(), $token->getLine(), '0', '"with" should be used along with "only".');
}
}
}
Expand Down

0 comments on commit bf46cc5

Please sign in to comment.