diff --git a/README.md b/README.md index 4a89451..9185a10 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Brainsum dev tools for Drupal 8 +# Brainsum dev tools for Drupal 9 [![Build Status](https://travis-ci.org/brainsum/drupal-dev-tools.svg?branch=master)](https://travis-ci.org/brainsum/drupal-dev-tools) @@ -17,7 +17,7 @@ Note: This package is not going to overwrite existing ones, but it might not wor In your project, simply use -```composer require --dev brainsum/drupal-dev-tools``` +```composer require --dev brainsum/drupal-dev-tools:^3.0``` ### Settings #### Extend diff --git a/brainsum_twigcs/src/Rule/NoQuotationMarkAttributeRule.php b/brainsum_twigcs/src/Rule/NoQuotationMarkAttributeRule.php index d772164..78db1a0 100644 --- a/brainsum_twigcs/src/Rule/NoQuotationMarkAttributeRule.php +++ b/brainsum_twigcs/src/Rule/NoQuotationMarkAttributeRule.php @@ -23,14 +23,17 @@ public function check(TokenStream $tokens) Token::VAR_START_TYPE === $tokens->look(Lexer::NEXT_TOKEN)->getType() && Token::WHITESPACE_TYPE === $tokens->look(2)->getType() && Token::NAME_TYPE === $tokens->look(3)->getType()) { - - $violations[] = $this->createViolation( - $tokens->getSourceContext()->getPath(), - $token->getLine(), - $token->getColumn() + strlen($token->getValue()) + 1, - 'Unsafe attribute value without quotation mark.' - ); - } + $quots = substr_count(strstr($token->getValue(), '<'), '"'); + + if (!($quots % 2)) { + $violations[] = $this->createViolation( + $tokens->getSourceContext()->getPath(), + $tokens->look(Lexer::NEXT_TOKEN)->getLine(), + $tokens->look(Lexer::NEXT_TOKEN)->getColumn() + strlen($tokens->look(Lexer::NEXT_TOKEN)->getValue()) - 1, + 'Unsafe attribute value without quotation mark.' + ); + } + } $tokens->next(); }